Rails has all sorts of auto-generated methods that I've often times struggled to find documentation for.
For example, in routes.rb
, if I have:
map.resources :projects do |p|
p.resources :tasks
end
This will get a plethora of auto-generate path and url helpers. Where can I find documentation for how to work with these paths? I generally understand how to work with them, but more explicit docs might help me understand some of the magic that happens behind the scenes.
# compare
project_path(@project)
project_task_path(@project, @task)
# to
project_path(:id => @project.id)
project_task_path(:project_id => @project.id, :id => @task.id)
Also, when I change an attribute on a model, @post.foo_changed?
will be true. Where can I find documentation for this and all other magical methods that are created like this? If the magic is there, I'd love to take advantage of it.
And finally: Is there a complete resource for config.___
statements for environment.rb
? I was able to find docs for Configuration#gem
but what attributes can I set within the stubs like config.active_record.___
, config.action_mailer.___
, config.action_controller.___
, etc. Again, I'm looking for a complete resource here, not just a settings for the examples I provided.
Even if you can only answer one of these questions, please chime in. These things seem to have been hiding from me and it's my goal to get them some more exposure, so I'll be upvoting all links to docs that point me to what I'm looking for.
Thanks!
ps, If they're not called auto-generated methods, I apologize. Someone can teach me a lesson here, too :)
Edit
I'm not looking for tutorials here, folks. I have a fair amount of experience with rails; I'm just looking for complete docs. E.g., I understand how routing works, I just want docs where I can read about all of the usage options.