Just another question:
How about if I need to call out the name of the column as well as
the value
it shows if that column has the minimum value.
something like model.attributes.(except or slice or reject).sort {|
first, second| first[1] <=> second[1]}
This will return a sorted array of key value pairs.
link?
if you’re looking through the ruby api you won’t find it because you
need to be looking at the rails ones. There are quite a few places
which display the docs in a variety of formats, including http://api.rubyonrails.com/
Let me try to rephrase: where do u learn the how to manipulate the model
with those extensions. For instance (model. “attribute”. “value”) where
do u
learn that u can add those values to the model so that u can bring
something
like the attribute or the cell value of the record out I can’t seem to
find
any resource on it. The api gives methods but not this(or maybe I can’t
seem
to find where it is in the api)
if you have an instance of a model, some of the methods are part of
the api, but some are added at runtime based on information from the
database. So for example if your users table has a name column then
instances of User will have a name method, but there is nowhere you
can look that up. There are a few other places where rails generates
methods at run time (eg dynamic finders).