attr-accessor

Understanding Ruby on Rails ActiveRecord model Accessors

Hey there, I'm currently learning RoR and I've got the following problem: My Model, "DataFile", has a bunch of fields which I'd like to set from outside the Model, e.g. file = DataFile.new file.owner = 123 Now, as far as I know, I'd have to place an "attr_accessor :field" in my model, for every field that I'd like to modify from ou...

Ruby on Rails: attr_accessor for submodels

I'm working with some models where a lot of a given model's key attributes are actually stored in a submodel. Example: class WikiArticle has_many :revisions has_one :current_revision, :class_name => "Revision", :order => "created_at DESC" end class Revision has_one :wiki_article end The Revision class has a ton of database fiel...

Ruby on rails: virtual method that modifiyng model attributes with help of << couldn't save that attribute

There is model Ratification with attribute comment (of type text) def Ratification < ActiveRecord::Base attr_accessor :add_comment def add_comment=(text) self.comment ||= "" self.comment << "\r\n" + text end end And if I use add_comment= it is ok before I save the object. After save comment changes was dropped. >> r = R...

model missing required attr_accessor for 'photo_file_name' when uploading with paperclip and S3 on heroku

Setting up paperclip with S3 in my linux dev environment was a snap -- everything works out of the box. However, I can't get it to work on Heroku. When I try to do an upload, the log shows: Processing ItemsController#create (for 72.177.97.9 at 2010-08-26 16:35:14) [POST] Parameters: {"commit"=>"Create", "authenticity_token"=>"0Hy3...