Questions tagged [strong-parameters]

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.

956 questions
0
votes
1 answer

Rails upgradation from 3.2.x to 4.0.3 with Ruby 2

models/user.rb class User < ActiveRecord::Base attr_accessible :email, :password, :password_confirmation, :remember_me, :username, :login end models/post.rb class Post < ActiveRecord::Base has_many :comments, dependent: :destroy belongs_to…
user3067558
  • 93
  • 1
  • 8
0
votes
0 answers

Strong params working diffently on production than on development mode

I have an issue with my environments. While I'm on development mode and try to use params.require(:symbol) throws an error: TypeError (no implicit conversion of Symbol into String): but not in production environment. I have been looking into web for…
0
votes
2 answers

Can't permit nested param in Rails 4

I've been ripping my hair off with this one. I have read all the doc about Rails 4 integrating strong params and that now everything has to be explicitly whitelisted. But it still won't go through!!! Here is my setup Models class Course <…
0
votes
2 answers

Rails 4 Nested Route with Strong Parameters

I'm new to Rails and the recent switch to the Rails 4 strong parameters has confused me even more. I'm trying to set up an account confirmation link for people to click. I have the following route set up: rake routes Prefix Verb URI Pattern …
Mike T
  • 4,747
  • 4
  • 32
  • 52
0
votes
2 answers

Rails 4: How to pass nested attributes with strong parameters into a model

I've got two nested resources I'm working with here. Stashes & Receivers. routes.rb resources :stashes do resources :receivers end I have a form where I'd like to create both a Stash and a Receiver once it's submitted. <%= form_for(@stash) do…
0
votes
1 answer

Confused about strong parameters with Devise

I have the following Devise registration form (with irrelevant markup omitted): <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { id: "payment-form" }) do |f| %> <%= f.fields_for resource.paid_account do |pa|…
Jason Swett
  • 43,526
  • 67
  • 220
  • 351
0
votes
1 answer

Rails4: Optional parameters in model

I have a Rails4 model (my_model) which may or may not have an attribute. I don't want to save the attribute on my db after I call: my_model.save or my_model.create but I would like to have access to the value of this possible attribute (or nil if…
user601836
  • 3,215
  • 4
  • 38
  • 48
0
votes
1 answer

has_many :through association - can't save record with a foreign id during create action

I have a Rails 4 application and am having problems creating a new record for a has_many :through association. A couple of observations that I made while debugging: Commenting out the checkboxes associated with the Features model, the application…
Vee
  • 1,821
  • 3
  • 36
  • 60
0
votes
1 answer

Strong Params issue at new

I have ActiveModel::ForbiddenAttributesError when I press create in my form. In my controller: def create @topic = Topic.new(topic_params) if @topic.save redirect_to topics_path, notice: 'Topic was successfully created.' …
Mr H
  • 5,254
  • 3
  • 38
  • 43
0
votes
2 answers

Devise and StrongParams - undefined method permit for nil:NilClass

I current use Rails 4 and I move the app from attr_accessible to the StrongParams. So, I have customised Devise controller: class UsersController < Devise::RegistrationsController load_and_authorize_resource #... def update unless…
ExiRe
  • 4,727
  • 7
  • 47
  • 92
0
votes
1 answer

Rails 4 not passing permitted parameters

Apologies for posting what seems to be an oft-asked question but I have toiled for two days without getting closer. I am running Rails 4.0.1 (with Devise, CanCan, among others) and have user and role models with a HABTM users_roles table (as created…
RubyNewby
  • 11
  • 2
0
votes
1 answer

Rails 4 validation error with has_many through association

I have troubles creating the records in an association with rails 4. It's basically an association between Entry and Author, with a join table in the middle called AuthorsEntry. The schema is the following: class Entry < ActiveRecord::Base …
Ingo86
  • 172
  • 6
0
votes
1 answer

Additional parameters added in Devise not allowing user registration

I'm currently running the following: Rails 4.0.2 Devise 3.2.2 I've added three attributes to my user sign up form and also permitted the parameters in Devise in my application controller per the Devise documentation. My problem now is that when I…
0
votes
3 answers

Devise allowing all attributes by default in Rails 4

I'm currently running the following: Rails 4.0.2 Devise 3.2.2 From the Devise documentation it states that Strong Parameters will block all but the following attributes by default - email, password, password_confirmation, current_password. I edited…
0
votes
1 answer

undefined method `model_name_question' for #..Rails 4

I am getting this error after submitting the form:(in the index page) <%= simple_form_for(@quiz, html: {class: 'form-vertical' }) do |f| %> <%= render 'shared/error_messages_question' %> <%= f.input_field :content, :rows =>…
ben
  • 6,000
  • 5
  • 35
  • 42