Thursday, November 17, 2011

[Rails] Access a “session” variable in a nested model

Hello people.

I have a big problem here. In my rails 3.0.9 app I have a model
"invoice" that model "accepts nested attributes" for "invoice
details". So, I don't have a "controller" nor "views" for "invoice
details", just model, because I have a "partial" in "invoices views"
for the "nested attributes".

The thing is that I need to run a custom validation when every
"invoice details" is created, and I need a variable stored in
"session". But Models can not access "session" variables.

So I want to know, how can I access that variable and then use it in
my validation.

Thanks

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


Real Estate