Module: ActiveRecord::Acts::Readable::InstanceMethods

Defined in:
lib/acts-as-readable.rb

Instance Method Summary collapse

Instance Method Details

#read_by!(user) ⇒ Object



29
30
31
# File 'lib/acts-as-readable.rb', line 29

def read_by!(user)
  readings << Reading.new(:user_id => user.id)
end

#read_by?(user) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/acts-as-readable.rb', line 37

def read_by?(user)
  !!users_who_read.find(:first, :conditions => ["user_id = ?",user.id])
end

#unread_by!(user) ⇒ Object



33
34
35
# File 'lib/acts-as-readable.rb', line 33

def unread_by!(user)
  readings.find(:first, :conditions => ["user_id = ?",user.id])
end