Sha256: b6c2bcd19553f37c441a859ee6508e50205679976c880ffde023ace1557040db
Contents?: true
Size: 865 Bytes
Versions: 4
Compression:
Stored size: 865 Bytes
Contents
require 'sinatra/base' require 'forms/order_form' class SampleSinatra < Sinatra::Base #set :show_exceptions, false before do load_form end get "/" do @page = 1 haml :form end get "/2" do @page = 2 haml :form end get "/3" do @page = 3 haml :form end post "/haml_form" do # We could probably do something with the form object here, maybe # Tells the form to serialize itself. @form.save_to_storage! redirect "/" end # Only used in unit tests post "/form" do # Tells the form to serialize itself. @form.save_to_storage! # Renders something (used in tests) @form.person end private def load_form @form = OrderForm.new(:form => request.params["form"], :request => request, :response => response) end end
Version data entries
4 entries across 4 versions & 1 rubygems