-
-
Save workmad3/1373026 to your computer and use it in GitHub Desktop.
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 | |
include Mongoid::Document | |
field :email, :type => String | |
end |
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
require 'lib/test/test' | |
User.send :include, Test::User |
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
ree-1.8.7-2011.03 :005 > Card.new | |
=> #<Card _id: 4ec4f9ff31ef62a8ee000003> | |
ree-1.8.7-2011.03 :001 > u = User.new | |
=> #<User _id: 4ec4f9ea31ef62a8ee000001, email: nil> | |
ree-1.8.7-2011.03 :003 > u.cards | |
NoMethodError: undefined method `cards' for #<User:0x12d3170d0> |
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 Card | |
include Mongoid::Document | |
belongs_to :user | |
end |
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
module Test | |
module User | |
extend ActiveSupport::Concern | |
included do |base| | |
base.send(:has_many, :cards) | |
end | |
module ClassMethods | |
end | |
module InstanceMethods | |
end | |
end |
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
require 'lib/test/app/models/card' | |
require 'lib/test/exts/user' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment