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
Conditionally displaying resources in a many-to-many relationship - Rails 4
Working through my first Rails app. It will be used for searching and viewing data on books within certain categories.
Two resources: Categories and Books. I created a many-to-many HMT (has many through) relationship (following this RailsCast), as…

Isaac Gregson
- 1,999
- 1
- 21
- 31
0
votes
2 answers
Rails - two forms on one page
I have two forms on one view page. One of these is an update form. The other form is a single button that goes to the same controller action but does not actually update the form. Here is the first form:
<%= form_for [@project, @schedule] do |f|…

Philip7899
- 4,599
- 4
- 55
- 114
0
votes
1 answer
Need best way to whitelist the params in this code
I need to convert this code in my ConfirmationsController to work in Rails 4. I'm having difficulty with the requirements for Strong Parameters. The code I'm using is directly from the Devise page
I'm pretty sure that anything I am calling with…

Dave Olson
- 252
- 3
- 13
0
votes
2 answers
Devise strong parameter sanitizer
I am trying to customize my input params when using devise. To the best of my ability I have followed the devise doc on the subject. I have also googled extensively finding some helpful articles like this one. In the end however what happens when…

Kit
- 113
- 2
- 10
0
votes
2 answers
Form values not returning after failed validation in Rails 4
I'm using strong parameters in my User controller in my Rails 4 application.
def new
@user = User.new
end
def create
@user = User.new(user_params)
if !@user.save
render :new
end
end
private
def user_params
…

jmcharnes
- 707
- 12
- 23
0
votes
1 answer
How to update an attribute with a link in Rails4 w/ Strong Parameters?
I am wanting to be able to click a link and update an attribute is_public in rails4 with strong parameters. Here is my current code:
<%= link_to "make private", property_url(@property,is_public: !@property.is_public), method: "patch"…

Robbie Guilfoyle
- 3,363
- 1
- 18
- 18
0
votes
1 answer
Rails 4 form with namespace generates undesired params
I have this on my form
= simple_form_for polymorphic_path([:admin, @place]), :url => admin_places_path(@place), :method => 'post' ...
Parameters: {"utf8"=>"✓","authenticity_token"=>"UzvU072fWHiuSDD0BsIEaLqmIKJWujiFzWval8MripU=",…

Cassio Cabral
- 2,652
- 3
- 23
- 37
0
votes
0 answers
Why are these strong parameters returning a "param not found" error
I have two models, a profile model and a job model. A profile has_many jobs and a job belongs_to a profile. I am using the cacoon gem in order to create nested forms. In my application, someone creates a profile, and then they can add jobs. So,…

Philip7899
- 4,599
- 4
- 55
- 114
0
votes
0 answers
Lack of Attributes in Rails + RSpec
I'm attempting to write out some unit tests for my Rails application using RSpec. I'm using Rails 4.0.0 and Rspec-Rails 2.14.6. My User model:
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable,…

jackyalcine
- 469
- 1
- 8
- 21
0
votes
2 answers
Strong parameters not saved in the database
Rails novice Ques.I'm not able to find the reason for why my strong parameters are not getting saved in the database. I'm not using scaffolding to create my models rather using the rails g model customer name:string email:string command. The same…

user2526795
- 77
- 1
- 8
0
votes
0 answers
Rails 4 strong params prevents from saving
I'm just banging my head on the wall because of Rails 4 strong parameters.
Basically, I have a very simple model:
class Band < ActiveRecord::Base
validates_presence_of :name
has_many :users
has_many :donations
attr_accessible :name #I'm…

e4r
- 39
- 3
0
votes
2 answers
Rails 4, not saving @user.save when registering new user
When I try to register an user, it does not give me any error but just cannot save the user.
I don't have attr_accessible. I'm not sure what I am missing. Please help me.
user.rb
class User < ActiveRecord::Base
has_secure_password
validates…

YHDEV
- 477
- 8
- 22
0
votes
1 answer
Ruby on Rails 4.0 Linux - StrongParameters sets parameters to nil before returning - I think
Currently, StrongParameters is serving up and error due to the fact that :password and :password_confirmation are not permitted and I believe that's correct because I think I'm only supposed to have the values I want to write to the DB get a…

Dylan
- 563
- 4
- 15
0
votes
1 answer
How to whitelist dynamic hstore keys in a nested model
I have these relationships:
class Applicant < ActiveRecord::Base
has_many :answers
accepts_nested_attributes_for :answers
end
class Answer < ActiveRecord::Base
belongs_to :applicant
end
The answer model has an hstore attribute called…

ricsrock
- 951
- 9
- 13
0
votes
1 answer
Unable to edit multiple paperclip images in 1 form with Rails 4
I'm trying to upload multiple images with paperclip through 1 form, but I'm getting a Unpermitted parameters error.
This is my code:
Model:
class Recentjacket < ActiveRecord::Base
has_attached_file :jacketimage, :styles => { :medium =>…

Koop Otten
- 429
- 3
- 12