[Rails] Re: how to access variable in 3 level (model,controller,vie
Fuyi wrote:
> how to access variable in 3 level (model,controller,view)
>
> i use session[:current_unit] only can in C and V
> can't access in M
>
> i mean is use a goloble variable can access in anywhere
You probably don't want to use a global variable for this.
>
> Such as:
> user slecet a Unit,
> in model, before User.save the user.unit_id must set
> session[:user_id]
> in login form User must select a unit , this is current_unit, I
> save it in session[:user_id]
> but how can i get it in model
> or there are an other mothed to handle it
It sounds like you're not going about this correctly. Can you give more
details of what you're trying to do?
>
> thanks!
Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org
--
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@googlegroups.com.
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.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home