ea8e9901f4
Your branch is behind 'origin/strong-params' by 1 commit, and can be fast-forwarded. I'll pull to catch up after this commit Change code to whitelist params Remove attr_accessible lines Add strong_params to Gemfile, since this branch is still on Rails 3 Mixin to ActiveRecord::Base ActiveModel::ForbiddenAttributesProtection Use an initializer for the mixin
13 lines
290 B
Ruby
13 lines
290 B
Ruby
class Message < ActiveRecord::Base
|
|
belongs_to :user
|
|
validates_presence_of :creator_id, :receiver_id, :message
|
|
|
|
def creator_name
|
|
if creator = User.where(:user_id => self.creator_id).first
|
|
creator.full_name
|
|
else
|
|
"<b>Name unavailable</b>".html_safe
|
|
end
|
|
end
|
|
end
|