fix map/mapping associations that I broke

This commit is contained in:
Devin Howard 2015-09-19 16:48:24 +08:00
parent c361349c20
commit 2f9b09db86
3 changed files with 7 additions and 5 deletions

View file

@ -37,7 +37,7 @@ private
end
def require_admin
unless authenticated? && user.admin
unless authenticated? && admin?
redirect_to root_url, notice: "You need to be an admin for that."
return false
end

View file

@ -2,8 +2,10 @@ class Map < ActiveRecord::Base
belongs_to :user
has_many :topics, -> { Mapping.topicmapping }, :through => :topicmappings
has_many :synapses, -> { Mapping.synapsemapping }, :through => :synapsemappings
has_many :topicmappings, -> { Mapping.topicmapping }, class_name: :Mapping
has_many :synapsemappings, -> { Mapping.synapsemapping }, class_name: :Mapping
has_many :topics, through: :topicmappings
has_many :synapses, through: :synapsemappings
# This method associates the attribute ":image" with a file attachment
has_attached_file :screenshot, :styles => {