Em 07-12-2012 11:44, Ernie Miller escreveu:
...
While the most common usage of Squeel is via instance_eval, and I know
core is traditionally not in favor of such dark arts, it's perfectly
possible to use Squeel syntax without instance_eval, as in:
Post.where { |post|
post.title.like('zomg%') | post.title.like('bbq%')
}
# => SELECT "posts".* FROM "posts" WHERE (("posts"."title" LIKE
'zomg%' OR "posts"."title" LIKE 'bbq%'))
What if a column is named "class"? I'd rather prefer something like that:
Post.where { |post|
post[:title].like('zomg%') | post[:class].like('bbq%')
}
--
You received this message because you are subscribed to the Google Groups "Ruby on
Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.