in the following code I am running into an error which states syntax error, unexpected '\n', expecting :: or '[' or '.' (SyntaxError)
But I don't see where the issue is.
module Xaaron
class ApiKey.class_eval # It does not like this....
include Promiscuous::Publisher
publish :xaaron_users_id, :api_key, :as => :ApiKey
end
end
Am I using class_eval
wrong?
You can either remove the
class
keyword, and adddo
after callingclass_eval
(passing it a block):(given that
ApiKey
already exists)OR you can remove the
class_eval
altogether:This will work even if the
ApiKey
already exists... that's just the way ruby works...