Created
January 6, 2013 15:46
-
-
Save dariocravero/4468018 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Issue987 < Padrino::Application | |
register Padrino::Rendering | |
register Padrino::Mailer | |
register Padrino::Helpers | |
use Rack::Protection::EscapedParams | |
enable :sessions | |
get :index do | |
render :index | |
end | |
class User | |
attr_accessor :name | |
end | |
post :user do | |
@user = User.new | |
@user.name = params[:name] | |
render :user | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# This file mounts each app in the Padrino project to a specified sub-uri. | |
# You can mount additional applications using any of these commands below: | |
# | |
# Padrino.mount('blog').to('/blog') | |
# Padrino.mount('blog', :app_class => 'BlogApp').to('/blog') | |
# Padrino.mount('blog', :app_file => 'path/to/blog/app.rb').to('/blog') | |
# | |
# You can also map apps to a specified host: | |
# | |
# Padrino.mount('Admin').host('admin.example.org') | |
# Padrino.mount('WebSite').host(/.*\.?example.org/) | |
# Padrino.mount('Foo').to('/foo').host('bar.example.org') | |
# | |
# Note 1: Mounted apps (by default) should be placed into the project root at '/app_name'. | |
# Note 2: If you use the host matching remember to respect the order of the rules. | |
# | |
# By default, this file mounts the primary app which was generated with this project. | |
# However, the mounted app can be modified as needed: | |
# | |
# Padrino.mount('AppName', :app_file => 'path/to/file', :app_class => 'BlogApp').to('/') | |
# | |
## | |
# Setup global project settings for your apps. These settings are inherited by every subapp. You can | |
# override these settings in the subapps as needed. | |
# | |
Padrino.configure_apps do | |
# enable :sessions | |
set :session_secret, 'dee403594c3b312a2ccdcd4a5e763f494f72143a7c3299febf2a8e878d958409' | |
end | |
# Mounts the core application for this project | |
Padrino.mount('Issue987').to('/') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Defines our constants | |
PADRINO_ENV = ENV['PADRINO_ENV'] ||= ENV['RACK_ENV'] ||= 'development' unless defined?(PADRINO_ENV) | |
PADRINO_ROOT = File.expand_path('../..', __FILE__) unless defined?(PADRINO_ROOT) | |
# Load our dependencies | |
require 'rubygems' unless defined?(Gem) | |
require 'bundler/setup' | |
Bundler.require(:default, PADRINO_ENV) | |
## | |
# ## Enable devel logging | |
# | |
# Padrino::Logger::Config[:development][:log_level] = :devel | |
# Padrino::Logger::Config[:development][:log_static] = true | |
# | |
# ## Configure your I18n | |
# | |
# I18n.default_locale = :en | |
# | |
# ## Configure your HTML5 data helpers | |
# | |
# Padrino::Helpers::TagHelpers::DATA_ATTRIBUTES.push(:dialog) | |
# text_field :foo, :dialog => true | |
# Generates: <input type="text" data-dialog="true" name="foo" /> | |
# | |
# ## Add helpers to mailer | |
# | |
# Mail::Message.class_eval do | |
# include Padrino::Helpers::NumberHelpers | |
# include Padrino::Helpers::TranslationHelpers | |
# end | |
## | |
# Add your before (RE)load hooks here | |
# | |
Padrino.before_load do | |
end | |
## | |
# Add your after (RE)load hooks here | |
# | |
Padrino.after_load do | |
end | |
Padrino.load! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment