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
classkeyword, and adddoafter callingclass_eval(passing it a block):(given that
ApiKeyalready exists)OR you can remove the
class_evalaltogether:This will work even if the
ApiKeyalready exists... that's just the way ruby works...