diff --git a/app/controllers/mapping_controller.rb b/app/controllers/mapping_controller.rb new file mode 100644 index 00000000..8160c6e3 --- /dev/null +++ b/app/controllers/mapping_controller.rb @@ -0,0 +1,52 @@ +class MappingController < ApplicationController + # GET mappings + def index + end + + # GET mappings/new + def new + @mapping = Mapping.new + @user = current_user + respond_with(@mapping) + end + + # POST mappings + def create + @user = current_user + @mapping = Mapping.new() + @mapping.user = @user + if params[:map] + if params[:map][:id] + @map = Map.find(params[:map][:id]) + @mapping.map = @map + end + end + if params[:topic] + if params[:topic][:id] + @topic = Topic.find(params[:topic][:id]) + @mapping.topic = @topic + end + else if params[:synapse] + if params[:synapse][:id] + @topic = Synapse.find(params[:synapse][:id]) + @mapping.synapse = @synapse + end + end + end + + # GET /mappings/:id + def show + end + + # GET /mappings/:id/edit + def edit + end + + # PUT /mappings/:id + def update + end + + # DELETE /mappings/:id + def destroy + end +end diff --git a/config/routes.rb b/config/routes.rb index 9313f6c1..67fe70d1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -39,6 +39,8 @@ ISSAD::Application.routes.draw do resources :synapses, :only => [:index] resources :maps, :only => [:index] end + + resources :mappings # The priority is based upon order of creation: # first created -> highest priority.