Sha256: 428795936371ff01c821da290f2a274ad1e565a1443e18d458fceb8a0e052704

Contents?: true

Size: 390 Bytes

Versions: 2

Compression:

Stored size: 390 Bytes

Contents

require 'fields/controllers/main_controller'

module Fields
  class RadioController < MainController
    # When a radio button is clicked, set the value of the field and start checking the field
    def set_field(value)
      model.send("#{@field_name}=", value)
      model.mark_field!(@field_name)
    end

    def checked?(value)
      value == model.send(@field_name)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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