Hi -

Thanks a lot, I like the simpler way you wrote out.

My question is, though, is that method vulnerable to mass-assignment 
attacks? I know that if it were attr_accessible, a user would be able to 
pass in a value for :signing_up and avoid having their data validated, 
but I don't know whether the same is true for attr_accessor.

Thanks again!
Chris


Dmitry Sokurenko wrote:
> Probably the best way is to redesign the app, so validations will be
> always required (eg introduce a Signup model associated with user).
> 
> But if you are looking for the simpler way then try.
> 
> # in user.rb
> attr_accessor :signing_up
> validates ..., :if => :signing_up
> 
> # in users_controller.rb
> def create
>  User.create(params[:user].merge(:signing_up => true))
> end
> 
> Or if the you want to skip those validateions for all already created
> users, then just use validates ..., :on => :update
> 
> Dmitry

-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to