Sha256: 9b77406409fff4fa2c37f00fb588c9b60d20882ee7ef1d1f80f0412a20d8fa85

Contents?: true

Size: 490 Bytes

Versions: 6

Compression:

Stored size: 490 Bytes

Contents

class FormsController < ApplicationController
  class SearchForm < ActiveModel::Form
    self.model_name = 'q'
    attribute :username, :string
    attribute :created_at, :date_time
    attribute :locked, :boolean

    validates_presence_of :username
    validates_presence_of :created_at
  end

  def new
    @search = SearchForm.new
  end

  def create
    @search = SearchForm.new(params[:q])
    @search.valid?
    render 'new'
  end

  def show
    redirect_to action: 'new'
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
activemodel-form-1.2.0 example/app/controllers/forms_controller.rb
activemodel-form-1.1.0 example/app/controllers/forms_controller.rb
activemodel-form-1.0.0 example/app/controllers/forms_controller.rb
activemodel-form-0.0.3 example/app/controllers/forms_controller.rb
activemodel-form-0.0.2 example/app/controllers/forms_controller.rb
activemodel-form-0.0.1 example/app/controllers/forms_controller.rb