User.rb

Ruby code posted by Farts God
created at 24 Jul 16:24

Edit | Back
1
2
3
4
5
6
7
8
class User < ActiveRecord::Base
  # @param [#favorited_by?] object
  # @return [Boolean] True if the user currently has the object favorited
  def favorited? object
    return unless object.respond_to? :favorited_by?
    object.favorited_by? self
  end
end
263 Bytes in 2 ms with coderay