articles Different strong parameters on create and update
20 Jul 2020
Develop the right mindset for Rails security
Avoid shipping vulnerable code by learning how to prevent security issues in your Rails applications.
Get the course for $99...
def post_create_params
params[:posts].permit(:category_id, :title, :body)
end
def post_update_params
params[:posts].permit(:title, :body)
end
...ActionController::Parameters#except:
...
def update
@post.update(post_params.except(:category_id))
end
private
def post_params
params[:posts].permit(:category_id, :title, :body)
end
...Or follow me on Twitter
Hire me for a security audit
I find security issues before the bad guys do.
Penetration test for Rails apps