Sha256: 145a69438c432f3020954ed771f445bc8bdb0543302825894c64d1993b0c3b7e

Contents?: true

Size: 612 Bytes

Versions: 2

Compression:

Stored size: 612 Bytes

Contents

require 'fields/controllers/main_controller'

module Fields
  class CheckboxController < MainController
    before_action :setup_field
    
    def setup_field
      # Get the name of the field by looking at the method scope
      @field_name = attrs.checked_last_method.gsub(/^[_]/, '')
    end
    
    def inline
      # Get the name of the field by looking at the method scope
      @field_name = attrs.checked_last_method.gsub(/^[_]/, '')
    end
    
    # Find the parent reactive value that produced the value
    # (usually just model._field)
    def model
      attrs.checked_parent
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
volt-fields-0.1.2 app/fields/controllers/checkbox_controller.rb
volt-fields-0.1.1 app/fields/controllers/checkbox_controller.rb