Class: Chatty::Message

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/chatty/message.rb

Instance Method Summary collapse

Instance Method Details

#jsonObject



8
9
10
11
12
13
14
15
16
# File 'app/models/chatty/message.rb', line 8

def json
  return {
    :id => id,
    :message => message,
    :user_id => user.id,
    :user_name => (user[:name].presence || user[:email].presence || user.id),
    :created_at => created_at.strftime("%Y-%m-%d %H:%M:%S")
  }
end