Sha256: d51ca8f3a4b0c6520f6df31c5911315cae11f762d079b106f3926513b187d591
Contents?: true
Size: 1.42 KB
Versions: 2
Compression:
Stored size: 1.42 KB
Contents
require 'sinatra' require 'haml' require 'catissue' require 'casmall/authorization' require 'scat/autocomplete' require 'scat/edit' module Scat # The standard Scat application error. class ScatError < RuntimeError; end class App < Sinatra::Base include CaSmall::Authorization, Autocomplete set :root, File.dirname(__FILE__) + '/..' if development? then # Don't generate fancy HTML for stack traces. disable :show_exceptions # Allow errors to get out of the app so Cucumber can display them. enable :raise_errors end # The authorization page name. set :authorization_realm, 'Please enter your username and caTissue password' enable :sessions # Displays the edit form. get '/' do haml :edit end # Saves the specimen specified in the specimen form. post '/' do # Save the specimen. protect! { Edit.instance.save(params.merge(:user => current_user), session) } # Return to the edit form. redirect back end # Displays the CVs for the given property attribute which match the given input # value term. get '/autocomplete/*' do |pa| protect! { autocomplete(pa.to_sym, params[:term]) } end # Sets the status field to the error message. error do e = env['sinatra.error'] logger.error(e) request.params[:status] = e.message redirect back end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
caruby-scat-1.2.2 | lib/scat.rb |
caruby-scat-1.2.1 | lib/scat.rb |