Sha256: faf04f067470f5a04c3a7ef47bc13b36e8398abf282d7b8239f247da6f04f7a9

Contents?: true

Size: 548 Bytes

Versions: 1

Compression:

Stored size: 548 Bytes

Contents

class SamplesController < ApplicationController
  def new
    @sample = Sample.new
  end

  def remnant
    @sample = Sample.new
  end

  def create
    Sample.create!(sample_params)
    redirect_to params[:remnant] ? remnant_path : new_path
  rescue ActiveRecord::RecordInvalid => e
    @sample = e.record
    render params[:remnant] ? :remnant : :new
  end


  private
  def sample_params
    params.fetch(:sample, {}).permit(:text, :password, :textarea, :select, :radio, checkbox: [])
  end

end
class String
  alias :gsub_not_safety! :gsub!
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yorisoi-0.0.3 spec/dummy/app/controllers/samples_controller.rb