I have justs started a file upload applciation. I am using the
Login_Sugar project as well. It has a User model. My file upload has a
Content model. The contents table has a foreign_key constrains on the
users table (in other words, each piece of content is owned by one
user).
The upload controller passes control to the Content model which needs to
define the "user" member. This is kept in the session and can be
accessed by the controller via "session[:user]".
How do I pas the session or the user object to the model?
Note: I''m sure there must be a standard and easy way to do this. A way
that does not involve passing another parameter to the Content''s
constructor.
I tried writing a class method in the controller to simply return the
session[:user] but when called from the context of the Content model it
always returns nil (the session is nil at this point).
Any ideas ont is would beappreciated. I''m new to Ruby+Rails.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---