Adding this code
def send_messages
return if recipient_list.blank?
recipient_list.each do |recipient|
recipient = User.find(recipient)
messages.build(user_id: recipient.id, conversation_id: self.id)
end
to my model
class Conversation < ActiveRecord::Base
attr_accessible :recipient_list
after_create :send_messages
has_many :messages
end
causes any reference to my model to throw a
syntax error, unexpected $end, expecting keyword_end
from the model… without it my model works perfectly fine. Is there something wrong with this code?
You are missing an end to close the do block: