Sha256: 6e573fcbdae1a59923a3292a84448b5268b35ac5c3603c7de545eebe157068f1
Contents?: true
Size: 609 Bytes
Versions: 1
Compression:
Stored size: 609 Bytes
Contents
class Transit::ContextsController < TransitController respond_to :js belongs_to :post, :page, polymorphic: true actions :new, :destroy 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 def destroy parent.contexts.find(params[:id]) @context.destroy flash[:success] = "The selected field has been removed." respond_with(@context) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
transit-0.0.2 | app/controllers/transit/contexts_controller.rb |