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
How to add except in an initializer?
I am using strong_parameters gem in my rails project. To apply that to all the models i have created an initializer and put the below code.
ActiveRecord::Base.send(:include, ActiveModel::ForbiddenAttributesProtection)
Now i don't want to apply it…

Can Can
- 3,644
- 5
- 32
- 56
0
votes
1 answer
ActiveModel::ForbiddenAttributes error
I have done the following things. I installed strong_parameters gem.
1)I created a initializer and added the following line ActiveRecord::Base.send(:include, ActiveModel::ForbiddenAttributesProtection)
2)I removed attr_accessible from model.
Then i…

Can Can
- 3,644
- 5
- 32
- 56
0
votes
1 answer
Strong Params Unpermitted parameters
I know there are alot of questions on this, but after looking at about a dozen or so none of them appear to be the same problem. I have an "Action" model that I am just simply trying to edit and update. (fyi, this isn't a nested form, I'm not using…

Steve Q
- 395
- 5
- 28
0
votes
2 answers
undefined local variable or method `availability_params' for #
I'm trying to create new availability object in a program and all of the sudden I can't find availabilities_params. Not sure what is going on exactly.
class AvailabilitiesController < ApplicationController
def create
@availability =…

Edward Leon Jasper
- 61
- 1
- 6
0
votes
1 answer
Using Simple Form to update to-do list task on click
I'm trying to use simple form to update a nested object on the click of a button. I'm making a to do list, with individual tasks/items nested within the overall list. The button click should update the task's completed attribute to true. The button…
user3721240
0
votes
3 answers
Strong parameters with Active Admin: no implicit conversion of Symbol into Integer
I'm on Rails 4 and using Active Admin. I need to have a different set of parameters permissible for the create and update methods, so I am approaching this by modifying the instructions from the Active Admin documentation. Here is what I am trying…

azangru
- 2,644
- 5
- 34
- 55
0
votes
2 answers
Rails Strong Parameters for an API
I'm trying to build a Rails-based API to be consumed by an ember app. I'm working on project creation, and I'm running into some problems with strong parameters:
class ProjectsController < ApplicationController
def create
respond_with…

DVG
- 17,392
- 7
- 61
- 88
0
votes
1 answer
Rails 4: strong_params,nested_attributes_for and belongs_to association trouble
I really can't get my head around Rails 4 strong parameters, belongs_to association and form with fields_for.
Imagine I have model for quoting some price:
class Quote < ActiveRecord::Base
belongs_to :fee
accepts_nested_attributes_for :fee
Now,…

Dr.Strangelove
- 1,505
- 1
- 11
- 12
0
votes
1 answer
"param is missing or the value is empty" in nested form
I'm currently trying to build a really simple nested form app in my quest to learn rails. In this app I have three models legal_form answer and question. I have my my answers.html.erb, set up as follows:
<%= form_for (@legal_form) do |f|…

neanderslob
- 2,633
- 6
- 40
- 82
0
votes
0 answers
Rails 4 protected attributes in Production only
I have a Rails 4.1 app that was once a 3.2 app. During the course of steadily upgrading the app I originally used the protected_attributes gem. I have now removed this gem and specified the proper permit strong params like this:
def step_params
…

Jaijaz
- 134
- 1
- 12
0
votes
1 answer
ForbiddenAttributesError in Rails 4 with a has_many polymorphic accepts_nested_attributes_for form
Trying to create a address for my member model with a nested form.
model
class Member < ActiveRecord::Base
has_many :addresses, :as => :addressable, dependent: :destroy
accepts_nested_attributes_for :addresses
end
class Address <…

Morphiuz
- 39
- 6
0
votes
1 answer
Rails strong parameters not recognizing my params
I created a form to add a record to :vote model that belongs to :article model. As you can see below, the form to create the :vote record is in a :article view. In not using nested routes for these models so instead of using the form_for helper, I'm…

walt
- 11
- 3
0
votes
1 answer
Rails - Strong params, and creating a new resource via nested attributes for a delegated association?
My Rails 4 app is a fundraising tool for a bike ride. A user can create a RiderReg(istration), and a User also has an associated MailingAddress, that is delegated to the User via the RiderReg.
The associations seem to work in the console, but I'm…

Avi Fox-Rosen
- 55
- 1
- 6
0
votes
1 answer
Matching up collection_select output with strong parameters
In rails console & using the models below, I connected grades K, 1, and 2 to the school whose Edit form has this select field:
As you can see, that association correctly selects the 3 items in the field, but if I click to select/deselect grades,…

clozach
- 5,118
- 5
- 41
- 54
0
votes
3 answers
rails 4.1 from rails 4 in action and rspec
I'm trying to learn rails 4.1 from rails 4 in action book, I've got to chapter 13, in this chapter defined API for JSON and XML.
It defined a controller like this :
class Api::V1::ProjectsController < Api::V1::BaseController
def index
…

m scorpion
- 21
- 4