railties 3.1.12 → 3.2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +2292 -41
- data/README.rdoc +14 -5
- data/bin/rails +7 -0
- data/guides/code/getting_started/Gemfile +27 -0
- data/guides/code/getting_started/README.rdoc +261 -0
- data/guides/code/getting_started/Rakefile +7 -0
- data/guides/code/getting_started/app/assets/images/rails.png +0 -0
- data/guides/code/getting_started/app/assets/javascripts/application.js +9 -0
- data/guides/code/getting_started/app/assets/javascripts/comments.js.coffee +3 -0
- data/guides/code/getting_started/app/assets/javascripts/home.js.coffee +3 -0
- data/guides/code/getting_started/app/assets/javascripts/posts.js.coffee +3 -0
- data/guides/code/getting_started/app/assets/stylesheets/application.css +7 -0
- data/guides/code/getting_started/app/assets/stylesheets/comments.css.scss +3 -0
- data/guides/code/getting_started/app/assets/stylesheets/home.css.scss +3 -0
- data/guides/code/getting_started/app/assets/stylesheets/posts.css.scss +3 -0
- data/guides/code/getting_started/app/assets/stylesheets/scaffolds.css.scss +56 -0
- data/guides/code/getting_started/app/controllers/application_controller.rb +3 -0
- data/guides/code/getting_started/app/controllers/comments_controller.rb +16 -0
- data/guides/code/getting_started/app/controllers/home_controller.rb +5 -0
- data/guides/code/getting_started/app/controllers/posts_controller.rb +84 -0
- data/guides/code/getting_started/app/helpers/application_helper.rb +2 -0
- data/guides/code/getting_started/app/helpers/comments_helper.rb +2 -0
- data/guides/code/getting_started/app/helpers/home_helper.rb +2 -0
- data/guides/code/getting_started/app/helpers/posts_helper.rb +5 -0
- data/guides/code/getting_started/app/models/comment.rb +3 -0
- data/guides/code/getting_started/app/models/post.rb +11 -0
- data/guides/code/getting_started/app/models/tag.rb +3 -0
- data/guides/code/getting_started/app/views/comments/_comment.html.erb +15 -0
- data/guides/code/getting_started/app/views/comments/_form.html.erb +13 -0
- data/guides/code/getting_started/app/views/home/index.html.erb +2 -0
- data/guides/code/getting_started/app/views/layouts/application.html.erb +14 -0
- data/guides/code/getting_started/app/views/posts/_form.html.erb +32 -0
- data/guides/code/getting_started/app/views/posts/edit.html.erb +6 -0
- data/guides/code/getting_started/app/views/posts/index.html.erb +27 -0
- data/guides/code/getting_started/app/views/posts/new.html.erb +5 -0
- data/guides/code/getting_started/app/views/posts/show.html.erb +31 -0
- data/guides/code/getting_started/app/views/tags/_form.html.erb +12 -0
- data/guides/code/getting_started/config.ru +4 -0
- data/guides/code/getting_started/config/application.rb +53 -0
- data/guides/code/getting_started/config/boot.rb +6 -0
- data/guides/code/getting_started/config/database.yml +25 -0
- data/guides/code/getting_started/config/environment.rb +5 -0
- data/guides/code/getting_started/config/environments/development.rb +37 -0
- data/guides/code/getting_started/config/environments/production.rb +67 -0
- data/guides/code/getting_started/config/environments/test.rb +37 -0
- data/guides/code/getting_started/config/initializers/backtrace_silencers.rb +7 -0
- data/guides/code/getting_started/config/initializers/inflections.rb +10 -0
- data/guides/code/getting_started/config/initializers/mime_types.rb +5 -0
- data/guides/code/getting_started/config/initializers/secret_token.rb +7 -0
- data/guides/code/getting_started/config/initializers/session_store.rb +8 -0
- data/guides/code/getting_started/config/initializers/wrap_parameters.rb +14 -0
- data/guides/code/getting_started/config/locales/en.yml +5 -0
- data/guides/code/getting_started/config/routes.rb +64 -0
- data/guides/code/getting_started/db/migrate/20110901012504_create_posts.rb +11 -0
- data/guides/code/getting_started/db/migrate/20110901012815_create_comments.rb +12 -0
- data/guides/code/getting_started/db/migrate/20110901013701_create_tags.rb +11 -0
- data/guides/code/getting_started/db/schema.rb +43 -0
- data/guides/code/getting_started/db/seeds.rb +7 -0
- data/guides/code/getting_started/doc/README_FOR_APP +2 -0
- data/guides/code/getting_started/public/404.html +26 -0
- data/guides/code/getting_started/public/422.html +26 -0
- data/guides/code/getting_started/public/500.html +26 -0
- data/guides/code/getting_started/public/favicon.ico +0 -0
- data/guides/code/getting_started/public/robots.txt +5 -0
- data/guides/code/getting_started/script/rails +6 -0
- data/guides/code/getting_started/test/fixtures/comments.yml +11 -0
- data/guides/code/getting_started/test/fixtures/posts.yml +11 -0
- data/guides/code/getting_started/test/fixtures/tags.yml +9 -0
- data/guides/code/getting_started/test/functional/comments_controller_test.rb +7 -0
- data/guides/code/getting_started/test/functional/home_controller_test.rb +9 -0
- data/guides/code/getting_started/test/functional/posts_controller_test.rb +49 -0
- data/guides/code/getting_started/test/performance/browsing_test.rb +12 -0
- data/guides/code/getting_started/test/test_helper.rb +13 -0
- data/guides/code/getting_started/test/unit/comment_test.rb +7 -0
- data/guides/code/getting_started/test/unit/helpers/comments_helper_test.rb +4 -0
- data/guides/code/getting_started/test/unit/helpers/home_helper_test.rb +4 -0
- data/guides/code/getting_started/test/unit/helpers/posts_helper_test.rb +4 -0
- data/guides/code/getting_started/test/unit/post_test.rb +7 -0
- data/guides/code/getting_started/test/unit/tag_test.rb +7 -0
- data/guides/rails_guides/generator.rb +2 -1
- data/guides/source/3_0_release_notes.textile +2 -2
- data/guides/source/3_1_release_notes.textile +3 -110
- data/guides/source/action_controller_overview.textile +11 -13
- data/guides/source/action_mailer_basics.textile +7 -18
- data/guides/source/action_view_overview.textile +78 -9
- data/guides/source/active_model_basics.textile +205 -0
- data/guides/source/active_record_basics.textile +31 -31
- data/guides/source/active_record_querying.textile +288 -67
- data/guides/source/active_record_validations_callbacks.textile +69 -75
- data/guides/source/active_resource_basics.textile +48 -2
- data/guides/source/active_support_core_extensions.textile +145 -24
- data/guides/source/ajax_on_rails.textile +65 -7
- data/guides/source/api_documentation_guidelines.textile +0 -6
- data/guides/source/asset_pipeline.textile +2 -2
- data/guides/source/association_basics.textile +25 -34
- data/guides/source/caching_with_rails.textile +12 -17
- data/guides/source/command_line.textile +29 -19
- data/guides/source/configuring.textile +40 -18
- data/guides/source/contributing_to_ruby_on_rails.textile +11 -18
- data/guides/source/debugging_rails_applications.textile +10 -21
- data/guides/source/engines.textile +618 -0
- data/guides/source/form_helpers.textile +1 -12
- data/guides/source/generators.textile +9 -11
- data/guides/source/getting_started.textile +152 -152
- data/guides/source/i18n.textile +4 -5
- data/guides/source/index.html.erb +0 -1
- data/guides/source/initialization.textile +26 -26
- data/guides/source/layouts_and_rendering.textile +97 -61
- data/guides/source/migrations.textile +380 -161
- data/guides/source/performance_testing.textile +4 -10
- data/guides/source/plugins.textile +11 -19
- data/guides/source/rails_application_templates.textile +12 -4
- data/guides/source/rails_on_rack.textile +25 -19
- data/guides/source/routing.textile +6 -13
- data/guides/source/ruby_on_rails_guides_guidelines.textile +0 -5
- data/guides/source/security.textile +11 -15
- data/guides/source/testing.textile +1 -9
- data/lib/rails/application.rb +107 -42
- data/lib/rails/application/bootstrap.rb +12 -11
- data/lib/rails/application/configuration.rb +27 -21
- data/lib/rails/application/finisher.rb +40 -17
- data/lib/rails/application/route_inspector.rb +75 -0
- data/lib/rails/application/routes_reloader.rb +15 -4
- data/lib/rails/code_statistics.rb +16 -5
- data/lib/rails/commands.rb +6 -5
- data/lib/rails/commands/application.rb +8 -1
- data/lib/rails/commands/console.rb +2 -0
- data/lib/rails/commands/dbconsole.rb +2 -2
- data/lib/rails/commands/destroy.rb +0 -2
- data/lib/rails/commands/generate.rb +3 -3
- data/lib/rails/commands/plugin.rb +161 -159
- data/lib/rails/commands/plugin_new.rb +3 -2
- data/lib/rails/commands/runner.rb +4 -0
- data/lib/rails/console/app.rb +26 -22
- data/lib/rails/console/helpers.rb +9 -5
- data/lib/rails/engine.rb +70 -34
- data/lib/rails/engine/commands.rb +39 -0
- data/lib/rails/engine/configuration.rb +1 -1
- data/lib/rails/generators.rb +3 -14
- data/lib/rails/generators/actions.rb +36 -9
- data/lib/rails/generators/app_base.rb +34 -38
- data/lib/rails/generators/base.rb +4 -4
- data/lib/rails/generators/generated_attribute.rb +1 -1
- data/lib/rails/generators/named_base.rb +1 -3
- data/lib/rails/generators/rails/app/USAGE +6 -0
- data/lib/rails/generators/rails/app/app_generator.rb +6 -2
- data/lib/rails/generators/rails/app/templates/Gemfile +4 -3
- data/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +9 -3
- data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css +11 -5
- data/lib/rails/generators/rails/app/templates/app/mailers/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/app/models/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/application.rb +11 -0
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml +1 -1
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +10 -1
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +10 -1
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +6 -6
- data/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb +5 -0
- data/lib/rails/generators/rails/app/templates/config/routes.rb +1 -1
- data/lib/rails/generators/rails/app/templates/public/500.html +0 -1
- data/lib/rails/generators/rails/app/templates/public/index.html +1 -1
- data/lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/test/fixtures/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/test/functional/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/test/integration/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/test/unit/.empty_directory +0 -0
- data/lib/rails/generators/rails/controller/templates/controller.rb +1 -1
- data/lib/rails/generators/rails/generator/templates/templates/.empty_directory +0 -0
- data/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb +17 -5
- data/lib/rails/generators/rails/plugin_new/templates/Rakefile +1 -0
- data/lib/rails/generators/rails/plugin_new/templates/app/mailers/.empty_directory +0 -0
- data/lib/rails/generators/rails/plugin_new/templates/app/models/.empty_directory +0 -0
- data/lib/rails/generators/rails/plugin_new/templates/app/views/layouts/%name%/application.html.erb.tt +1 -1
- data/lib/rails/generators/rails/plugin_new/templates/gitignore +4 -3
- data/lib/rails/generators/rails/plugin_new/templates/lib/%name%/engine.rb +1 -1
- data/lib/rails/generators/rails/plugin_new/templates/rails/application.rb +1 -1
- data/lib/rails/generators/rails/plugin_new/templates/script/rails.tt +5 -3
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +2 -2
- data/lib/rails/generators/rails/task/USAGE +9 -0
- data/lib/rails/generators/rails/task/task_generator.rb +12 -0
- data/lib/rails/generators/rails/task/templates/task.rb +8 -0
- data/lib/rails/generators/resource_helpers.rb +3 -3
- data/lib/rails/generators/test_unit/integration/templates/integration_test.rb +0 -2
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb +4 -4
- data/lib/rails/paths.rb +11 -38
- data/lib/rails/rack/debugger.rb +3 -4
- data/lib/rails/rack/logger.rb +26 -12
- data/lib/rails/railtie.rb +6 -1
- data/lib/rails/railtie/configuration.rb +12 -5
- data/lib/rails/source_annotation_extractor.rb +12 -10
- data/lib/rails/tasks/documentation.rake +3 -1
- data/lib/rails/tasks/engine.rake +1 -0
- data/lib/rails/tasks/misc.rake +1 -1
- data/lib/rails/tasks/routes.rake +3 -23
- data/lib/rails/test_help.rb +1 -2
- data/lib/rails/test_unit/testing.rake +8 -4
- data/lib/rails/version.rb +3 -3
- metadata +131 -61
- checksums.yaml +0 -7
- data/lib/rails/generators/rails/plugin/USAGE +0 -13
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +0 -54
- data/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt +0 -20
- data/lib/rails/generators/rails/plugin/templates/README.tt +0 -13
- data/lib/rails/generators/rails/plugin/templates/Rakefile.tt +0 -23
- data/lib/rails/generators/rails/plugin/templates/init.rb +0 -1
- data/lib/rails/generators/rails/plugin/templates/install.rb +0 -1
- data/lib/rails/generators/rails/plugin/templates/lib/%file_name%.rb.tt +0 -1
- data/lib/rails/generators/rails/plugin/templates/lib/tasks/%file_name%_tasks.rake.tt +0 -4
- data/lib/rails/generators/rails/plugin/templates/uninstall.rb +0 -1
@@ -34,7 +34,7 @@ module Rails
|
|
34
34
|
usage = source_root && File.expand_path("../USAGE", source_root)
|
35
35
|
|
36
36
|
@desc ||= if usage && File.exist?(usage)
|
37
|
-
File.read(usage)
|
37
|
+
ERB.new(File.read(usage)).result(binding)
|
38
38
|
else
|
39
39
|
"Description:\n Create #{base_name.humanize.downcase} files for #{generator_name} generator."
|
40
40
|
end
|
@@ -259,9 +259,9 @@ module Rails
|
|
259
259
|
extra << false unless Object.method(:const_defined?).arity == 1
|
260
260
|
|
261
261
|
# Extract the last Module in the nesting
|
262
|
-
last = nesting.inject(Object) do |
|
263
|
-
break unless
|
264
|
-
|
262
|
+
last = nesting.inject(Object) do |last_module, nest|
|
263
|
+
break unless last_module.const_defined?(nest, *extra)
|
264
|
+
last_module.const_get(nest)
|
265
265
|
end
|
266
266
|
|
267
267
|
if last && last.const_defined?(last_name.camelize, *extra)
|
@@ -7,7 +7,7 @@ module Rails
|
|
7
7
|
attr_accessor :name, :type
|
8
8
|
|
9
9
|
def initialize(name, type)
|
10
|
-
|
10
|
+
type = :string if type.blank?
|
11
11
|
@name, @type = name, type.to_sym
|
12
12
|
end
|
13
13
|
|
@@ -2,6 +2,12 @@ Description:
|
|
2
2
|
The 'rails new' command creates a new Rails application with a default
|
3
3
|
directory structure and configuration at the path you specify.
|
4
4
|
|
5
|
+
You can specify extra command-line arguments to be used every time
|
6
|
+
'rails new' runs in the .railsrc configuration file in your home directory.
|
7
|
+
|
8
|
+
Note that the arguments specified in the .railsrc file don't affect the
|
9
|
+
defaults values shown above in this help message.
|
10
|
+
|
5
11
|
Example:
|
6
12
|
rails new ~/Code/Ruby/weblog
|
7
13
|
|
@@ -38,7 +38,7 @@ module Rails
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def readme
|
41
|
-
copy_file "README"
|
41
|
+
copy_file "README", "README.rdoc"
|
42
42
|
end
|
43
43
|
|
44
44
|
def gemfile
|
@@ -122,10 +122,15 @@ module Rails
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def vendor
|
125
|
+
vendor_javascripts
|
125
126
|
vendor_stylesheets
|
126
127
|
vendor_plugins
|
127
128
|
end
|
128
129
|
|
130
|
+
def vendor_javascripts
|
131
|
+
empty_directory_with_gitkeep "vendor/assets/javascripts"
|
132
|
+
end
|
133
|
+
|
129
134
|
def vendor_stylesheets
|
130
135
|
empty_directory_with_gitkeep "vendor/assets/stylesheets"
|
131
136
|
end
|
@@ -139,7 +144,6 @@ module Rails
|
|
139
144
|
# We need to store the RAILS_DEV_PATH in a constant, otherwise the path
|
140
145
|
# can change in Ruby 1.8.7 when we FileUtils.cd.
|
141
146
|
RAILS_DEV_PATH = File.expand_path("../../../../../..", File.dirname(__FILE__))
|
142
|
-
|
143
147
|
RESERVED_NAMES = %w[application destroy benchmarker profiler plugin runner test]
|
144
148
|
|
145
149
|
class AppGenerator < AppBase
|
@@ -1,4 +1,4 @@
|
|
1
|
-
source '
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
<%= rails_gemfile_entry -%>
|
4
4
|
|
@@ -13,6 +13,9 @@ source 'http://rubygems.org'
|
|
13
13
|
# To use ActiveModel has_secure_password
|
14
14
|
# gem 'bcrypt-ruby', '~> 3.0.0'
|
15
15
|
|
16
|
+
# To use Jbuilder templates for JSON
|
17
|
+
# gem 'jbuilder'
|
18
|
+
|
16
19
|
# Use unicorn as the web server
|
17
20
|
# gem 'unicorn'
|
18
21
|
|
@@ -21,5 +24,3 @@ source 'http://rubygems.org'
|
|
21
24
|
|
22
25
|
# To use debugger
|
23
26
|
# <%= ruby_debugger_gemfile_entry %>
|
24
|
-
|
25
|
-
<%= turn_gemfile_entry -%>
|
@@ -1,9 +1,15 @@
|
|
1
|
-
// This is a manifest file that'll be compiled into
|
2
|
-
//
|
3
|
-
//
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
4
7
|
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
5
8
|
// the compiled file.
|
6
9
|
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
7
13
|
<% unless options[:skip_javascript] -%>
|
8
14
|
//= require <%= options[:javascript] %>
|
9
15
|
//= require <%= options[:javascript] %>_ujs
|
@@ -1,7 +1,13 @@
|
|
1
1
|
/*
|
2
|
-
* This is a manifest file that'll
|
3
|
-
*
|
4
|
-
*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
5
11
|
*= require_self
|
6
|
-
*= require_tree .
|
7
|
-
*/
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
File without changes
|
File without changes
|
@@ -49,6 +49,17 @@ module <%= app_const_base %>
|
|
49
49
|
# Configure sensitive parameters which will be filtered from the log file.
|
50
50
|
config.filter_parameters += [:password]
|
51
51
|
|
52
|
+
# Use SQL instead of Active Record's schema dumper when creating the database.
|
53
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
54
|
+
# like if you have constraints or database-specific column types
|
55
|
+
# config.active_record.schema_format = :sql
|
56
|
+
|
57
|
+
# Enforce whitelist mode for mass assignment.
|
58
|
+
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
59
|
+
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
60
|
+
# parameters by using an attr_accessible or attr_protected declaration.
|
61
|
+
# config.active_record.whitelist_attributes = true
|
62
|
+
|
52
63
|
<% unless options.skip_sprockets? -%>
|
53
64
|
# Enable the asset pipeline
|
54
65
|
config.assets.enabled = true
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb
|
3
3
|
|
4
4
|
# In the development environment your application's code is reloaded on
|
5
|
-
# every request.
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
6
|
# since you don't have to restart the web server when you make code changes.
|
7
7
|
config.cache_classes = false
|
8
8
|
|
@@ -22,6 +22,15 @@
|
|
22
22
|
# Only use best-standards-support built into browsers
|
23
23
|
config.action_dispatch.best_standards_support = :builtin
|
24
24
|
|
25
|
+
<%- unless options.skip_active_record? -%>
|
26
|
+
# Raise exception on mass assignment protection for ActiveRecord models
|
27
|
+
config.active_record.mass_assignment_sanitizer = :strict
|
28
|
+
|
29
|
+
# Log the query plan for queries taking more than this (works
|
30
|
+
# with SQLite, MySQL, and PostgreSQL)
|
31
|
+
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
32
|
+
<%- end -%>
|
33
|
+
|
25
34
|
<%- unless options.skip_sprockets? -%>
|
26
35
|
# Do not compress assets
|
27
36
|
config.assets.compress = false
|
@@ -35,8 +35,11 @@
|
|
35
35
|
# See everything in the log (default is :info)
|
36
36
|
# config.log_level = :debug
|
37
37
|
|
38
|
+
# Prepend all log lines with the following tags
|
39
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
40
|
+
|
38
41
|
# Use a different logger for distributed setups
|
39
|
-
# config.logger = SyslogLogger.new
|
42
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
40
43
|
|
41
44
|
# Use a different cache store in production
|
42
45
|
# config.cache_store = :mem_cache_store
|
@@ -61,4 +64,10 @@
|
|
61
64
|
|
62
65
|
# Send deprecation notices to registered listeners
|
63
66
|
config.active_support.deprecation = :notify
|
67
|
+
|
68
|
+
<%- unless options.skip_active_record? -%>
|
69
|
+
# Log the query plan for queries taking more than this (works
|
70
|
+
# with SQLite, MySQL, and PostgreSQL)
|
71
|
+
# config.active_record.auto_explain_threshold_in_seconds = 0.5
|
72
|
+
<%- end -%>
|
64
73
|
end
|
@@ -2,9 +2,9 @@
|
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb
|
3
3
|
|
4
4
|
# The test environment is used exclusively to run your application's
|
5
|
-
# test suite.
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
6
|
# your test database is "scratch space" for the test suite and is wiped
|
7
|
-
# and recreated between test runs.
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
8
|
config.cache_classes = true
|
9
9
|
|
10
10
|
# Configure static asset server for tests with Cache-Control for performance
|
@@ -29,10 +29,10 @@
|
|
29
29
|
# ActionMailer::Base.deliveries array.
|
30
30
|
config.action_mailer.delivery_method = :test
|
31
31
|
|
32
|
-
|
33
|
-
#
|
34
|
-
|
35
|
-
|
32
|
+
<%- unless options.skip_active_record? -%>
|
33
|
+
# Raise exception on mass assignment protection for ActiveRecord models
|
34
|
+
config.active_record.mass_assignment_sanitizer = :strict
|
35
|
+
<%- end -%>
|
36
36
|
|
37
37
|
# Print deprecation notices to the stderr
|
38
38
|
config.active_support.deprecation = :stderr
|
@@ -54,5 +54,5 @@
|
|
54
54
|
|
55
55
|
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
56
56
|
# Note: This route will make all actions in every controller accessible via GET requests.
|
57
|
-
# match ':controller(/:action(/:id(.:format)
|
57
|
+
# match ':controller(/:action(/:id))(.:format)'
|
58
58
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -39,7 +39,7 @@ module Rails
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def gitignore
|
42
|
-
|
42
|
+
template "gitignore", ".gitignore"
|
43
43
|
end
|
44
44
|
|
45
45
|
def lib
|
@@ -246,8 +246,20 @@ task :default => :test
|
|
246
246
|
"rails plugin new #{self.arguments.map(&:usage).join(' ')} [options]"
|
247
247
|
end
|
248
248
|
|
249
|
+
def original_name
|
250
|
+
@original_name ||= File.basename(destination_root)
|
251
|
+
end
|
252
|
+
|
249
253
|
def name
|
250
|
-
@name ||=
|
254
|
+
@name ||= begin
|
255
|
+
# same as ActiveSupport::Inflector#underscore except not replacing '-'
|
256
|
+
underscored = original_name.dup
|
257
|
+
underscored.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
|
258
|
+
underscored.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
|
259
|
+
underscored.downcase!
|
260
|
+
|
261
|
+
underscored
|
262
|
+
end
|
251
263
|
end
|
252
264
|
|
253
265
|
def camelized
|
@@ -256,11 +268,11 @@ task :default => :test
|
|
256
268
|
|
257
269
|
def valid_const?
|
258
270
|
if camelized =~ /^\d/
|
259
|
-
raise Error, "Invalid plugin name #{
|
271
|
+
raise Error, "Invalid plugin name #{original_name}. Please give a name which does not start with numbers."
|
260
272
|
elsif RESERVED_NAMES.include?(name)
|
261
|
-
raise Error, "Invalid plugin name #{
|
273
|
+
raise Error, "Invalid plugin name #{original_name}. Please give a name which does not match one of the reserved rails words."
|
262
274
|
elsif Object.const_defined?(camelized)
|
263
|
-
raise Error, "Invalid plugin name #{
|
275
|
+
raise Error, "Invalid plugin name #{original_name}, constant #{camelized} is already in use. Please choose another plugin name."
|
264
276
|
end
|
265
277
|
end
|
266
278
|
|
File without changes
|
File without changes
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<title><%= camelized %></title>
|
5
|
-
<%%= stylesheet_link_tag "<%= name %>/application" %>
|
5
|
+
<%%= stylesheet_link_tag "<%= name %>/application", :media => "all" %>
|
6
6
|
<%%= javascript_include_tag "<%= name %>/application" %>
|
7
7
|
<%%= csrf_meta_tags %>
|
8
8
|
</head>
|
@@ -4,7 +4,7 @@ require File.expand_path('../boot', __FILE__)
|
|
4
4
|
require 'rails/all'
|
5
5
|
<% else -%>
|
6
6
|
# Pick the frameworks you want:
|
7
|
-
<%= comment_if :skip_active_record %>
|
7
|
+
<%= comment_if :skip_active_record %>require "active_record/railtie"
|
8
8
|
require "action_controller/railtie"
|
9
9
|
require "action_mailer/railtie"
|
10
10
|
require "active_resource/railtie"
|
@@ -1,5 +1,7 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
1
|
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
2
|
|
4
|
-
|
5
|
-
|
3
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
4
|
+
ENGINE_PATH = File.expand_path('../../lib/<%= name -%>/engine', __FILE__)
|
5
|
+
|
6
|
+
require 'rails/all'
|
7
|
+
require 'rails/engine/commands'
|
@@ -62,7 +62,7 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
62
62
|
respond_to do |format|
|
63
63
|
if @<%= orm_instance.update_attributes("params[:#{singular_table_name}]") %>
|
64
64
|
format.html { redirect_to @<%= singular_table_name %>, <%= key_value :notice, "'#{human_name} was successfully updated.'" %> }
|
65
|
-
format.json { head :
|
65
|
+
format.json { head :no_content }
|
66
66
|
else
|
67
67
|
format.html { render <%= key_value :action, '"edit"' %> }
|
68
68
|
format.json { render <%= key_value :json, "@#{orm_instance.errors}" %>, <%= key_value :status, ':unprocessable_entity' %> }
|
@@ -78,7 +78,7 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
78
78
|
|
79
79
|
respond_to do |format|
|
80
80
|
format.html { redirect_to <%= index_helper %>_url }
|
81
|
-
format.json { head :
|
81
|
+
format.json { head :no_content }
|
82
82
|
end
|
83
83
|
end
|
84
84
|
end
|