Sha256: 4ed9812f359dba607583b7b9cb8fbbb998d256962b9fbf0b006774163e1a1178
Contents?: true
Size: 1.14 KB
Versions: 45
Compression:
Stored size: 1.14 KB
Contents
module Tramway::Admin class SingletonsController < ApplicationController def show if model_class.active.first.present? @singleton = decorator_class.decorate model_class.active.first else @singleton_form = form_class.new model_class.new render :new return end end def edit @singleton_form = form_class.new model_class.active.first end def create @singleton_form = form_class.new model_class.new if @singleton_form.submit params[:singleton] redirect_to params[:redirect] || singleton_path(model: params[:model]) else render :edit end end def update @singleton_form = form_class.new model_class.active.first if @singleton_form.submit params[:singleton] redirect_to params[:redirect] || singleton_path(model: params[:model]) else render :edit end end end private # FIXME replace to module def singleton_path(*args, **options) super args, options.merge(model: params[:model]) end def edit_singleton_path(*args, **options) super args, options.merge(model: params[:model]) end end
Version data entries
45 entries across 45 versions & 1 rubygems