Sha256: a8fd36e3eefb0fce2523803379ff446bb2d05ba82c4b05a808a1ca11d064fa8e

Contents?: true

Size: 873 Bytes

Versions: 6

Compression:

Stored size: 873 Bytes

Contents

module MorseControllerHelpers
  # module FlashHelpers
  module CrudHelpers
    def create
      @current_instance = klass.new(params_resource)
      if current_instance.save
        flash_create_yes
        redirect_to path_edit(current_instance)
      else
        flash_create_no
        render("#{resource_symbols}/new")
      end
    end

    def destroy
      if current_instance.destroy
        flash_destroy_yes
      else
        flash_destroy_no
      end
      redirect_to path_index
    end

    def edit; end

    def index; end

    def new
      @current_instance = klass.new
    end

    def show; end

    def update
      if current_instance.update_attributes(params_resource)
        flash_update_yes
        redirect_to path_edit(current_instance)
      else
        flash_update_no
        render("#{resource_symbols}/edit")
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
morse_controller_helpers-0.1.14 lib/morse_controller_helpers/crud_helpers.rb
morse_controller_helpers-0.1.13 lib/morse_controller_helpers/crud_helpers.rb
morse_controller_helpers-0.1.12 lib/morse_controller_helpers/crud_helpers.rb
morse_controller_helpers-0.1.11 lib/morse_controller_helpers/crud_helpers.rb
morse_controller_helpers-0.1.10 lib/morse_controller_helpers/crud_helpers.rb
morse_controller_helpers-0.1.9 lib/morse_controller_helpers/crud_helpers.rb