* more scopes for onboarding
This commit is contained in:
parent
da726a574b
commit
aec3d106fa
|
|
@ -10,6 +10,8 @@ ActiveAdmin.register JamRuby::JamTrack, :as => 'JamTracks' do
|
|||
|
||||
scope("Default", default: true) { |scope| scope }
|
||||
scope("Onboarding TODO") { |scope| scope.where('onboarding_exceptions is not null') }
|
||||
scope("Tency Only") { |scope| scope.joins('INNER JOIN jam_track_licensors as licensors ON jam_tracks.licensor_id = licensors.id').where("licensors.name = 'Tency Music'") }
|
||||
scope("Onboarding TODO w/ Tency Only") { |scope| scope.joins('INNER JOIN jam_track_licensors as licensors ON jam_tracks.licensor_id = licensors.id').where("licensors.name = 'Tency Music'").where('onboarding_exceptions is not null') }
|
||||
|
||||
form :partial => 'form'
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ module JamRuby
|
|||
validates_format_of :reproduction_royalty_amount, with: /^\d+\.*\d{0,4}$/, :allow_blank => true
|
||||
validates_format_of :licensor_royalty_amount, with: /^\d+\.*\d{0,4}$/, :allow_blank => true
|
||||
|
||||
belongs_to :licensor , class_name: 'JamRuby::JamTrackLicensor', foreign_key: 'licensor_id'
|
||||
belongs_to :licensor , class_name: 'JamRuby::JamTrackLicensor', foreign_key: 'licensor_id', :inverse_of => :jam_tracks
|
||||
|
||||
has_many :genres_jam_tracks, :class_name => "JamRuby::GenreJamTrack", :foreign_key => "jam_track_id"
|
||||
has_many :genres, :through => :genres_jam_tracks, :class_name => "JamRuby::Genre", :source => :genre
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
module JamRuby
|
||||
class JamTrackLicensor < ActiveRecord::Base
|
||||
|
||||
table_name = 'jam_track_licensors'
|
||||
|
||||
attr_accessible :name, :description, :attention, :address_line_1, :address_line_2,
|
||||
:city, :state, :zip_code, :contact, :email, :phone, as: :admin
|
||||
|
||||
|
|
@ -16,6 +18,6 @@ module JamRuby
|
|||
validates :email, length: {maximum: 200}
|
||||
validates :phone, length: {maximum: 200}
|
||||
|
||||
has_many :jam_tracks, :class_name => "JamRuby::JamTrack", foreign_key: 'licensor_id'
|
||||
has_many :jam_tracks, :class_name => "JamRuby::JamTrack", foreign_key: 'licensor_id', :inverse_of => :licensor
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue