Strong Parameters requires whitelisting of Action Controller parameters by default. In Ruby on Rails this means the developer will have to make a choice about which Active Model attributes are eligible for mass assignment. Strong parameters have been included in Rails 4 by default.
Questions tagged [strong-parameters]
956 questions
0
votes
1 answer
Unpermitted parameter error (strong params)
I have a form:
= simple_form_for @character do |f|
= f.input :name
= f.input :description
= f.simple_fields_for @movie_characters do |fmc|
= fmc.association :movie, value_method: :id, label_method: :title
=…

Leo
- 2,061
- 4
- 30
- 58
0
votes
1 answer
Is there a workaround for strong parameter hell?
I just inherited a RoR 3.2 app and am trying to get it working on 4.2
I am going to put on my sarcastic hat for a second, just so I can feel better. Instead of having a single line in a single file to protect specific fields from mass-assignment,…

david
- 195
- 1
- 13
0
votes
1 answer
Rails + Mongoid + Strong Parms failure
So, I'm relatively new to ruby and rails. I'm playing around with mongoid for my database, though the only knowledge I hold is using active record.
I created a fresh project, being sure to skip active record so that I didn't have to perform the…

Johnny
- 841
- 3
- 10
- 25
0
votes
1 answer
Post List of Values to model params
I am creating instructors page which have multiple course ids to be passed to the model parameter list.
The following is my code for whitelist params
def instructor_params
params.require(:instructor).permit(:LastName, :FirstMidName, :HireDate,…

Akhil
- 1,918
- 5
- 30
- 74
0
votes
1 answer
I keep getting this error "param is missing or the value is empty: skyscraper_applications" an i am not sure why
my controller:
class SkyscraperApplicationsController < ApplicationController
def new
@skyscraper=SkyscraperApplications.new(skyscraper_params)
if @skyscraper.save
redirect_to "/skyscraper_applications/new", :notice =>…
user3972049
0
votes
1 answer
Rail's strong_parameters not marking Array's Hashes as Permitted
I've got a bit of a puzzler on for strong_parameters.
I'm posting a large array of JSON to get processed and added as relational models to a central model. It looks something like this:
{
"buncha_data": {
"foo_data" [
{ "bar":…

Mojowen
- 437
- 1
- 4
- 17
0
votes
1 answer
How to assign strong parameters of deeply-nested attibutes in Rails4?
I'm trying nested objects in a Rails4-app according to this Railscast. The model survey has_many :questions, the model questions in turn has_many :answers, the model answers belongs_to :questions and questions belongs_to :survey.
Now, the models…

ljnissen
- 139
- 1
- 12
0
votes
2 answers
Rationale behind strong params and variables that are only permitted for some users
I'm having a hard time understanding strong params. I understand it prevents mass assignment of variables you don't permit. But in Hartl's tutorial I also read that without strong params someone could change for example any user's admin status…

Nick
- 3,496
- 7
- 42
- 96
0
votes
0 answers
While updating item, not saving changes from nested resource
Sorry for noob question, I'm just trying RoR, but I have an issue with passing to strong params (I guess) nested resources items.
controller:
def update
if @product.update(product_params)
redirect_to @product, notice: "product has been…

Severynsky
- 1
- 1
0
votes
1 answer
AssociationTypeMismatch (User(#301360) expected, got Hash(#88300)) in Rails
I try to create an Object from nested json. But I get a AssociationTypeMismatch error.
I am new to ruby on rails and not sure, it is the right way to do this.
I am thankful for any tips.
The error appears in this line "@avatar.from_json(json)" in…

freshgrand
- 3
- 4
0
votes
2 answers
White listing JSON parameters using Strong Parameters in rails
I have this ajax call which sends a JSON -
$.ajax({
data: JSON_main_data,
url: '/daily_work_updates',
type: "POST",
success: function(data){
if (data ==true)
alert("Data saved…

Alex Jose
- 278
- 3
- 17
0
votes
1 answer
Strong parameters with Rails 4.0 and Devise
I am using Rails 4.2 and devise.Request type will always be JSON.My registrations controller looks like this
class Users::RegistrationsController < Devise::RegistrationsController
before_filter :configure_sign_up_params, only: [:create]
def…

Sooraj Chandu
- 1,348
- 16
- 35
0
votes
1 answer
acts_as_taggable_on whitelisted strong parameters still unpermitted
Bashing my head against the wall with this one. I have implemented acts_as_taggable_on but even though I have whitelisted the parameters (as in the documentation) I am getting an unpermitted parameters error.
Cannot figure out why.
All help…

rcrcr
- 65
- 2
- 7
0
votes
2 answers
Why won't rails create associated records/objects from nested form using strong parameters?
I'm trying to create a record and it's associated records from a nested form using strong parameters. My primary model is:
class MaterialDonationRequest < ActiveRecord::Base
has_many :donation_items, dependent: :destroy
…

tobogranyte
- 899
- 1
- 9
- 26
0
votes
1 answer
Rails: manipulate URL query param keys before request hits controller
I need to pass some params in the url from a 3rd-party service into User#new.
Due to strong parameters the controller is expecting params in the form user[name], user[email]. However, this 3rd-party service is blocking the use of square brackets in…

Meltemi
- 37,979
- 50
- 195
- 293