QutBioacousticsResearchGroup/bioacoustic-workbench

View on GitHub
app/models/photo.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Photo < ActiveRecord::Base
  # relations
  belongs_to :imageable, :polymorphic => true

  # attr
  attr_accessible :copyright, :uri, :description, :imageable_type, :imageable_id

  # userstamp
  stampable
  belongs_to :user, class_name: 'User', foreign_key: :creator_id

  # validation
  # http://stackoverflow.com/questions/6778269/rails-3-polymorphic-liking-of-entities-by-user-how
  # http://stackoverflow.com/questions/746387/labels-for-radio-buttons-in-rails-form
  validates :uri, :presence => true
  validates_format_of :uri, :with => URI::regexp(%w(http https))
  validates :copyright, :presence => true
  
  
end