Guess what ... solved in Rails 3.0.3 :-) On Nov 20, 2:12 am, turkan <kai.schl...@googlemail.com> wrote: > Think of the following models: > > class User < ActiveRecord::Base > has_many :created_entities, :class_name => "Entity", :foreign_key => > "created_by" > end > > class Entity < ActiveRecord::Base > belongs_to :created_by, :class_name => "User", :foreign_key => > "created_by" > end > > There is also a created_by integer field in the Entity migration. > Everything seems to work fine with these model (fetching the > association and so on), but when I try to serialize > Entity.to_xml :include => :created_by (or include something other the > model has as association) it fails (NoMethodError: undefined method > `macro' for nil:NilClass). > For full trace > see:http://stackoverflow.com/questions/4217923/nomethoderror-when-seriali... > > But as soon as I rename the association in the Entity model to: > belongs_to :creator, :class_name => "User", :foreign_key => > "created_by" > the serialization to_xml start to work again. > > Im using Rails 3.0.1. Can someone reproduce that?
-- 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 rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.