If we have a before filter that's called initialize
to initialize common variables, then those variables must be made into instance variables? Are there alternative ways of doing it?
Update: The situation is to validate some URL params, and set them. This used to be in one action, so everything can be done using local variables. But now, 3 actions essentially take the same params, so the code is moved to a private method validate_params
, and called by using before_filter
, but those local variables seem to have to be made into instance variables.
Can they be not made into instance variables? Are there frameworks / gems for validating URL params since the built-in validations are for Models.