Sha256: 82f5660ce7dd4126650308b6c008ecaa549389cabdefafc41a213408c2f031ee

Contents?: true

Size: 658 Bytes

Versions: 7

Compression:

Stored size: 658 Bytes

Contents

require 'stationed/crud_tag'

# Provides links to CRUD-style operations for resources.
#
# @see CrudTag
module CrudLinkHelper
  %i(new edit show index destroy).each do |action|
    define_method :"link_to_#{action}" do |*args|
      Stationed::CrudTag.new(self, :link_to, *args).send action
    end

    define_method :"button_to_#{action}" do |*args|
      Stationed::CrudTag.new(self, :button_to, *args).send action
    end

    define_method :"button_link_to_#{action}" do |*args|
      options = args.extract_options!
      options.reverse_merge! class: 'button'
      Stationed::CrudTag.new(self, :link_to, *args, options).send action
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
stationed-0.6.0 app/helpers/crud_link_helper.rb
stationed-0.5.0 app/helpers/crud_link_helper.rb
stationed-0.4.0 app/helpers/crud_link_helper.rb
stationed-0.3.0 app/helpers/crud_link_helper.rb
stationed-0.2.0 app/helpers/crud_link_helper.rb
stationed-0.1.0 app/helpers/crud_link_helper.rb
stationed-0.0.1 app/helpers/crud_link_helper.rb