Displaying 20 results from an estimated 30000 matches similar to: "attr_accessible & site administrator issue"
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
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:
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
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
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
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)
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
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 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
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
2011 Jun 11
1
Having a problem adding a foreign key
I keep getting this exception "SQLite3::SQLException: no such
column: books.user_id: SELECT "books".* FROM "books" WHERE
("books".user_id = 4)" ,which sounds like there is no user_id in books
table.So i just installed foreigner plugin and added "
t.integer :user_id, :null => false" and
"add_foreign_key(:books, :users)" in book
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 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
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
2010 May 25
2
Site Navigation With Polymorphic Has Many Through
Hi, seem to keep running into a wall here. I can''t find any resources on
site navigation that can deal with any model being in the nav, allow
nesting, and can dynamically update.
So I thought about it for a while, and decided on a MenuItems class, which
contained the position of the child in relation to it''s siblings, where the
parent and the child were polymorphic. Then a given
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,
2017 Dec 30
0
10 Minute Time Window Aggregate By Multiple Grouping Variables
Hello All,
I have 1M rows of time stamped information about delivery trucks and their
trip related information from simulation .Detailed info the column names
and attributes for clarity
1. id: alphanumeric factor/character
2. datetime.of.trip.start: POSIXct yyyy-mm-dd hh:mm:ss
3. datetime.of.trip.end: POSIXct yyyy-mm-dd hh:mm:ss
4. trip.distance: numeric, miles
5.
2008 Oct 01
10
Recaptcha (or other captchas)
Does anyone have any suggestions for a best practice implementation of
Recaptcha (or other captchas - if you recommend going another route, I''m
all ears)? I''ve found the recaptcha gem and a plugin but I don''t know
which is the best implementation, and I haven''t found a thorough
tutorial plus example code for either.
Thanks
--
Posted via
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",