before filter - In Ruby on Rails, when a before_filter is used, then the local variables need to become instance variables? -
if have before filter that's called initialize
initialize common variables, variables must made instance variables? there alternative ways of doing it?
update: situation validate url params, , set them. used in 1 action, can done using local variables. now, 3 actions take same params, code moved private method validate_params
, , called using before_filter
, local variables seem have made instance variables.
can not made instance variables? there frameworks / gems validating url params since built-in validations models.
are there alternative ways of doing it?
doing what, exactly? if want variable available methods in controller, instance variable typically appropriate. if want have variable (or more constant) available controllers, or models , views, there other techniques accomplish that. we'll need more detail specific requirements figure out.
Comments
Post a Comment