-
All records where a particular key is present:
Groupings::Collection.where("document ? 'name'")
OR
Groupings::Collection.where("document ? :key", {key: 'name'}).
$ cat /Users/mark/.rvm/log/ruby-1.9.3-p125/autoreconf.log | |
[2012-03-20 15:09:09] autoreconf | |
Can't exec "aclocal": No such file or directory at /usr/local/Cellar/autoconf/2.68/share/autoconf/Autom4te/FileUtils.pm line 326. | |
autoreconf: failed to run aclocal: No such file or directory |
def do_this | |
new_array = [] | |
[{"id" => 1,"abbrev" => "GEN","name" => "Genesis","chapters" => 50},{"id" => 2,"abbrev" => "EXO","name" => "Exodus","chapters" => 40},{"id" => 3,"abbrev" => "LEV","name" => "Leviticus","chapters" => 27},{"id" => 4,"abbrev" => "NUM","name" => "Numbers","chapters" => 36},{"id" => 5,"abbrev" => "DEU","name" => "Deuteronomy","chapters" => 34},{"id" => 6,"abbrev" => "JOS","name" => "Joshua","chapters" => 24},{"id" => 7,"abbrev" => "JDG","name" => "Judges","chapters" => 21},{"id" => 8,"abbrev" => "RUT","name" => "Ruth","chapters" => 4},{"id" => 9,"abbrev" => "1SA","name" => "1 Samuel","chapters" => 31},{"id" => 10,"abbrev" => "2SA","name" => "2 Samuel","chapters" => 24},{"id" => 11,"abbrev" => "1KG","name" => "1 Kings","chapters" => 22},{"id" => 12,"abbrev" => "2KG","name" => "2 Kings","chapters" => 25},{"id" => 13,"abbrev" => "1KR","name" => "1 Chronicles","chapters" => 29},{"id" => 14,"abbrev" => "2KR","name" => "2 Chronicles","chapters" => 36},{"id" => 15,"abbrev" => "EZR","name" = |
[{"id"=>1, | |
"abbrev"=>"GEN", | |
"name"=>"Genesis", | |
"chapters"=> | |
[{"id"=>1, "verse_count"=>"31"}, | |
{"id"=>2, "verse_count"=>"25"}, | |
{"id"=>3, "verse_count"=>"24"}, | |
{"id"=>4, "verse_count"=>"26"}, | |
{"id"=>5, "verse_count"=>"32"}, | |
{"id"=>6, "verse_count"=>"22"}, |
I have worked, and am currently working on internationalization of a Rails app. The apps require translating the ActiveRecord models. I have done some googling, but haven't really found any best practices / conventions / guidelines on how to think through this and what guidelines to follow.
I decided to create this document, to give myself a start and have it possibly help others. I am not an expert at any of this, and there may be things I am thinking incorrectly, but having it documented makes it easier to see the flaws and improve upon. If you have some ideas on additions, or think that somethings should change, get in touch.
Note: I use Globalize for model translations
I18n.locale
controls the app wide locale. It refers to the particular localization version of the app. It defines how the app is localized to the user. It's scope is somewhat larger than the language/tranCurrently passenger 4.0.39 and above come with a default nginx configuration file with a location @static_assets
block. Paste the following inside it.
if ($request_filename ~* ^.*?/([^/]*?)$) {
set $filename $1;
}
if ($filename ~* ^.*?\.(eot)|(ttf)|(svg)|(woff)$) {
add_header Access-Control-Allow-Origin *;
}
Name: | |
Date: | |
No using computers or google: | |
For the following 5 questions, chose the option that answers the question. | |
1. If a variable is named ‘$var’ what type is it ? |
#References: | |
# https://github.com/zufrieden/stopwatch/blob/master/config/environments/staging.rb | |
# http://rubydoc.info/github/rack/rack/Rack/Auth/Digest/MD5 | |
# http://www.sitepoint.com/understanding-http-digest-access-authentication/ | |
# http://levick.tumblr.com/post/65244327897/encrypted-http-basic-auth-in-rails-digest-auth | |
#"Staging" is the 'realm', | |
# SecureRandom.base64 is the opaque | |
# "foo" is the username |
#!/usr/bin/env ruby | |
require 'english' | |
require 'rubocop' | |
require 'byebug' | |
ADDED_OR_MODIFIED = /A|AM|^M/.freeze | |
changed_files = `git status --porcelain`.split(/\n/). | |
select { |file_name_with_status| |
The Active Record pattern is described as
An object that wraps a row in a database table or view, encapsulates the database access, and adds domain logic on that data.
It is tightly coupled to the database schema. In other words, decisions that go into designing entities (objects/classes that hold application independent business logic) of your software project affect the database and vice versa.
Ideally, the database is a layer of abstraction lower than your application. What that means is that the decisions of your peristence layer should not affect design decisions of your business logic and vice versa. As an example, you should be able to think through the design decisions of a relational or a non relational database looking at peristence only and not having to wonder how that would affect the rest of your application. This is definitely not