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 ActiveModel::ForbiddenAttributesError Editing multiple records

I followed Railscast Episode 165 (revised) to the tee on how to edit and Update multiple records in one form. But when I submit my form to edit multiple records at the same time, I get: ActiveModel::ForbiddenAttributesError For this…
Devin
  • 1,011
  • 2
  • 14
  • 30
0
votes
0 answers

form_for error for edit action

galleries_controller.rb def create @gallery = Gallery.new(gallery_params) if @gallery.save redirect_to @gallery, notice: 'Gallery was successfully created' else render 'new' end end def update …
0
votes
1 answer

param is missing or the value is empty: new_vid

As a noob, I have done this a few times, but I always struggle with the strong params. I rolled a new model and controller for uploading a link to a video. Here is my code: new_vids_controller.rb class NewVidsController < ApplicationController …
Wasik
  • 35
  • 1
  • 5
0
votes
2 answers

Rails 4 strong parameters for instance variable

Im using Rails 4.1.6 and Ruby 2.1.3 bookmarks_controller.rb class BookmarksController < ApplicationController def index @bookmarks = ListBookmarks.list render json: @bookmarks.to_json end def create …
junior
  • 808
  • 15
  • 25
0
votes
1 answer

How to use Strong_Parameters in Rails 4 with Mongoid, if it throws Unpermitted parameters: (model_name) error on nested attributes

I am trying to use embedded relationship in MongoDB by using Mongoid with Rails 4.1.6. I have embedded an array of location data in my user model, as I will be adding user's location after every 5 minutes of interval. This issue is: I can add data…
0
votes
2 answers

How to parse param comma separated string ids to has_many mongoid field

How to handle tag_ids in post params to save it in related model? I would like to use for it only post_params method. has_many :tags def post_params params.require(:post).permit(:title, :message, :tag_ids) end #Parameters:…
luzny
  • 2,380
  • 7
  • 30
  • 64
0
votes
1 answer

How rails interprets params hash, strict parameters

At first, when I was creating posts, the user id was nil. Originally my post_params were just :content & :category. It wasn't until I added :user_id that I was finally able to get post.user.first_name to work properly.(first_name is a User column) I…
0
votes
1 answer

accept data from checkboxes in nested_form and create records using the data from checkboxes

I have got a Products class,Products are visible to zero or many roles . so i have created a polymorphic model called content_roles,which stores the id of the role and content_id (which will be product_id,or event_id),and content_type(product,event…
level0
  • 323
  • 1
  • 3
  • 13
0
votes
1 answer

Rails: param is missing or the value is empty. strong parameters in controller

i have this controller class StoresController < ApplicationController before_filter :authenticate_business!, :except => [:index, :show] def index #@stores = Store.paginate(:page => params[:page])#, :per_page => 8) if…
0
votes
2 answers

Understanding of Rails 4's strong parameters

I'm totally new to Rails and I'm playing with it. Now I'm trying to understand the strong parameter feature introduced in Rails 4. Below is my code: class PostsController < ApplicationController def index end def show end def create …
Just a learner
  • 26,690
  • 50
  • 155
  • 234
0
votes
1 answer

How to create a model without controller considering rails4 strong parameters

Cannot find anywhere the accepted way to create a model without going through controller considering that attr_accissible is no longer supported. Is the below approach correct? in my old code: ModelName.create(course_id:680, user_id:25) (raises…
ryan2johnson9
  • 724
  • 6
  • 21
0
votes
1 answer

Getting Started with Rails official Tutorial, ForbiddenAttributesError

I have followed the tutorial letter for letter and I am still getting a forbidden attributes error. I have rails 4.1.4 and ruby 2.1.2. here are my controller methods for a new article def create @article = Article.new(params[:article]) if…
SeanIvins
  • 39
  • 6
0
votes
1 answer

Omniauth and strong parameters

So this is probably going to be a very dumb question but i've set up Oauth with twitter as the provider in a similar way to Ryan Bates's 'Simple Omniauth Railscast - my question is now that that is set up and working should i be setting strong…
Robbo
  • 1,292
  • 2
  • 18
  • 41
0
votes
1 answer

rails parameters either blank or wrong

I tried everything but cannot make heads or tails of this ruby on rails in ´def new´ methode. def edge_params params.require(:edge).permit(:kind, :start_id, :end_id, :property1) end This way the parameters end up at the ´Edge.save(edge_params)´…
samst
  • 536
  • 7
  • 19
0
votes
1 answer

How do I permit! with strong parameters in rails 4?

I am having issues permitting all on one of the sub-hashes. How could I do this in strong_params in Rails 4? params.require(:checkout_item).permit(:checkout_group_transaction_id, :item_type, :property_id, …
Kamilski81
  • 14,409
  • 33
  • 108
  • 161