I would put this in a callback in the controller. I suggest starting at before_save and go from there.
-eric On Nov 7, 8:05 am, 7H3LaughingMan <[email protected]> wrote: > I would like to know if it is possible to alter a variable during the > process of a custom validation. I know that it is no longer validation > when your altering data but in my opinion there are times when you > need alter it for simplicity sakes. A good example would be for a > world wide auction house type application and to to convert currency > to one single format, when you validate you check to see if both the > amount is alright along with the currency type. (This is assuming you > can type in what type of currency it is, and for this example is > possible.) > > The application I am developing allows the user to type in multiple > currencies at one (This is a D20 RPG, and people type in something > along the line of 12 pp 145 gp 78 sp 21 cp) and so far the validation > process involves converting it all to the lowest currency type. But > for the sake of being DRY I would only need to add another line to set > the variable, but instead it is looking like I would have to repeat > the whole method and add in the single line and change it that way on > creation and updates. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

