Class: Transit::ContextsController
Instance Method Summary
collapse
#edit_mode_enabled?, #render
Instance Method Details
#destroy ⇒ Object
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
|
#new ⇒ Object
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
|