On 27 February 2010 19:24, Michael Pavling <[email protected]> wrote:
> So you need to create a method on your controller that will return the
> @user object. The convention for this method seems to be to call it
> "current_user".
>

*ahem*  Of course... an instance of a model doesn't have access to
application_controller's methods... I was getting carried away with
myself.
You will *also* need to pass this to the Post directly... so declare
an "attr_writer :current_user" on your Post model, and in the
controller, when you instanciate the Post, pass it the variable:

post = Post.find(params[:post_id] # or whatever...
post.current_user = current_user

-- 
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 [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-talk?hl=en.

Reply via email to