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
1
vote
2 answers

Rails: how to update data in migrations when we use attr_accessible?

We have a problem regarding a migration when we try to update some data contained in a table. Our base model looks like this: User username password … We created a first migration to add a column in the model and then update the existing…
1
vote
1 answer

Passing ID Value to a Controller, Getting Mass Assignment Security Error

I have a message model and a user model. my message belongs_to my user and user has_many messages. I'm trying to allow a user to private message another user while on their public profile page (their show template). I have tried a number of…
Sasha
  • 3,281
  • 7
  • 34
  • 52
1
vote
2 answers

Ruby on Rails Tutorial( by Hartl) when doing name = Faker::Name.name encoutner Can't mass-assign protected attributes error

UPDATE: I am running on Ruby 1.8. The link to the repository is github.com/lauherk/sample_app I am going through the Ruby on Rails Tutorial by Micheal hartl, and in chapter 9 I am encountering an issue with populating the db with sample users…
0
votes
1 answer

How can i get possible attr_accesible attributes in a view?

Since it is possible to define attr_accesible with a role attr_accessible :name, :as => :admin how can i get all attr_accesible attributes in a view for a specific role? With this information it would be possible to show a custom view…
tonymarschall
  • 3,862
  • 3
  • 29
  • 52
0
votes
2 answers

User model, attr_accessible and admin

I'm building a simple blog-style application. I really only need admin and non-admin users, so it seems like having a simple column in the user model called admin (boolean) will suffice. I'm using Devise for authorization right now, and I've got the…
DVG
  • 17,392
  • 7
  • 61
  • 88
0
votes
2 answers

Rails: automate creation of attr_accessible with the generator?

I almost always use attr_accessible in my Rails models. Is there a generator flag or other terminal command to haveattr_accessible and the model fields automatically inserted into the model file when I run a relevant generator?
Clay
  • 2,949
  • 3
  • 38
  • 54
0
votes
1 answer

attr_accessor not updating value from rails model

I have the following model class Job < ActiveRecord::Base attr_accessor :incentive end I want to be able to store a temporary column in my model via attr_accessor. I want to be able to do something like this job = Job.last job.incentive = {id:…
0
votes
1 answer

Toggling a non-attr_accessible variable

I am creating a Rails application that is a blogging platform, with many contributing writers. My User model has a :writer boolean attribute to indicate whether or not a particular user has permission to publish an article. In order to prevent…
ArcGhost
  • 137
  • 1
  • 3
  • 12
0
votes
1 answer

attr_accessible with paperclip multiple picture uploads

I followed the tutorial here and everything turned out nicely.. until I tried adding attr_accessible to the article model. Thanks in advance. Here's the related code: app/models/user.rb class User < ActiveRecord::Base attr_accessible :name,…
Mike
  • 439
  • 1
  • 6
  • 10
0
votes
2 answers

Conditional 'attr_accessible' using ActiveResource in Ruby on Rails

I have two RoR3 application: http://users.domain.local http://profiles.domain.local I created the 'users/models/profile.rb': class Profile < ActiveResource::Base self.site = "http://profiles.domain.local" end In 'profiles/models/profile.rb' I…
user502052
  • 14,803
  • 30
  • 109
  • 188
0
votes
3 answers

Rails 4: chaining associated objects in Views

Ok, I searched all over the web and found no answer. I am looking for a way to display a name of a 'category' in the show view of a post (I have to mention I'm rookie in Rails). I have.... a model "Post" class Post < ActiveRecord::Base has_many…
dvdt
  • 39
  • 7
0
votes
1 answer

attr_accessible error on rails 4.1.8 upon performing rake db:migrate on heroku

I am still learning Ruby (so I am a complete noob), right now I have my app successfully running locally but when trying to opening the apps on heroku , in which I first perform the heroku run rake db:migrate I stumbled upon a problem.. it tells me…
0
votes
2 answers

workaround for getting alt for a css image

I came to know that we cannot have an alt for a css generated image.There are solutions that say by having title atribute we can get the alt effect only on hovering on the image,however when we disable the css we will not able to see that text in…
user2345
  • 37
  • 8
0
votes
2 answers

accessible attribute for rating for all people

I am trying to add accessiblity attribute to my OverallRating stars... can you tell me what attribute should i need to add... I added arial label with value given to that attribute... but its not working... can you tell me what i need to…
user1365117
  • 19
  • 1
  • 9
0
votes
2 answers

undefined method `encrypted_latitude' for #

Hi I am using symmetric encryption (This one) gem to encrypt some fields. I have generated all the keys and followed all the steps given in it. But When I am trying to save data on my server it throws error on these lines attr_encrypted :latitude …