parent
15d7164b09
commit
a36cb003ba
@ -1,4 +1,9 @@
|
|||||||
class TrustieHack < ApplicationRecord
|
class TrustieHack < ApplicationRecord
|
||||||
has_many :hack_users, :dependent => :destroy
|
has_many :hack_users, :dependent => :destroy
|
||||||
belongs_to :trustie_hackathon, counter_cache: true
|
belongs_to :trustie_hackathon, counter_cache: true
|
||||||
|
|
||||||
|
|
||||||
|
def entry_info(user_id)
|
||||||
|
hack_users.exists?(user_id: user_id)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddUniqIndexForHackUsers < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
add_index :hack_users, [:user_id, :trustie_hack_id], unique: true
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in new issue