aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails_generator
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-02-25 20:26:14 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-02-25 20:26:14 +0000
commit1aea4704dca570e3ef7abe69349ae2f161c7244b (patch)
treecb7930024cd97703f1da3ba1658856b024e62bc3 /railties/lib/rails_generator
parent63f188ceb01fa02487946e21ef623218f5074264 (diff)
downloadrails-1aea4704dca570e3ef7abe69349ae2f161c7244b.tar.gz
rails-1aea4704dca570e3ef7abe69349ae2f161c7244b.tar.bz2
rails-1aea4704dca570e3ef7abe69349ae2f161c7244b.zip
Added tmp/sessions, tmp/cache, and tmp/sockets as default directories in the Rails skeleton [DHH] Changed the default session configuration to place sessions in tmp/sessions, if that directory is available, instead of /tmp (this essentially means a goodbye to 9/10 White Screen of Death errors and should have web hosting firms around the world cheering) [DHH] Added a default configuration of the FileStore for fragment caching if tmp/cache is available, which makes action/fragment caching ready to use out of the box with no additional configuration [DHH] Changed the default configuration for lighttpd to use tmp/sockets instead of log/ for the FastCGI sockets [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3645 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib/rails_generator')
-rw-r--r--railties/lib/rails_generator/commands.rb5
-rw-r--r--railties/lib/rails_generator/generators/applications/app/app_generator.rb3
-rw-r--r--railties/lib/rails_generator/generators/components/model/model_generator.rb2
3 files changed, 7 insertions, 3 deletions
diff --git a/railties/lib/rails_generator/commands.rb b/railties/lib/rails_generator/commands.rb
index de6fefe093..dd72436fc8 100644
--- a/railties/lib/rails_generator/commands.rb
+++ b/railties/lib/rails_generator/commands.rb
@@ -309,8 +309,9 @@ module Rails
# When creating a migration, it knows to find the first available file in db/migrate and use the migration.rb template.
def migration_template(relative_source, relative_destination, template_options = {})
migration_directory relative_destination
- raise "Another migration is already named #{file_name}: #{existing_migrations(file_name).first}" if migration_exists?(file_name)
- template(relative_source, "#{relative_destination}/#{next_migration_string}_#{file_name}.rb", template_options)
+ migration_file_name = template_options[:migration_file_name] || file_name
+ raise "Another migration is already named #{migration_file_name}: #{existing_migrations(migration_file_name).first}" if migration_exists?(migration_file_name)
+ template(relative_source, "#{relative_destination}/#{next_migration_string}_#{migration_file_name}.rb", template_options)
end
private
diff --git a/railties/lib/rails_generator/generators/applications/app/app_generator.rb b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
index a192c14e0d..b421c5df74 100644
--- a/railties/lib/rails_generator/generators/applications/app/app_generator.rb
+++ b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
@@ -129,6 +129,9 @@ class AppGenerator < Rails::Generator::Base
test/unit
vendor
vendor/plugins
+ tmp/sessions
+ tmp/sockets
+ tmp/cache
)
MYSQL_SOCKET_LOCATIONS = [
diff --git a/railties/lib/rails_generator/generators/components/model/model_generator.rb b/railties/lib/rails_generator/generators/components/model/model_generator.rb
index 5e9aa882f3..9cadf863fb 100644
--- a/railties/lib/rails_generator/generators/components/model/model_generator.rb
+++ b/railties/lib/rails_generator/generators/components/model/model_generator.rb
@@ -19,7 +19,7 @@ class ModelGenerator < Rails::Generator::NamedBase
unless options[:skip_migration]
m.migration_template 'migration.rb', 'db/migrate', :assigns => {
:migration_name => "Add#{class_name.pluralize}"
- }
+ }, :migration_file_name => "add_#{file_name.pluralize}"
end
end
end