search for: attr_accessable

Displaying 20 results from an estimated 139 matches for "attr_accessable".

2011 Mar 07
3
difference between attr_accessor and attr_accessible?
Hi, What''s the difference between attr_accessor and attr_accessible? Is attr_accessor to create a virtual variable/object and attr_accessible makes it accessible? Do you need attr_accessible if you already have attr_accessor? Thanks! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2007 Jan 24
2
attr_accessor vs attr_accessible
Please guide me how to use those two methods. I can''t differentiate them. I was doing something on my model and I have put one field in the attr_accessible method. After that when I try to run the app the app always says my other fields are blank, but they''re all filled up. What''s wrong with it? Thanks --~--~---------~--~----~------------~-------~--~----~ You received
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
2006 Jan 12
9
Scaffold shows all attributes altough I use attr_accessible!
Hi all I have a Model like this: class Member < ActiveRecord::Base attr_accessible :username, :email, :first_name, :last_name end I have created a scaffold using script/generate scaffold member members Using the URL localhost:3000/members/edit/1 I can edit all attributes, including created_at, lock_version etc.! But it should only show the attributes I listed in attr_accessible! What
2005 Oct 14
1
Diff between attr_accessible and attr_accessor
I''m going though the paper back edition of agile development with Rails. On page #128 I encountered following lines of code: attr_accessor :password attr_accessible :name,:password What''s the difference between attr_accessor and attr_accessible? -=- Neeraj _______________________________________________ Rails mailing list
2007 Oct 16
12
Example for attr_accessible?
Is anyone out there writing specs to check attr_accessible fields? I had originally written my spec to check for allowing the desired fields, and then none of the other regular db fields. Unfortunately this isn''t satisfactory, because attr_protected could have been used instead, which of course wouldn''t prevent mass assignment to any whatever=(val) method. I''m thinking
2010 Nov 02
7
Testing attr_accessible (and/or attr_protected)
I''ve been puzzling over how to test that attr_accessible has been set for the correct columns; but the tests I''ve come up with so far seem to fail to fail when I expect. I came across this old message from this list: http://www.mail-archive.com/rspec-users at rubyforge.org/msg01570.html Which seemed like a plausible example, but my attempt (modeled on the example)
2009 Nov 27
2
attr_accessible & attr_accessor - what's the difference?
i''m still new to rails and working on digesting everything i come across. recently i came across these two. what is the difference between attr_accessor and attr_accessible? -- 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
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>
2009 Nov 22
2
WARNING: Can't mass-assign these protected attributes: active
Hi, I''m trying to understand this error: WARNING: Can''t mass-assign these protected attributes: active I had this error before when creating a record.I did not mark the attibutes posted from the form as attr_accessible, so when the following line tries to execute it throwed an Warning in the log, and the record was not saved. @user = User.new(params[:user]) I find out that I
2008 Dec 28
0
:attr_accessible to protect all attributes
Hi, I would like to protect all the attributes of one of my model. This ticket talks about this issue: http://dev.rubyonrails.org/ticket/9631 , and a patch to the documentation was submitted: http://dev.rubyonrails.org/changeset/8032 , which actually states that defining :attr_accessible alone, means all attributes are protected. However when I look at the rails API page for attr_accessible, I
2012 Oct 11
4
what;s the right url in this case
Hello, I have this models class Berichten < ActiveRecord::Base attr_accessible :bericht, :user belongs_to :user belongs_to :Category end class User < ActiveRecord::Base attr_accessible :email, :name has_many :berichten end class Category < ActiveRecord::Base attr_accessible :id :name has_many :berichten end What I wonder is what the right url is when I want to place a
2011 May 20
3
How to handle non model data in form?
Hey, I got a form which looks like this: - form_for(@article, :html => {:multipart => true}, :url => articles_path) do |f| = errors_for(@article) .field = f.label :text %br = f.text_field :text .field = f.label :author_id %br = f.text_field :author_id .actions = f.submit But since I don''t want anyone to type in an author id I changed it
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 May 16
1
ActionMailer w/o database link (e.g., feedback form)
Hey, A total noobieQ. Apologies, still learning. Could anyone point me to examples of a non-database-driven feedback form, for instance, a simple e-mail feedback form that takes advantage of ActionMailer? (How do I carry a POST through to a ''def'' w/o a database connection?) Thanks! -- Posted via http://www.ruby-forum.com/.
2008 Aug 31
0
attr_accessible & site administrator issue
I''m working on an app which has a :featured_at in Users and Groups tables. The attribute enables a site admin to set records to a :featured_at datetime. There''s named spaced admin controllers for the Users and Groups. The problem is, to set the :featured_at in the admin controllers for users and groups, the attribute had to be exposed under attr_accessible in User.rb and
2009 Jun 21
1
cannot do mass_assignment when inherited class ?
I got the following error when trying to create the elibrary instance (rdb:21) @elibrary = Elibrary.new(params[:elibrary]) RuntimeError Exception: Declare either attr_protected or attr_accessible for Elibrary, but not both. params : "elibrary"=>{"title"=>"bingo three", "short_description"=>"something new",
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
2010 Jan 21
2
nested forms and attr_accessable
Rails 2.3.5 I am working on a nested form that assigns roles to users through a table called clearances. I have attr_acessable turned off globally in an initializer: ActiveRecord::Base.send(:attr_accessible, nil) I have this set in clearance.rb attr_accessible(:description, :effective_from, :role_id, :superceded_after, :user_id) And this is what params looks like after the
2012 May 04
3
Database schema question
Im setting up a very basic rails app and have a question about the needed migrations & associations. Basically, my app is an occasion reminder service that emails users when occasions that they select or input are coming up. Occasions will be selected from a checkbox type list or alternatively manually input by the user (name and date of the occasion). Users can have_many occassions.