I am new to Rails and I find it extremely opaque. I have a copy of the latest Agile Web Development with Rails, but I'm worried that without this book I would have been completely lost.
For example, following the example of a depot in a book, when it comes to adding validation to a model, you do
class Product < ActiveRecord::Base validates :title, :description, :image_url, :presence => true end
It seems easy enough, except that without the AWDwR book, I would never have thought of that. There is nothing in the ActiveRecord :: Base documentation that mentions the validates method.
It seems to me that with Rails you simply must mysteriously know what methods are available at any time in the project. But if you do not know how you should know (except remembering a book with more than 500 pages)?
I can formulate the question differently: in my Product class, I have the validates method available to me. How is this method available for my product class? Even knowing that it is defined in ActiveModel :: Validations :: ClassMethods (I know this because I searched for it), I cannot understand how it was available for my Product class.
source share