Why don't you pass the session value as a parameter to a model's method? In your controller you would have something like:
model.exceeded_vote_count?(session[:vote_count]) In your model: def Model.exceeded_vote_count?(count) count > MAX_VOTE_COUNT ? true : false end Pepe On Sep 17, 2:28 am, arifb <[EMAIL PROTECTED]> wrote: > i realized that the post may have not been totally clear: > > basically, i just want to validate against something that is not in > the db/model - is this possible to do in the model so that i have > access to the Error object? > > On Sep 17, 2:11 am, arifb <[EMAIL PROTECTED]> wrote: > > > hello all, > > > i have a model that has a field 'votes'. users may only vote once per > > session and so i am using a session variable to track whether they > > have voted. i would like to use rails validation within the model to > > output an error if a user tries to vote more than once. > > > my issue is that this tracking of whether the user has voted this > > session is not tracked in the database (it is in the session > > variable). is it still possible to use the rails validation framework > > to validate? i am doing the appropriate checking in the controller, > > i'm just not sure how to then propagate this check to the model (in > > order to use the validation framework). can i just define a new > > attribute for the model even though it is not a field in the db? > > > 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 [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 -~----------~----~----~----~------~----~------~--~---

