On Fri, Nov 28, 2008 at 10:29, pankaj <[EMAIL PROTECTED]> wrote:

>
> Project.task.find(project_id,task_id)
> Project.task.build(project_id,params[:task])
> Project.task.delete(project_id,params[:task_id])


What is the real gain here, except avoiding loading the project record in
memory? If that is the reason, we can already do that:

   Task.new(params[:task].merge(:project_id => project_id))

I agree this syntax is more verbose, but perhaps it should stay this way so
the developer doesn't have to make too many decisions on which API to use.

The frequent mistake for underexperienced Rails devs using AR associations
is that they tend to call "Project.tasks", forgetting that "tasks" is an
association defined on a particular Project instance, not at class level.
Adding all associations to class level will just confuse people, IMO.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to