my first emI think for a non-experienced Rubyist it's unusual to open up
a class post-definition, much less to pogrammatically extend it from
another gem - which is where the whole confusion came from. Your example,
while absolutely correct, didn't seem to answer TheR's question, it just
needed to say `User.extend BasicUser`.ail in this thread shows the module
solution ....
But it doesn't solve chicken egg problem ;-) In your example you define
extension class before it has to be included in basic class.
I wanted basic class to be fully defined and then extended sometime in
future without touching source code.
I think for a non-experienced Rubyist it's unusual to open up a class
post-definition, much less to pogrammatically extend it from another gem -
which is where the whole confusion came from. Your example, while
absolutely correct, didn't seem to answer TheR's question, it just needed
to say `User.extend BasicUser`.
And now comes funny part. I didn't even know that extend exists in ruby
syntax and that it almost just does what I wanted. What I have written was
just a humble suggestion. Problem is in details. Extend can only extend
module not class. So this example throws error: wrong argument type Class
(expected Module)
class UserForForum # or module
extend User
field :signature, type: String
belongs_to :visit
embeds_many :roles
end
Can you please make a suggestion.
by
TheR