Rails filter params before creating/updating -


I am trying to add user privileges to an existing app that was designed in the brain without user privilege . I.e.) If you are logged in, you can create, update, and delete objects.

The application is using Rail 4, so I can take advantage of strong parameters.

I need to add a new user level which can only edit the nested characteristics of a model, so I thought about filtering the parameters variable that the original model was updated before updating has gone.

How can I filter the params variable before I update or create the model?

You will need some type of authorization method, which can help with this, but I At least I would like to read this chapter of the Rail chapter.

You can read the whole thing, it introduces to an excellent rail

Comments

Popular posts from this blog

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -

jasper reports - How to center align barcode using jasperreports and barcode4j -

django - CommandError: You must set settings.ALLOWED_HOSTS if DEBUG is False -