Questions tagged [attr-accessible]

attr-accessible creates a white-list of editable attributes

attr-accessible is reference of Ruby on Rails new "attr_accessible" feature. It lets programmers define a white-list of attributes that can be modified by a user through its user interface.

104 questions
0
votes
1 answer

Rails nested form model creation fails silently using cocoon

I am using Mongoid 2.4.12 and Rails 3.2.8 with cocoon. My nested form appears to work flawlessly on the front end, but the nested model and relation are not being saved. Project include Mongoid::Document include Mongoid::Paranoia include…
0
votes
1 answer

Rails Attribute Not Showing / Saving as Blank

The attribute, balanced_card_uri, is saving as blank and not showing on this raise: https://img.skitch.com/20120916-fpmxabwg6m4ys3y84rkti615iq.jpg Here's the code from customer.rb: https://gist.github.com/ee0b27bebe14d88417d9 After first having…
0
votes
0 answers

Heroku db responding diff than my local db and flagging WARNING: Can't mass-assign protected attributes

I'm working on a Rails app and feeling stuck on this one after a few hours trying to get through it, would love some help. I'm running sqlite on my local server and Postgres on Heroku. I think this may be part of the problem. Basically, I run the…
siculo23
  • 13
  • 2
0
votes
1 answer

why am I getting a mass assignment error when my column is on my attr_accessible list

There are several related questions to this one. But none of the answers address my situation. I am getting this error on my localhost when trying to create a new policy. Can't mass-assign protected attributes: starts_on In my policy.rb model…
Ryan
  • 5,644
  • 3
  • 38
  • 66
0
votes
1 answer

How can I specifiy attr_accessible for a nested attributes?

From the docs, I see that if I have a model: User has_many Addresses that I can do this: class User < AR::Base attr_accessible :addresses_attributes accepts_nested_attributes_for :addresses end that I should be able to set those attributes…
RubyRedGrapefruit
  • 12,066
  • 16
  • 92
  • 193
0
votes
0 answers

Nested attribute doesn't show up attr_accessible

I have a nested attribute message.rb class Message < ActiveRecord::Base belongs_to :trip attr_accessible :name, :email, :subject, :body end Which belongs trip.rb class Trip < ActiveRecord::Base has_many :messages …
0
votes
2 answers

What things do I need to know when creating model from another controller and mass-assignment

I have a model called DefaultCompany that has no controller, instead I create it through the companies_controller which calls the user.set_default_company (defined below) if they check the "default company" checkbox on the form. Default company is a…
ruevaughn
  • 1,319
  • 1
  • 17
  • 48
0
votes
1 answer

Restrict attr_accessible to types of user with Ruby on Rails

I am creating a forum software. I want admins and mods to be able to close certain topics. Codes are sanitized to show only relevant info. Models class User < ActiveRecord::Base attr_accessible :name, :email, :password, :password_confirmation,…
Jason Kim
  • 18,102
  • 13
  • 66
  • 105
0
votes
1 answer

Rails attr_accessible only for seed.rb?

I'm teaching myself Rails through PragProg's (apparently outdated - I'm using Rails 3.2.3) Rails for PHP Developers. I've discovered this seeds.rb file that the book doesn't talk about. I've tried to build proper seed entries for a number of things…
Ben Saufley
  • 3,259
  • 5
  • 27
  • 42
0
votes
2 answers

If I put all my db columns in attr_accessible am I safe from a mass assignment attack?

I know that with Rails 3.2 all attributes are 'black-listed' in essence, that forces you to whitelist each attribute via attr_accessible. However, if I make every column in my table attr_accessible doesn't that leave me vulnerable to mass assignment…
marcamillion
  • 32,933
  • 55
  • 189
  • 380
0
votes
1 answer

Can't mass-assign protected attributes even if I use attr_accessible

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…
0
votes
1 answer

Devise invitable's destroy_if_previously_invited fails with no password provided

I'm having a problem on devise + devise_invitable + cancan configuration: if a User registers in a normal way without the invite, the final step of the job described here is not…
lyuba
  • 6,250
  • 7
  • 27
  • 37
-1
votes
2 answers

attr_accessible for Rails 4

Hello I need to use attr_accessible or something like that.And I am new on Ruby On Rails That is my post.rb file class Post < ActiveRecord::Base has_many :comments attr_accessible :body, :title, :published, :author, :author_id belongs_to…
-1
votes
1 answer

Mass assignment and roles in Rails

I have Users, Roles, and Network models in Rails 3. Users and Networks have a HMT relationship through Roles. If a User has an Role type of 'admin' with a specific Network, he/she can change the Role of other Users. It seems like the Role type…
dewyze
  • 979
  • 1
  • 7
  • 21
1 2 3 4 5 6
7