very_nifty_generators 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +21 -1
- data/README.rdoc +20 -1
- data/TODO +1 -0
- data/bin/nifty_app +28 -0
- data/bin/nifty_auth +26 -0
- data/bin/nifty_config +26 -0
- data/bin/nifty_controller +28 -0
- data/bin/nifty_layout +26 -0
- data/bin/nifty_scaffold +28 -0
- data/lib/generators/nifty/app/USAGE +9 -0
- data/lib/generators/nifty/app/app_generator.rb +215 -0
- data/lib/generators/nifty/app/templates/Gemfile +28 -0
- data/lib/generators/nifty/app/templates/README +216 -0
- data/lib/generators/nifty/app/templates/Rakefile +10 -0
- data/lib/generators/nifty/app/templates/app/controllers/application_controller.rb +3 -0
- data/lib/generators/nifty/app/templates/app/helpers/application_helper.rb +2 -0
- data/lib/generators/nifty/app/templates/config/application.rb +37 -0
- data/lib/generators/nifty/app/templates/config/boot.rb +38 -0
- data/lib/generators/nifty/app/templates/config/environment.rb +5 -0
- data/lib/generators/nifty/app/templates/config/environments/development.rb.tt +19 -0
- data/lib/generators/nifty/app/templates/config/environments/production.rb.tt +33 -0
- data/lib/generators/nifty/app/templates/config/environments/test.rb.tt +29 -0
- data/lib/generators/nifty/app/templates/config/initializers/backtrace_silencers.rb +7 -0
- data/lib/generators/nifty/app/templates/config/initializers/cookie_verification_secret.rb.tt +7 -0
- data/lib/generators/nifty/app/templates/config/initializers/inflections.rb +10 -0
- data/lib/generators/nifty/app/templates/config/initializers/mime_types.rb +5 -0
- data/lib/generators/nifty/app/templates/config/initializers/session_store.rb.tt +15 -0
- data/lib/generators/nifty/app/templates/config/locales/en.yml +5 -0
- data/lib/generators/nifty/app/templates/config/routes.rb +58 -0
- data/lib/generators/nifty/app/templates/config.ru +4 -0
- data/lib/generators/nifty/app/templates/db/seeds.rb +7 -0
- data/lib/generators/nifty/app/templates/doc/README_FOR_APP +2 -0
- data/lib/generators/nifty/app/templates/gitignore +2 -0
- data/lib/generators/nifty/app/templates/public/404.html +26 -0
- data/lib/generators/nifty/app/templates/public/422.html +26 -0
- data/lib/generators/nifty/app/templates/public/500.html +26 -0
- data/lib/generators/nifty/app/templates/public/favicon.ico +0 -0
- data/lib/generators/nifty/app/templates/public/images/rails.png +0 -0
- data/lib/generators/nifty/app/templates/public/javascripts/application.js +2 -0
- data/lib/generators/nifty/app/templates/public/robots.txt +5 -0
- data/lib/generators/nifty/app/templates/script/about +3 -0
- data/lib/generators/nifty/app/templates/script/console.tt +5 -0
- data/lib/generators/nifty/app/templates/script/dbconsole.tt +5 -0
- data/lib/generators/nifty/app/templates/script/destroy +2 -0
- data/lib/generators/nifty/app/templates/script/generate +2 -0
- data/lib/generators/nifty/app/templates/script/performance/benchmarker +2 -0
- data/lib/generators/nifty/app/templates/script/performance/profiler +2 -0
- data/lib/generators/nifty/app/templates/script/plugin +2 -0
- data/lib/generators/nifty/app/templates/script/runner +3 -0
- data/lib/generators/nifty/app/templates/script/server.tt +5 -0
- data/lib/generators/nifty/app/templates/test/performance/browsing_test.rb +9 -0
- data/lib/generators/nifty/app/templates/test/test_helper.rb +13 -0
- data/lib/generators/nifty/authentication/USAGE +51 -0
- data/lib/generators/nifty/authentication/authentication_generator.rb +2 -1
- data/lib/generators/nifty/config/USAGE +24 -0
- data/lib/generators/nifty/config/config_generator.rb +2 -1
- data/lib/generators/nifty/controller/TODO +1 -0
- data/lib/generators/nifty/controller/USAGE +4 -0
- data/lib/generators/nifty/controller/controller_generator.rb +80 -0
- data/lib/generators/nifty/controller/templates/_controller.rb +4 -0
- data/lib/generators/nifty/controller/templates/actions/create.rb +4 -0
- data/lib/generators/nifty/controller/templates/actions/destroy.rb +4 -0
- data/lib/generators/nifty/controller/templates/actions/edit.rb +3 -0
- data/lib/generators/nifty/controller/templates/actions/index.rb +3 -0
- data/lib/generators/nifty/controller/templates/actions/new.rb +3 -0
- data/lib/generators/nifty/controller/templates/actions/show.rb +3 -0
- data/lib/generators/nifty/controller/templates/actions/update.rb +5 -0
- data/lib/generators/nifty/controller/templates/controller.rb +24 -0
- data/lib/generators/nifty/layout/USAGE +25 -0
- data/lib/generators/nifty/scaffold/USAGE +51 -0
- data/lib/generators/nifty/scaffold/scaffold_generator.rb +17 -5
- data/lib/generators/nifty/scaffold/templates/actions/new.rb +1 -1
- metadata +77 -5
@@ -0,0 +1,216 @@
|
|
1
|
+
== Getting Started
|
2
|
+
|
3
|
+
1. At the command prompt, start a new Rails application using the <tt>rails</tt> command
|
4
|
+
and your application name. Ex: rails myapp
|
5
|
+
2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options)
|
6
|
+
3. Go to http://localhost:3000/ and get "Welcome aboard: You're riding the Rails!"
|
7
|
+
4. Follow the guidelines to start developing your application
|
8
|
+
|
9
|
+
|
10
|
+
== Web Servers
|
11
|
+
|
12
|
+
By default, Rails will try to use Mongrel if it's are installed when started with script/server, otherwise Rails will use WEBrick, the webserver that ships with Ruby. But you can also use Rails
|
13
|
+
with a variety of other web servers.
|
14
|
+
|
15
|
+
Mongrel is a Ruby-based webserver with a C component (which requires compilation) that is
|
16
|
+
suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
|
17
|
+
getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>.
|
18
|
+
More info at: http://mongrel.rubyforge.org
|
19
|
+
|
20
|
+
Say other Ruby web servers like Thin and Ebb or regular web servers like Apache or LiteSpeed or
|
21
|
+
Lighttpd or IIS. The Ruby web servers are run through Rack and the latter can either be setup to use
|
22
|
+
FCGI or proxy to a pack of Mongrels/Thin/Ebb servers.
|
23
|
+
|
24
|
+
== Apache .htaccess example for FCGI/CGI
|
25
|
+
|
26
|
+
# General Apache options
|
27
|
+
AddHandler fastcgi-script .fcgi
|
28
|
+
AddHandler cgi-script .cgi
|
29
|
+
Options +FollowSymLinks +ExecCGI
|
30
|
+
|
31
|
+
# If you don't want Rails to look in certain directories,
|
32
|
+
# use the following rewrite rules so that Apache won't rewrite certain requests
|
33
|
+
#
|
34
|
+
# Example:
|
35
|
+
# RewriteCond %{REQUEST_URI} ^/notrails.*
|
36
|
+
# RewriteRule .* - [L]
|
37
|
+
|
38
|
+
# Redirect all requests not available on the filesystem to Rails
|
39
|
+
# By default the cgi dispatcher is used which is very slow
|
40
|
+
#
|
41
|
+
# For better performance replace the dispatcher with the fastcgi one
|
42
|
+
#
|
43
|
+
# Example:
|
44
|
+
# RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
|
45
|
+
RewriteEngine On
|
46
|
+
|
47
|
+
# If your Rails application is accessed via an Alias directive,
|
48
|
+
# then you MUST also set the RewriteBase in this htaccess file.
|
49
|
+
#
|
50
|
+
# Example:
|
51
|
+
# Alias /myrailsapp /path/to/myrailsapp/public
|
52
|
+
# RewriteBase /myrailsapp
|
53
|
+
|
54
|
+
RewriteRule ^$ index.html [QSA]
|
55
|
+
RewriteRule ^([^.]+)$ $1.html [QSA]
|
56
|
+
RewriteCond %{REQUEST_FILENAME} !-f
|
57
|
+
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
|
58
|
+
|
59
|
+
# In case Rails experiences terminal errors
|
60
|
+
# Instead of displaying this message you can supply a file here which will be rendered instead
|
61
|
+
#
|
62
|
+
# Example:
|
63
|
+
# ErrorDocument 500 /500.html
|
64
|
+
|
65
|
+
ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
|
66
|
+
|
67
|
+
|
68
|
+
== Debugging Rails
|
69
|
+
|
70
|
+
Sometimes your application goes wrong. Fortunately there are a lot of tools that
|
71
|
+
will help you debug it and get it back on the rails.
|
72
|
+
|
73
|
+
First area to check is the application log files. Have "tail -f" commands running
|
74
|
+
on the server.log and development.log. Rails will automatically display debugging
|
75
|
+
and runtime information to these files. Debugging info will also be shown in the
|
76
|
+
browser on requests from 127.0.0.1.
|
77
|
+
|
78
|
+
You can also log your own messages directly into the log file from your code using
|
79
|
+
the Ruby logger class from inside your controllers. Example:
|
80
|
+
|
81
|
+
class WeblogController < ActionController::Base
|
82
|
+
def destroy
|
83
|
+
@weblog = Weblog.find(params[:id])
|
84
|
+
@weblog.destroy
|
85
|
+
logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
The result will be a message in your log file along the lines of:
|
90
|
+
|
91
|
+
Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1
|
92
|
+
|
93
|
+
More information on how to use the logger is at http://www.ruby-doc.org/core/
|
94
|
+
|
95
|
+
Also, Ruby documentation can be found at http://www.ruby-lang.org/ including:
|
96
|
+
|
97
|
+
* The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/
|
98
|
+
* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
|
99
|
+
|
100
|
+
These two online (and free) books will bring you up to speed on the Ruby language
|
101
|
+
and also on programming in general.
|
102
|
+
|
103
|
+
|
104
|
+
== Debugger
|
105
|
+
|
106
|
+
Debugger support is available through the debugger command when you start your Mongrel or
|
107
|
+
Webrick server with --debugger. This means that you can break out of execution at any point
|
108
|
+
in the code, investigate and change the model, AND then resume execution!
|
109
|
+
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
|
110
|
+
Example:
|
111
|
+
|
112
|
+
class WeblogController < ActionController::Base
|
113
|
+
def index
|
114
|
+
@posts = Post.find(:all)
|
115
|
+
debugger
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
So the controller will accept the action, run the first line, then present you
|
120
|
+
with a IRB prompt in the server window. Here you can do things like:
|
121
|
+
|
122
|
+
>> @posts.inspect
|
123
|
+
=> "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
|
124
|
+
#<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
|
125
|
+
>> @posts.first.title = "hello from a debugger"
|
126
|
+
=> "hello from a debugger"
|
127
|
+
|
128
|
+
...and even better is that you can examine how your runtime objects actually work:
|
129
|
+
|
130
|
+
>> f = @posts.first
|
131
|
+
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
|
132
|
+
>> f.
|
133
|
+
Display all 152 possibilities? (y or n)
|
134
|
+
|
135
|
+
Finally, when you're ready to resume execution, you enter "cont"
|
136
|
+
|
137
|
+
|
138
|
+
== Console
|
139
|
+
|
140
|
+
You can interact with the domain model by starting the console through <tt>script/console</tt>.
|
141
|
+
Here you'll have all parts of the application configured, just like it is when the
|
142
|
+
application is running. You can inspect domain models, change values, and save to the
|
143
|
+
database. Starting the script without arguments will launch it in the development environment.
|
144
|
+
Passing an argument will specify a different environment, like <tt>script/console production</tt>.
|
145
|
+
|
146
|
+
To reload your controllers and models after launching the console run <tt>reload!</tt>
|
147
|
+
|
148
|
+
== dbconsole
|
149
|
+
|
150
|
+
You can go to the command line of your database directly through <tt>script/dbconsole</tt>.
|
151
|
+
You would be connected to the database with the credentials defined in database.yml.
|
152
|
+
Starting the script without arguments will connect you to the development database. Passing an
|
153
|
+
argument will connect you to a different database, like <tt>script/dbconsole production</tt>.
|
154
|
+
Currently works for mysql, postgresql and sqlite.
|
155
|
+
|
156
|
+
== Description of Contents
|
157
|
+
|
158
|
+
app
|
159
|
+
Holds all the code that's specific to this particular application.
|
160
|
+
|
161
|
+
app/controllers
|
162
|
+
Holds controllers that should be named like weblogs_controller.rb for
|
163
|
+
automated URL mapping. All controllers should descend from ApplicationController
|
164
|
+
which itself descends from ActionController::Base.
|
165
|
+
|
166
|
+
app/models
|
167
|
+
Holds models that should be named like post.rb.
|
168
|
+
Most models will descend from ActiveRecord::Base.
|
169
|
+
|
170
|
+
app/views
|
171
|
+
Holds the template files for the view that should be named like
|
172
|
+
weblogs/index.html.erb for the WeblogsController#index action. All views use eRuby
|
173
|
+
syntax.
|
174
|
+
|
175
|
+
app/views/layouts
|
176
|
+
Holds the template files for layouts to be used with views. This models the common
|
177
|
+
header/footer method of wrapping views. In your views, define a layout using the
|
178
|
+
<tt>layout :default</tt> and create a file named default.html.erb. Inside default.html.erb,
|
179
|
+
call <% yield %> to render the view using this layout.
|
180
|
+
|
181
|
+
app/helpers
|
182
|
+
Holds view helpers that should be named like weblogs_helper.rb. These are generated
|
183
|
+
for you automatically when using script/generate for controllers. Helpers can be used to
|
184
|
+
wrap functionality for your views into methods.
|
185
|
+
|
186
|
+
config
|
187
|
+
Configuration files for the Rails environment, the routing map, the database, and other dependencies.
|
188
|
+
|
189
|
+
db
|
190
|
+
Contains the database schema in schema.rb. db/migrate contains all
|
191
|
+
the sequence of Migrations for your schema.
|
192
|
+
|
193
|
+
doc
|
194
|
+
This directory is where your application documentation will be stored when generated
|
195
|
+
using <tt>rake doc:app</tt>
|
196
|
+
|
197
|
+
lib
|
198
|
+
Application specific libraries. Basically, any kind of custom code that doesn't
|
199
|
+
belong under controllers, models, or helpers. This directory is in the load path.
|
200
|
+
|
201
|
+
public
|
202
|
+
The directory available for the web server. Contains subdirectories for images, stylesheets,
|
203
|
+
and javascripts. Also contains the dispatchers and the default HTML files. This should be
|
204
|
+
set as the DOCUMENT_ROOT of your web server.
|
205
|
+
|
206
|
+
script
|
207
|
+
Helper scripts for automation and generation.
|
208
|
+
|
209
|
+
test
|
210
|
+
Unit and functional tests along with fixtures. When using the script/generate scripts, template
|
211
|
+
test files will be generated for you and placed in this directory.
|
212
|
+
|
213
|
+
vendor
|
214
|
+
External libraries that the application depends on. Also includes the plugins subdirectory.
|
215
|
+
If the app has frozen rails, those gems also go here, under vendor/rails/.
|
216
|
+
This directory is in the load path.
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
+
|
4
|
+
require File.expand_path('../config/application', __FILE__)
|
5
|
+
|
6
|
+
require 'rake'
|
7
|
+
require 'rake/testtask'
|
8
|
+
require 'rake/rdoctask'
|
9
|
+
|
10
|
+
Rails::Application.load_tasks
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
module <%= app_const_base %>
|
4
|
+
class Application < Rails::Application
|
5
|
+
# Settings in config/environments/* take precedence over those specified here.
|
6
|
+
# Application configuration should go into files in config/initializers
|
7
|
+
# -- all .rb files in that directory are automatically loaded.
|
8
|
+
|
9
|
+
# Add additional load paths for your own custom dirs
|
10
|
+
# config.load_paths += %W( #{config.root}/extras )
|
11
|
+
|
12
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
13
|
+
# :all can be used as a placeholder for all plugins not explicitly named
|
14
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
15
|
+
|
16
|
+
# Activate observers that should always be running
|
17
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
18
|
+
|
19
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
20
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
21
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
22
|
+
|
23
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
24
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
|
25
|
+
# config.i18n.default_locale = :de
|
26
|
+
|
27
|
+
# Configure generators values. Many other options are available, be sure to check the documentation.
|
28
|
+
# config.generators do |g|
|
29
|
+
# g.orm :mongo_db
|
30
|
+
# g.template_engine :erb
|
31
|
+
# g.test_framework :rspec, :fixture => true
|
32
|
+
# end
|
33
|
+
|
34
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
35
|
+
config.filter_parameters << :password
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Use Bundler (preferred)
|
2
|
+
environment = File.expand_path('../../vendor/gems/environment', __FILE__)
|
3
|
+
if File.exist?("#{environment}.rb")
|
4
|
+
require environment
|
5
|
+
|
6
|
+
# Use 2.x style vendor/rails and RubyGems
|
7
|
+
else
|
8
|
+
vendor_rails = File.expand_path('../../vendor/rails', __FILE__)
|
9
|
+
if File.exist?(vendor_rails)
|
10
|
+
Dir["#{vendor_rails}/*/lib"].each { |path| $:.unshift(path) }
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
end
|
15
|
+
|
16
|
+
<% unless options[:skip_activerecord] -%>
|
17
|
+
require 'rails/all'
|
18
|
+
|
19
|
+
# To pick the frameworks you want, remove 'require "rails/all"'
|
20
|
+
# and list the framework railties that you want:
|
21
|
+
#
|
22
|
+
# require "active_support/railtie"
|
23
|
+
# require "active_model/railtie"
|
24
|
+
# require "active_record/railtie"
|
25
|
+
# require "action_controller/railtie"
|
26
|
+
# require "action_view/railtie"
|
27
|
+
# require "action_mailer/railtie"
|
28
|
+
# require "active_resource/railtie"
|
29
|
+
<% else -%>
|
30
|
+
# Pick the frameworks you want:
|
31
|
+
# require "active_model/railtie"
|
32
|
+
# require "active_record/railtie"
|
33
|
+
require "active_support/railtie"
|
34
|
+
require "action_controller/railtie"
|
35
|
+
require "action_view/railtie"
|
36
|
+
require "action_mailer/railtie"
|
37
|
+
require "active_resource/railtie"
|
38
|
+
<% end -%>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= app_const %>.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the webserver when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.action_controller.consider_all_requests_local = true
|
14
|
+
config.action_view.debug_rjs = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Don't care if the mailer can't send
|
18
|
+
config.action_mailer.raise_delivery_errors = false
|
19
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<%= app_const %>.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
+
|
4
|
+
# The production environment is meant for finished, "live" apps.
|
5
|
+
# Code is not reloaded between requests
|
6
|
+
config.cache_classes = true
|
7
|
+
|
8
|
+
# Full error reports are disabled and caching is turned on
|
9
|
+
config.action_controller.consider_all_requests_local = false
|
10
|
+
config.action_controller.perform_caching = true
|
11
|
+
|
12
|
+
# See everything in the log (default is :info)
|
13
|
+
# config.log_level = :debug
|
14
|
+
|
15
|
+
# Use a different logger for distributed setups
|
16
|
+
# config.logger = SyslogLogger.new
|
17
|
+
|
18
|
+
# Use a different cache store in production
|
19
|
+
# config.cache_store = :mem_cache_store
|
20
|
+
|
21
|
+
# Disable Rails's static asset server
|
22
|
+
# In production, Apache or nginx will already do this
|
23
|
+
config.serve_static_assets = false
|
24
|
+
|
25
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
26
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
27
|
+
|
28
|
+
# Disable delivery errors, bad email addresses will be ignored
|
29
|
+
# config.action_mailer.raise_delivery_errors = false
|
30
|
+
|
31
|
+
# Enable threaded mode
|
32
|
+
# config.threadsafe!
|
33
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<%= app_const %>.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Log error messages when you accidentally call methods on nil.
|
11
|
+
config.whiny_nils = true
|
12
|
+
|
13
|
+
# Show full error reports and disable caching
|
14
|
+
config.action_controller.consider_all_requests_local = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Disable request forgery protection in test environment
|
18
|
+
config.action_controller.allow_forgery_protection = false
|
19
|
+
|
20
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
21
|
+
# The :test delivery method accumulates sent emails in the
|
22
|
+
# ActionMailer::Base.deliveries array.
|
23
|
+
config.action_mailer.delivery_method = :test
|
24
|
+
|
25
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
26
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
27
|
+
# like if you have constraints or database-specific column types
|
28
|
+
# config.active_record.schema_format = :sql
|
29
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
ActionController::Base.cookie_verifier_secret = '<%= app_secret %>'
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying cookie session data integrity.
|
4
|
+
# If you change this key, all old sessions will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
ActionController::Base.session = {
|
8
|
+
:key => '_<%= app_name %>_session',
|
9
|
+
:secret => '<%= app_secret %>'
|
10
|
+
}
|
11
|
+
|
12
|
+
# Use the database for sessions instead of the cookie-based default,
|
13
|
+
# which shouldn't be used to store highly confidential information
|
14
|
+
# (create the session table with "rake db:sessions:create")
|
15
|
+
# ActionController::Base.session_store = :active_record_store
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<%= app_const %>.routes.draw do |map|
|
2
|
+
# The priority is based upon order of creation:
|
3
|
+
# first created -> highest priority.
|
4
|
+
|
5
|
+
# Sample of regular route:
|
6
|
+
# match 'products/:id' => 'catalog#view'
|
7
|
+
# Keep in mind you can assign values other than :controller and :action
|
8
|
+
|
9
|
+
# Sample of named route:
|
10
|
+
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
11
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
12
|
+
|
13
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
14
|
+
# resources :products
|
15
|
+
|
16
|
+
# Sample resource route with options:
|
17
|
+
# resources :products do
|
18
|
+
# member do
|
19
|
+
# get :short
|
20
|
+
# post :toggle
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# collection do
|
24
|
+
# get :sold
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
|
28
|
+
# Sample resource route with sub-resources:
|
29
|
+
# resources :products do
|
30
|
+
# resources :comments, :sales
|
31
|
+
# resource :seller
|
32
|
+
# end
|
33
|
+
|
34
|
+
# Sample resource route with more complex sub-resources
|
35
|
+
# resources :products do
|
36
|
+
# resources :comments
|
37
|
+
# resources :sales do
|
38
|
+
# get :recent, :on => :collection
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
|
42
|
+
# Sample resource route within a namespace:
|
43
|
+
# namespace :admin do
|
44
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
45
|
+
# # (app/controllers/admin/products_controller.rb)
|
46
|
+
# resources :products
|
47
|
+
# end
|
48
|
+
|
49
|
+
# You can have the root of your site routed with "root"
|
50
|
+
# just remember to delete public/index.html.
|
51
|
+
# root :to => "welcome#index"
|
52
|
+
|
53
|
+
# See how all your routes lay out with "rake routes"
|
54
|
+
|
55
|
+
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
56
|
+
# Note: This route will make all actions in every controller accessible via GET requests.
|
57
|
+
# match ':controller(/:action(/:id(.:format)))'
|
58
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
7
|
+
# Mayor.create(:name => 'Daley', :city => cities.first)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/404.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/422.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The change you wanted was rejected.</h1>
|
23
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/500.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
23
|
+
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
File without changes
|
Binary file
|