Class: Transit::ContextsController

Inherits:
TransitController show all
Defined in:
app/controllers/transit/contexts_controller.rb

Instance Method Summary collapse

Methods inherited from TransitController

#edit_mode_enabled?, #render

Instance Method Details

#destroyObject



16
17
18
19
20
21
# File 'app/controllers/transit/contexts_controller.rb', line 16

def destroy
  parent.contexts.find(params[:id])
  @context.destroy
  flash[:success] = "The selected field has been removed."
  respond_with(@context)
end

#newObject



7
8
9
10
11
12
13
# File 'app/controllers/transit/contexts_controller.rb', line 7

def new
  ptype = symbols_for_association_chain.first.to_s
  parent_obj = ptype.classify.constantize.find(params["#{ptype}_id"])
  set_resource_ivar(parent_obj)
  @context = parent_obj.contexts.build({}, params[:type].classify.constantize)
  respond_with(@context)
end