Sha256: f8c891df93939e4d5c3a3135bb19e55f1e4990b57c44f9e74c4bbb87be314775

Contents?: true

Size: 583 Bytes

Versions: 2

Compression:

Stored size: 583 Bytes

Contents

class Admin::BaseController < ActionController::Base
  layout 'admin'
  before_filter :authenticate_manager!
  include AdminHelper

  def welcome
  end

  private

  def redirect_or_edit(obj, saved)
    if saved
      redirect_to url_for_obj(obj), notice: notice_for(obj)
    else
      render 'edit'
    end
  end

  def notice_for(obj)
    "#{obj.class.model_name.human} сохранен."
  end

  def url_for_obj(obj)
    return [:edit, :admin, obj] if params[:commit] == 'Применить'
    [:admin, obj.class.model_name.plural.to_sym]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
redde-0.1.12 lib/generators/redde/layout/templates/controllers/base_controller.rb
redde-0.1.11 lib/generators/redde/layout/templates/controllers/base_controller.rb