Find instance method "where" in Rails Docs

Hello Experts.

It seems impossible to make a simple task, find given method for given class in Ruby on Rails 3.1.3 docs.

For example, I need to find ActiveRecord#where.

Using link "Methods" in http://rubydoc.info/gems/activerecord/frames
gives the source code, but no description:

def where(opts, *rest)
  return self if opts.blank?

  relation = clone
  relation.where_values += build_where(opts, rest)
  relation
end


Apparently, the principal site: http://api.rubyonrails.org/
has no link to "Methods" or to index at all.

Can you help please?

I just would like to know, can be this call signature used:

User.where activated: true
or
User.where :activated => true
instead of longly:

User.where("activated == TRUE")

"activated" is a field in table "users".

Thank you.
LVL 2
BitlabAsked:
Who is Participating?
 
JESiiConnect With a Mentor Commented:
You're right; my favorite site is http://apidock.com/rails/ActiveRecord/QueryMethods/where but no documentation there as well.

Check out http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html - 'where' is referenced in an example with a brief discussion.

Notice that 'where' is an arel (A Relational Algebra) method, so try here: https://github.com/brynary/arel#readme
0
 
BitlabAuthor Commented:
PS. I found reference to where in "principal site" using seach.
It gave: where(opts, *rest)
But there is no description of signature.
0
 
JESiiCommented:
Here's the Arel version used in Rails: https://github.com/rails/arel
0
 
BitlabAuthor Commented:
Thank you.

Despite there is no doc yet, for me, apidoc is a discovery of nicely usable doc-site.
And ... ARel is looks like a discovery of a huge horizon ... "algebra" is a great way
shape a mind ...
0
 
BitlabAuthor Commented:
correction: "ARel is looks" meant "ARel looks"
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.