Vote count:
0
I've got a message class that you can send to a user. Until recently, it could only be sent to a single user, but not the requirement is to send to multiple users. I decided to wrap message in a MessageProxy (really a Decorator, but that word was already taken by Draper).
class MessageProxy
def initialize(args = {})
@message = Message.new(args)
end
def method_missing(method_sym, *arguments, &block)
@message.send(method_sym, *arguments, &block)
end
end
class Message < ActiveRecord::Base
belongs_to :priority_type
end
I tried to use the message proxy in a form, but I get Association :priority_type not found.
Why isn't my proxy forwarding the association methods to the message object?
asked 25 secs ago
SimpleForm for Proxy Object can't find associations
Aucun commentaire:
Enregistrer un commentaire