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
rails deletes first 0 from zip code input in form
I have a form. One of the fields is zip code. If I fill out the form, here are the params:
Parameters: {"utf8"=>"✓", "authenticity_token"=>"fasdafdsafdsdsa/MKI/RGfds3=",
"profile"=>{"title"=>"profile title",…

Philip7899
- 4,599
- 4
- 55
- 114
0
votes
0 answers
Issue with strong parameter and paperclip multi upload
I have tried to add several images and videos to my model presentation, but when I submit the form the console says:
Unpermitted parameters: video
Unpermitted parameters: image
presentation.rb
class Presentation < ActiveRecord::Base
belongs_to…

skorn
- 1
- 1
0
votes
1 answer
Using Strong Parameters With Devise
I have used Devise for authentication.
Went ahead and updated my Users database to include a bio column. Added this and ran the migration so I can see it is there.
Now I want Users to be able to add a bio once they are logged in. Did some research…

PatGW
- 369
- 6
- 19
0
votes
1 answer
How to add to strong parameter whitelist for gem acts_as_votable
I have been using the ruby gem 'acts_as_votable' (https://github.com/ryanto/acts_as_votable) and have been pleased with its ease of use.
My problem arises from the gem's lack of explicit controller creation. Without the controller (and model, so no…

user3811886
- 21
- 3
0
votes
2 answers
Create multiple entries with checkbox and strong params in Rails4
I am having problems with the following scenario:
My users do searches by keywords which produces a list. The user has 2 actions either add them to a favorites table or block them using check boxes.
The problem I have is that when users click "Add…

Altons
- 1,422
- 3
- 12
- 23
0
votes
1 answer
Rails 4 nested form with double association
I have an Order model like this:
class Order < ActiveRecord::Base
belongs_to :service_address, class_name: 'Address'
belongs_to :billing_address, class_name: 'Address'
accepts_nested_attributes_for :service_address, allow_destroy: true
…

H Mihail
- 613
- 8
- 18
0
votes
0 answers
Nested form (strong parameters) inserting without values (besides id and timestamps)
I'm building a RESTful API in Rails 4, and having a difficult time with getting Rails to send nested form attributes for a has_one association through to the database.
I believe that my models are set up as they should be:
class User <…

Trevor Filter
- 117
- 1
- 5
0
votes
1 answer
Use value from parameter
Ruby on Rails 4
I am passing a hidden value from my form.
<%= f.hidden_field :applied_program, :value => @applied_program.id %>
This is what is posted:
"applied_program"=>"891"} ...
ActiveRecord::RecordNotFound (Couldn't find AppliedProgram with…

DDDD
- 3,790
- 5
- 33
- 55
0
votes
1 answer
Grape API in Rails and issues with Strong Parameters
Here is what my API looks like
resource :service_requests do
before do
error!('Unauthorized. Invalid token', 401) unless current_company
end
get do
current_company.service_requests
end
params do
…

dennismonsewicz
- 25,132
- 33
- 116
- 189
0
votes
1 answer
Allow an array of hashes with a dynamic hash (hstore) inside
I'm stuck with strong_parameters and this array of hashes with a dynamic hash (hstore) inside.
The structure is the following:
{ contact_sources: [
{ id: 1, filled_fields: { randomstuff: 'randomdata', dunno: 123 } },
{ id: 2, filled_fields: {…

Francesco Belladonna
- 11,361
- 12
- 77
- 147
0
votes
1 answer
Rails 4, nested attributes, strong parameters & JSON
Rails 4, basic JSON API - I am tying to update Status object with association Position objects.
Job Status model:
class JobStatus < ActiveRecord::Base
belongs_to :job
has_many :positions
accepts_nested_attributes_for :positions, limit:…

threewordphrase
- 173
- 3
- 13
0
votes
1 answer
Array in Rails 4 strong parameters (not nested)
I want to create several objects at a time, from my index view, so I have inputs: post[][title] and post[][parent_id], in my post_controller.rb i have:
def post_params
params.require(:post).permit(:title => [], :parent_id => [])
end
But I'm…

Max Filippov
- 2,024
- 18
- 37
0
votes
3 answers
When are Strong Parameters used?
I understand strong parameters are used in cases where we are creating an object and putting it into our database. For example,
User.create(params[:user]) would have to be User.create(params.require(:user).permit(:name, :email, :password).
This is…

David
- 7,028
- 10
- 48
- 95
0
votes
1 answer
Rails strong params giving wrong number of arguments exception
I'm trying to implement simple authorization following by certain tutorial.
class AuthController < ApplicationController
layout 'public'
def auth_user
user = User.authenticate(login_params)
if user
…

heximal
- 10,327
- 5
- 46
- 69
0
votes
0 answers
Nested attributes undefined user_comments_path error
I'm trying to follow Ryan Bates polymorphic models tutorial (Rails 3), to implement comments in my photo model. I'm having trouble when trying to create a new comment for photos since I'm in Rails 4 and I have to deal with :comment strong…

Gibson
- 2,055
- 2
- 23
- 48