On 8 July 2010 17:12, tom
<tomabroad-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> hi
>
> i have a Project & Task model.
>
>
> ########
> Project model has that additional method:
>
> def self.lasttask(project, sort="DESC")
> Task.find(:first, :conditions=>[''project_id = ? '',
> project.id], :order => "somedate #{sort}" )
> end
As a side note this would be better as a named_scope.
>
> ########
> The Task model has one attribute called "specialtask" which is
> boolean.
> bewteen
> Now, i can do this in the console:
> p=Project.find(1)
> Project.lasttask(p).specialtask
>>> TRUE or FALSE
>
> meaning its working. But doing it in the view it throws me an error
> telling me specialtask is unknown.
> <%= debug Project.lasttask(p).specialtask %>
>
> //the debug shows cleary the attribute.
I don''t understand, first you say it throws an error, then you say it
clearly shows the attribute.
Can you post the code around the error and the exact error and stack
dump please?
Colin
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.