added mapping_controller and routes, but only implemented create
This commit is contained in:
parent
0bd468b28f
commit
101f49b9e6
2 changed files with 54 additions and 0 deletions
52
app/controllers/mapping_controller.rb
Normal file
52
app/controllers/mapping_controller.rb
Normal file
|
@ -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
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue