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
3 answers
Rails 4: issues with strong parameters and passing data
Good day, community.
First of all, I'm a newbie in Rails. I did some thing with it in College 4 years ago, and now I decided to get back on it. Lots of things changed in version 4.
Anyway, I am experiencing issues with strong parameters. Here's what…

Midnight Coder
- 721
- 1
- 8
- 20
0
votes
4 answers
How does params[:id] not throw an exception even if we do not explicitly whitelist :id?
In rails 4.x, strong_parameters require parameters to be explicitly permitted. Yet, in the following example, I do NOT get a ForbiddenAttributesError - why does :id not throw when in the show action even though it is not explicitly permitted?
def…

Anand
- 3,690
- 4
- 33
- 64
0
votes
2 answers
Validating parameters to create a class, parameters created in the controller arn't being added.
I create a class that takes two input parameters from the user, these input parameters are then used to create five others, the problem is that the five others don't show up when I check my validated paramaters only the first ones.
I know that all…

NNNNNNNNNNDelicious
- 933
- 3
- 7
- 19
0
votes
2 answers
Rails 4 Strong Parameters access attribute
For rails 4 Strong Parameters I need to access two of the fields. How can I do that?
def branch_params
params.require(:branch).permit( :equal_number, :equal_main_branch_number,
:history, :inquiry_email,…

T0ny lombardi
- 1,800
- 2
- 18
- 35
0
votes
1 answer
What parameters does Rails expect for editing nested models?
Problem
After some success creating nested models from a form in Rails 4 (with the help of the Cocoon gem), I am now trying to stretch a little further - to editing those nested models after they've been created.
When I attempt to update for a…

simple
- 100
- 9
0
votes
0 answers
TypeError: can't cast Array to json strong parameters
I have a rails 4 app with strong parameters like:
def product_params
params.require(:product).permit(:title, :user_id, :info => [:color, :size])
end
But I'm getting the following error:
INSERT INTO "products" ("created_at", "info","title",…

the_
- 1,183
- 2
- 30
- 61
0
votes
0 answers
rails: form not showing checkboxes (not able to parse them?)
Rails 3.2.12
using strong parameters gem.
I have a form, with checkboxes, after I create. I go to edit, all data is shown Except the checkboxes- which are empty, even though I selected some when created.
The checkboxes data did save in data base-…

Roko
- 1,233
- 1
- 11
- 22
0
votes
1 answer
Rails 4 Add Parameters to New Record Creation
I am having trouble getting a parameter to show up as an additional param when I create a new item.
Conceptually I have 3 models, Tickets, Issues and a join table IssueTickets.
Tickets have many issues through IssueTickets
Issues have many…

Austio
- 5,939
- 20
- 34
0
votes
1 answer
AWS credentials aren't working with Paperclip image upload in Rails 4 and mongoid
I'm receiving the following error:
The AWS Access Key Id you provided does not exist in our records.
I'm not sure why I would be getting this error because I have the correct access key and secret key shown to me in my aws security credentials page…

Jake Smith
- 2,332
- 1
- 30
- 68
0
votes
3 answers
Rails 4 validation attr_acessible error
I'm following Micheal Hartl's Ruby on Rails Tutorial Book.I'm testing validation for the presence of name and email in the sample_app.In rails console, I'm running
user = User.new(:email => "user@example.com")
to test an absent name value but I'm…

yaboiduke
- 652
- 7
- 20
0
votes
1 answer
ActiveModel::ForbiddenAttributesError Ruby On Rails
I created a project in Ruby On rails and I have controller user like this:
class UsersController < ApplicationController
before_action :set_user, only: [:edit, :update]
def new
@user = User.new
end
def create
@user =…

henio180
- 156
- 1
- 8
0
votes
3 answers
Rails 4 strong params - Undefined method name on model
I recently converted to Rails 4 and strong params, and I'm having a hard time figuring this out.
My model looks like so:
class Message
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
validates…

Luigi
- 5,443
- 15
- 54
- 108
0
votes
1 answer
Nested form with simple_form and strong parameters
A nested has_many association with simple_form returns the following params hash:
params
# => {
"user"=>{
"first_name"=>"John",
"last_name"=>"Doe",
"bank_accounts_attributes"=>{
"-1"=>{
…

svoop
- 3,318
- 1
- 23
- 41
0
votes
1 answer
ActiveModel::ForbiddenAttributesError - Simple blog and rails 4
I am trying to learn the new changes in rails 4 so started with a blog . Ran a scaffold with a title and body , everything went well until i clicked on save and i was greeted with the error ActiveModel::ForbiddenAttributesError . I know i need to…

Caffeine Coder
- 1,869
- 1
- 17
- 35
0
votes
2 answers
Rails: passing params hash to model
I have a user-to-user messaging system. I'm trying to pass an array of user ids to a ConversationUser (join table) model which would then create multiple conversation_users from each individual user.id. The two fields in ConversationUser are…

user3181113
- 758
- 2
- 11
- 23