Created
May 14, 2012 16:10
-
-
Save agibralter/2694791 to your computer and use it in GitHub Desktop.
has_one through does not provide `create_child` method?
This file contains 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 < ActiveRecord::Base | |
has_one :image_assignment, as: :imageable | |
has_one :image, through: :image_assignment | |
end | |
class ImageAssignment < ActiveRecord::Base | |
belongs_to :image | |
belongs_to :imageable, polymorphic: true | |
end | |
class Image < ActiveRecord::Base | |
mount_uploader :image, ImageUploader | |
end | |
u = User.new | |
u.create_image #=> undefined method `create_image' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment