Add vote functionality to tracks
This commit is contained in:
parent
8b2f2b538e
commit
92b09c7de4
18 changed files with 237 additions and 19 deletions
|
|
@ -47,8 +47,8 @@ module Admin
|
|||
@versions = @event.versions |
|
||||
PaperTrail::Version.where(item_type: 'Commercial').where('object LIKE ?', "%commercialable_id: #{@event.id}\ncommercialable_type: Event%") |
|
||||
PaperTrail::Version.where(item_type: 'Commercial').where('object_changes LIKE ?', "%commercialable_id:\n- \n- #{@event.id}\ncommercialable_type:\n- \n- Event%") |
|
||||
PaperTrail::Version.where(item_type: 'Vote').where('object_changes LIKE ?', "%\nevent_id:\n- \n- #{@event.id}\n%") |
|
||||
PaperTrail::Version.where(item_type: 'Vote').where('object LIKE ?', "%\nevent_id: #{@event.id}\n%")
|
||||
PaperTrail::Version.where(item_type: 'Vote').where('object_changes LIKE ?', "%votable_type:\n- \n- Event\nvotable_id:\n- \n- #{@event.id}%") |
|
||||
PaperTrail::Version.where(item_type: 'Vote').where('object LIKE ?', "%votable_type: Event\nvotable_id: #{@event.id}%")
|
||||
end
|
||||
|
||||
def edit
|
||||
|
|
@ -141,7 +141,7 @@ module Admin
|
|||
def vote
|
||||
@votes = @event.votes.includes(:user)
|
||||
|
||||
if (votes = current_user.votes.find_by_event_id(params[:id]))
|
||||
if (votes = current_user.votes.find_by(votable: @event))
|
||||
votes.update_attributes(rating: params[:rating])
|
||||
else
|
||||
@myvote = @event.votes.build
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue