similar to: MassAssignmentSecurity for multiple contexts

Displaying 20 results from an estimated 3000 matches similar to: "MassAssignmentSecurity for multiple contexts"

2012 Apr 13
0
Scoped attr_accessible not working?
Please refer to the ActiveModel MassAssignmentSecurity api<http://api.rubyonrails.org/classes/ActiveModel/MassAssignmentSecurity/ClassMethods.html>for this. I''m on Rails3.2.3/Ruby1.9.3 and trying to use that technique in the controller as described. It is supposed to dynamically restrict the attributes that can be mass assigned. However, sanitize_for_mass_assignment is ignoring
2012 Apr 27
1
Can't mass-assign protected attributes even if I use attr_accessible
Hi, I''m working on a Rails 3.2.2 application which has JSON APIs and I use a CLI client for inserting some data. It works fine except for the Author model. When I try to create a new post (Post belongs_to :author and Author has_many :posts) I get the following error : <h1> ActiveModel::MassAssignmentSecurity::Error in PostsController#create </h1>
2011 Feb 03
5
Ignore attr_accessible in seed file
Is there a way to tell Rails to ignore attr_accessible when seeding the database and to allow mass assignment with create or new? I know how to skip validations but do not find anything on mass assignment... -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2013 Jan 12
1
showing posts in blog
When I make a new post in my blog, it returns this when I try to view my current posts: --------------------------------------------------------------------------- ActiveModel::MassAssignmentSecurity::Error in PostsController#create Can''t mass-assign protected attributes: text Rails.root: C:/Users/Josh Koloff/Desktop/Programming Stuff/Rails Stuff/blog Application Trace | Framework
2012 Jun 21
1
ActiveModel::Serializers::JSON support arbitrary keys
Is there a reason why AM:S doesn''t support arbitrary keys to serialization? I can see a lot of uses cases where arbitrary keys could come handy. Right now, if one tries to do it, AM:S checks if the keys match a method of the model and raises exception if it can''t find any. class Client < ActiveRecordBase attr_accessible :name, :address, as: :creator include
2010 Apr 09
0
[PATCH] add :root option to ActiveModel JSON serialization
This is a small, straightforward patch that I''d love to see merged: https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4358-patch-add-root-option-to-activemodel-json-serialization It''s all pretty self-explanatory, it basically just ports a useful option from to_xml to to_json, making their interfaces more compatible with each other. Feedback would be greatly
2010 Apr 05
2
Harmonizing JSON/XML serialization
The way Rails handles root nodes in JSON and XML serialization is inconsistent. This has been discussed before: https://rails.lighthouseapp.com/projects/8994/tickets/2584-232-activeresource-json-doesnt-send-parameters-with-root-node This seems mostly taken care of with ActiveModel::Base.include_root_in_json, especially if/when it ends up in ActiveResource. However, there is also the issue of how
2011 Nov 07
2
Problem with Rails3.1.1 in mass_assignment_authorizer
By accident I had Rails-3.1.1 installed by bundler. However, when I discovered this mishap during my feature run I encountered this error in many places: wrong number of arguments (1 for 0) (ArgumentError) /home/byrnejb/.rvm/gems/ruby-1.8.7-p352/gems/activemodel-3.1.1/ lib/active_model/mass_assignment_security.rb:209:in `mass_assignment_authorizer''
2013 Jul 21
4
how to use activemodel collection.build for a has_many :through association
Hi all, In my controller I am doing the following to populate a nested form for a has_many through association: def new @specification = Specification.new Component.find_each.each do |component| @specification.component_specifications.build(:component_id => component.id) end The idea being whenever someone creates or edits a form, it will be populated with all
2011 Jan 02
0
"Confirmation" succeeds when the *_confirmation attribute was neglected from the Model.
<pre> models/user.rb: # Oops! I forgot to add the :password_confirmation attribute! class User < ActiveRecord::Base attr_accessor :password attr_accessible :password #, :password_confirmation validates(:password, :confirmation => true, :presence => true) end activemodel/lib/active_model/validations/confirmation.rb: 3 # == Active Model
2012 Jul 21
0
undefined method `scope' for non ActiveRecord class
I am trying to use the geocoding capabilities into a table less model , but the method :scope is not defined .. is there a way to include it ? class SearchLocation require ''geocoder'' include ActiveModel::Validations include ActiveModel::Conversion extend ActiveModel::Naming extend Geocoder::Model::ActiveRecord # extending the class w geocoding capaibilities ( from
2012 Jul 09
10
attr_accessible on some properties + attr_protected on others makes class 'open-by-default'
(I posted this as a bug in GitHub (https://github.com/rails/rails/issues/7018), but then someone there told me I should post it here, so here it is.) If you set attr_accessible on some properties in an ActiveRecord-descended class, and then attr_protected on others - the class becomes ''default-open'' - if any properties are missed or added later, they will be accessible by
2011 Apr 27
2
Can not create model instance via params on specific model but can on others....
Anyone have an idea on this? Got a weird situation where on a specific model I can not create an instance using params, yet it works fine on other models. The model which does not work is a stock model, there is no logic in it. Ruby 1.8.7/Rails 3.0.5. Does not work: (rdb:1) PaymentTransaction.create(:purchase_id => 3) #<PaymentTransaction id: 2, purchase_id: nil, action: nil, amount: nil,
2011 Feb 05
3
ActiveModel::AttributeMethods limiting
In my attempt to add AM:Dirty to my model I realized that AM#AttributeMethods is a bit imperfect. It''s impossible to generate attribute methods step-by-step in DataMapper-like manner. class Model include ActiveModel::Dirty def self.property(name, klass = String) define_property_accessors(name, klass) # This method will be called once, because of
2006 Jul 12
5
2 subdirectories 1 controller?
Hi, I''d like to create the following setup with RoR: www.mywebsite.com/subdir1/order/create www.mywebsite.com/subdir2/order/create I''d like both urls to call the same action in the same controller. How can I do this? I know this may be complicated, but I''m prepared to go a long way. Shimon -------------- next part -------------- An HTML attachment was scrubbed...
2012 Feb 16
0
Upgrading from 3.2.0 to 3.2.1: Wrong Number of Arguments
Simple spec passes in 3.2.0: it "destroys an album" do 3.times { Factory(:album, photo_library: @photo_library) } visit photo_library_path(@photo_library) find("h3").click_link ''Delete'' find("#notice").should have_content("Album deleted successfully") Album.count.should eq 2 end But fails in 3.2.1 with: 1) Albums destroys an
2010 Aug 13
2
Rails 3 / ActiveModel for Credit Card information?
When submitting billing information in the past I''ve always used attr_accessor for credit card details as they should not be saved in the database. In addition I always end up storing the card expiration date so that the date form helper works correctly. With Active Model it seems logical to create a CreditCard class to hold this data instead. **1st issue.** It seems there still
2013 Mar 04
2
accepts_nested_attributes: undefined method 'association'_attributes
I have 2 models Timesheet and TimeEntry: class Timesheet < ActiveRecord::Base attr_accessible :status, :user_id, :time_entries_attributes has_many :time_entries, dependent: :destroy accepts_nested_attributes_for :time_entries, :reject_if => proc { |attributes| attributes[''worktime''].blank? } end class TimeEntry < ActiveRecord::Base attr_accessible :task_id,
2006 Oct 29
1
ActiveRecordStore: Where is the session id generated?
Where can I find the algorithm that generates the session ids for the ActiveRecordStore (sql session)? Thanks, Shimon Amit --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To
2012 Aug 05
0
ActiveRecord::Validator vs ActiveModel::Validator
I know that there is an ActiveModel Validator class https://github.com/rails/rails/blob/master/activemodel/lib/active_model/validator.rb which is used for the class level validation macros. But I didn''t find a an ActiveRecord Validator class. From my understanding in Rails 3, validations have been moved into ActiveModel to leave ActiveRecord as an ORM. So now I see this Rails 3 code