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
rspec controller ActiveModel::ForbiddenAttributesError
I'm trying to test my controller in rSpec and get the following error:
1) ClientsController POST create with valid params creates a new Client
←[31mFailure/Error:←[0m ←[31mpost :create, {:client => valid_attributes}←[0
m
…

CaptainCarl
- 3,411
- 6
- 38
- 71
0
votes
1 answer
Rails 4 Strong Params Error
I am using rails 4. I have a model that uses validation, but does not store any records. It is only used for a web contact form that sends an email.
I am trying to use strong parameters with this controller/model. Currently I am getting a…

Keil Miller
- 71
- 10
0
votes
1 answer
Rails 4.0.0 strong parameters don't seem to work as documented
The example used in the documentation (http://guides.rubyonrails.org/action_controller_overview.html#strong-parameters) for strong parameters is:
params.require(:person).permit(:name, :age)
However, this doesn't work because require() returns the…

Jeremy Burton
- 873
- 6
- 10
0
votes
1 answer
Strong parameers throwing "Unknown key"Error
I am trying to get this model working with Strong Parameters but I can't seem to work out what I am doing wrong!?
ERROR:
Unknown key: name
Controller:
class PracticesController < ApplicationController
def practice_params
if…

mattclar
- 237
- 1
- 3
- 15
0
votes
1 answer
Testing: patch_via_redirect and strong_parameters
Integration test (with Test/Unit) of update method:
test "do the patch" do
user = users(:alex)
get signin_url
assert_response :success
post_via_redirect signin_path, email: user.email, password: 'qwerty'
assert_equal profile_path, path
…

Alex Fedoseev
- 1,135
- 11
- 18
0
votes
1 answer
Strong Parameters Issue - Undefined Method "model" for
I am having an issue that I can't nail down and the other related questions don't seem to ever encounter this issue. I have a Message model and I am trying to add a Message (I am writing this to test something with Faye). I encountered an issue with…

Matt
- 381
- 4
- 13
0
votes
0 answers
Nesting Carrierwave images in Rails 4
This is actually a two part question
For the record - I am using Simple_form, Carrierwave and awesome_nested_fields gems.
In my app I have events, each event has a speaker, and each speaker has a picture. Pictures are not a separate table, they're…

The Whiz of Oz
- 6,763
- 9
- 48
- 85
0
votes
1 answer
Rails4: ForbiddenAttributesError on nested parent's params
I'm still trying to wrap my head around Strong Parameters in Rails 4. I'm getting an ActiveModel::ForbiddenAttributesError when trying to submit a form with params for another model that it belongs_to.
Product :has_many DiskFiles
After some…

Meltemi
- 37,979
- 50
- 195
- 293
0
votes
0 answers
How to add virtual attributes on the fly with strong parameters
I have this controller:
class AccountsController < ApplicationController
def create
if @current_account.update_attributes(account_params)
redirect_to :dashboard
end
end
def account_params
…

CodeOverload
- 47,274
- 54
- 131
- 219
0
votes
1 answer
How do you use 'create!' with strong_params?
Ok, so before installing strong_params, using MyBook.create! would work, but now it doesn't.
Here's my code
class AuthorsController < ApplicationController
def new
@author = user.authors.build
end
def create
@author =…

goo
- 2,230
- 4
- 32
- 53
0
votes
1 answer
Work-around for multiple access cases with strong_parameters
I have an app where the User is allowed to access their :name, :lastname, :email attributes only once - during the initial account setup. After this (for security reasons) they are not allowed to change either of these attributes; only an Admin…

Matteo
- 1,136
- 1
- 16
- 36
0
votes
1 answer
lynda course on ruby - rails 4 incompatible
So I'm doing the lynda.com rails course.
Since the course was recorded for rails 3.1 and I'm now on Rails 4 and they are now enforcing strong_parameters . I added the subject_params definition to comply with that but now i get…

Davi Trindade
- 31
- 1
- 4
0
votes
3 answers
Strong params rails 4 permitting params
Here is what my params look like,
{
:project_id => "1",
:ticket => {:name => "Ticket1"}
}
How do I add the project_id to the permitted params?
Controller
params.require(:ticket).permit(:name)

Francois
- 10,465
- 4
- 53
- 64
0
votes
2 answers
Rails JSON Nested Attributes
I'm working on a Rails 4 API where the client can post data to the controller and it will save in a database. I was wondering how i could implement the user to POST nested JSON and then have the controller accept the attributes and create a model…

ny95
- 680
- 5
- 17
0
votes
1 answer
Rails: How to use Strong_Params on CERTAIN models only
I haven't switched to Rails 4 yet & have been looking into strong_params. I'm liking what I'm seeing & would like to use it on 1 model only. Seems simple but I'm suppose to comment out 'config.active_record.whitelist_attributes = true' in my config…

goo
- 2,230
- 4
- 32
- 53