Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This is all inside a controller
- def create_user
- @user = User.new
- @track_methods = []
- set_password()
- set_roles()
- set_ownership()
- # NOW: will @track_methods reflect all the additions in methods below? And will @user
- # object have been updated? My question is how do I share objects accross method calls like this.
- end
- private
- def set_passwords
- @track_methods << "passwords"
- @user.password = 'xxxx'
- end
- def set_roles
- @track_methods << "roles"
- @user.roles = Role.find(params[:roles])
- end
- def set_ownership
- @track_methods << "ownership"
- @user.stands = Stand.find(params[:stands])
- end
Add Comment
Please, Sign In to add comment