Sha256: 31eb5d177d8a2ff1f53514f7c8f574fb53d50a38a0a301d2371ee5d61e36b76d

Contents?: true

Size: 593 Bytes

Versions: 8

Compression:

Stored size: 593 Bytes

Contents

class FamilyGallery::UserTagging < ActiveRecord::Base
  belongs_to :picture
  belongs_to :tagged_by, class_name: "User"
  belongs_to :user

  validates_presence_of :picture, :user, :tagged_by, :position_left, :position_top
  validates_uniqueness_of :user, scope: :picture

  scope :ordered, -> { joins(:user).order("family_gallery_users.first_name, family_gallery_users.last_name, family_gallery_users.email") }

  def left_for_width(width)
    return (width * (position_left.to_f / 100)).to_i
  end

  def top_for_height(height)
    return (height * (position_top.to_f / 100)).to_i
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
family_gallery-0.0.8 app/models/family_gallery/user_tagging.rb
family_gallery-0.0.7 app/models/family_gallery/user_tagging.rb
family_gallery-0.0.6 app/models/family_gallery/user_tagging.rb
family_gallery-0.0.5 app/models/family_gallery/user_tagging.rb
family_gallery-0.0.4 app/models/family_gallery/user_tagging.rb
family_gallery-0.0.3 app/models/family_gallery/user_tagging.rb
family_gallery-0.0.2 app/models/family_gallery/user_tagging.rb
family_gallery-0.0.1 app/models/family_gallery/user_tagging.rb