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
Save a hash to a parameter?
I would like to save the params from the form submitted into a hash called: hash_options which corresponds to a field in my table.
How do I store the hash of: hash_options as the value for: hash_fields ?
hash_fields is a text field and I am…

MrPizzaFace
- 7,807
- 15
- 79
- 123
0
votes
0 answers
Rails Strong Params blocks my Jquery datepicker plugin
This is a headscratcher for me, a search on google yields no results so I'll try here. I'm doing a rails app and using the datepicker plug in, so I can see a calendar view when I select my date on a form_for. Everything works fine, as long as I'm…

ChrisPalmer
- 285
- 4
- 15
0
votes
2 answers
Unpermitted parameters - Rails 4.1.1, Ruby 2.1.2
I cannot seem to get to the bottom of where I am going wrong. My "order.rb" fields populate ok, but I can't get the "order_row" table values to populate. I just keep getting the following error in terminal(not worried about date for now, should be…

polarcare
- 575
- 1
- 6
- 24
0
votes
3 answers
Strong Attributes exception in rails 3. No idea whats causing it
Been stuck on this for a few days now. Any help would be much appreciated. I have a form that sends an artist name to a create controller. The create controller creates the artist with the name, assigns a user to that artist, and creates an artist…

therealtedkennedy
- 45
- 7
0
votes
1 answer
How can I use strong parameters for a file field that is not directly in the database?
I want to collect a certain field from the User, but I first manipulate it before putting it in the database. I have begun to use strong paramaters and I'm confused on how to do this. I keep getting the error unpermitted parameters:…

David Mckee
- 1,100
- 3
- 19
- 35
0
votes
1 answer
How do you access params[:model][:field] in Rails 4?
From what I understand...
If you have a form_for @model, params[:model] is available when the form is submitted. Furthermore, if the form has 2 attributes attr1 and attr2, params[:model][:attr1] and params[:model][:attr2] are available when the…

Adam Zerner
- 17,797
- 15
- 90
- 156
0
votes
1 answer
Rails 4 strong parameters: check whether a param is in the whitelist, without actually updating it
I've built some in-line editing features using AJAX that allows a user to update lots of small bits of information on the page, and constructs JS to update the page afterwards. This same logic should handle tens of different mini-forms containing…

Topher Hunt
- 4,404
- 2
- 27
- 51
0
votes
1 answer
Strong params not permit dynamic keys
my controller is receiving this params
{"utf8"=>"✓",
"_method"=>"patch",
"authenticity_token"=>"r5KaLCrb1PR//q4HZ0p30dUeK1OHE7cjtoken=",
"servidor"=>
{"nome"=>"USER NAME",
"tipo"=>"1",
"lotacao_ids"=>{"1"=>["", "86", "13"], "2"=>["",…

Luiz Carvalho
- 1,549
- 1
- 23
- 46
0
votes
0 answers
I am getting an authenticity exception in rails 4 when I submit a form
Okay. I was cruising a long with a simple rails 4 app, and all of the sudden I am getting an exception, and info is not being stored in database.
Controller-
def new
@game = Game.new
end
def create
@game = Game.new(game_params)
if…

Reeder32
- 89
- 4
0
votes
1 answer
Strong Parameters: display error when sent param is not in allowed list (in development)
Is there a way to display an error when a sent param is not in allowed list (in development)?
I very often forget to add the param to the list and don't notice it in the first place.

Joshua Muheim
- 12,617
- 9
- 76
- 152
0
votes
1 answer
Rspec-rails 4 error: ActiveModel::ForbiddenAttributesError
I have an application running in rails 4.1 using mongoid as the orm. I created a model called User which has an attribute email. I am using RSpec for tests. I created the following spec
require 'spec_helper'
describe 'User' do
before(:each) do
…

Rahul
- 44,892
- 25
- 73
- 103
0
votes
1 answer
Upload single file via paperclip fails with unpermitted parameters
I have an Account model with a single attachment intended to be used for a logo, called logo. I have set logo in the parameters list, form is multi-part but I keep getting an unpermitted parameters :logo in the output during this request:
Everything…

Craig McGuff
- 3,968
- 6
- 30
- 35
0
votes
1 answer
Strong parameters in test issue
Ruby 2.1.1p76 on Rails 4.1.1.
Please check out my controller:
def update
begin
current_user.update_settings user_settings_params unless params[:user_setting].blank?
current_user.update_attribute :district_id, params[:user][:district_id] unless…

Greg
- 5,862
- 1
- 25
- 52
0
votes
1 answer
Many to Many initializing relationship as default in Def New
In Rails 4.0 I have a many to many relationship of game, game_item (the look up table) and item. How do I initialize a default relationship to existing Items when creating a new Game?
game.rb:
class Game < ActiveRecord::Base
has_many :game_items
…

DogEatDog
- 2,899
- 2
- 36
- 65
0
votes
2 answers
Strong parameters in Rails - automatically adding in migration
After updating some 15-20 entries of my new database I realized my data wasn't updated. I just read about the strong parameters in Rails 4.0 and it turned out that I hadn't whitelisted them. I understand the reason for having them (although I…

Christoffer
- 2,271
- 3
- 26
- 57