Displaying 1 result from an estimated 1 matches for "attachment_belongs_to".
2006 Nov 09
2
redefining the method belongs_to in ActiveRecord::Base
...ied to do an alias of belongs_to, but
this was not successful. The error message in Webrick was
> Booting WEBrick...
./script/../config/../lib/ActiveRecordExtensions.rb:67: undefined
method `belongs_to'' for module `ActiveRecord'' (NameError)
The code with problem is:
alias :attachment_belongs_to :belongs_to
def belongs_to(association_id, options={})
self.attachment_belongs_to(association_id,options)
if association_id == :attachment
code = <<EOS
alias :tmp_attach= :attachment=
def attachment=(content)
if content.class.name == ''Attachment'' #old...