Created
June 3, 2010 15:35
-
-
Save anlek/424028 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
u = User.new | |
u.images | |
NoMethodError: undefined method `images' for #<User:0x3666c98> | |
from /usr/local/lib/ruby/gems/1.8/gems/mongo_mapper-0.7.6/lib/mongo_mapper/plugins/dirty.rb:25:in `method_missing' | |
from (irb):9 | |
u.user_images | |
=> [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User | |
include MongoMapper::Document | |
many :user_images, :as => :images | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserImage | |
include MongoMapper::EmbeddedDocument | |
key :source_file_name, String | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For anyone who comes across this, the line:
many :user_images, :as => :images
should be:
many :images, :class_name => "UserImage"