ruby on rails - preventing active record attributes from being modified by forms -


In Ruby on Tracks, updating a model from HTML Forms is very easy. Normally you can make a form_ with the model, and the fields will be updated when the user hits the submit button.

While saying that a malicious user wants to update without updating their 'pay', the proper channel should not just inject an area under the name of 'pay' while updating their email address. Can you (for example) and determine for your wages basically what they want? How can I specify which fields can be modified and which can not do to stop it?

@user.update_attributes (params [: user] / code>

they can update anything they are scary I can attr_accessible I understand the usage, but it is only relevant to large-scale updates, is not it?

You can limit this field, which fields can be assigned using:

  attr_accessible: name, address # no: salary    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -