railties 3.0.7 → 3.0.8.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/guides/source/i18n.textile +4 -4
- data/guides/source/rails_on_rack.textile +2 -2
- data/guides/source/testing.textile +3 -4
- data/lib/rails/application.rb +6 -4
- data/lib/rails/commands/console.rb +1 -1
- data/lib/rails/commands/dbconsole.rb +6 -0
- data/lib/rails/generators/rails/app/app_generator.rb +7 -0
- data/lib/rails/generators/rails/app/templates/Gemfile +1 -1
- data/lib/rails/railtie.rb +1 -0
- data/lib/rails/version.rb +2 -2
- metadata +24 -16
data/CHANGELOG
CHANGED
data/guides/source/i18n.textile
CHANGED
@@ -133,9 +133,9 @@ The _setting part_ is easy. You can set the locale in a +before_filter+ in the +
|
|
133
133
|
|
134
134
|
<ruby>
|
135
135
|
before_filter :set_locale
|
136
|
+
|
136
137
|
def set_locale
|
137
|
-
|
138
|
-
I18n.locale = params[:locale]
|
138
|
+
I18n.locale = params[:locale] || I18n.default_locale
|
139
139
|
end
|
140
140
|
</ruby>
|
141
141
|
|
@@ -158,7 +158,7 @@ You can implement it like this in your +ApplicationController+:
|
|
158
158
|
before_filter :set_locale
|
159
159
|
|
160
160
|
def set_locale
|
161
|
-
I18n.locale = extract_locale_from_tld
|
161
|
+
I18n.locale = extract_locale_from_tld || I18n.default_locale
|
162
162
|
end
|
163
163
|
|
164
164
|
# Get locale from top-level domain or return nil if such locale is not available
|
@@ -182,7 +182,7 @@ We can also set the locale from the _subdomain_ in a very similar way:
|
|
182
182
|
# in your /etc/hosts file to try this out locally
|
183
183
|
def extract_locale_from_subdomain
|
184
184
|
parsed_locale = request.subdomains.first
|
185
|
-
I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale
|
185
|
+
I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil
|
186
186
|
end
|
187
187
|
</ruby>
|
188
188
|
|
@@ -228,8 +228,8 @@ h4. Learning Rack
|
|
228
228
|
|
229
229
|
* "Official Rack Website":http://rack.github.com
|
230
230
|
* "Introducing Rack":http://chneukirchen.org/blog/archive/2007/02/introducing-rack.html
|
231
|
-
* "Ruby on Rack #1 - Hello Rack!":http://m.onkey.org/
|
232
|
-
* "Ruby on Rack #2 - The Builder":http://m.onkey.org/
|
231
|
+
* "Ruby on Rack #1 - Hello Rack!":http://m.onkey.org/ruby-on-rack-1-hello-rack
|
232
|
+
* "Ruby on Rack #2 - The Builder":http://m.onkey.org/ruby-on-rack-2-the-builder
|
233
233
|
|
234
234
|
h4. Understanding Middlewares
|
235
235
|
|
@@ -247,8 +247,7 @@ h4. Running Tests
|
|
247
247
|
Running a test is as simple as invoking the file containing the test cases through Ruby:
|
248
248
|
|
249
249
|
<shell>
|
250
|
-
$
|
251
|
-
$ ruby unit/post_test.rb
|
250
|
+
$ ruby -Itest test/unit/post_test.rb
|
252
251
|
|
253
252
|
Loaded suite unit/post_test
|
254
253
|
Started
|
@@ -258,12 +257,12 @@ Finished in 0.023513 seconds.
|
|
258
257
|
1 tests, 1 assertions, 0 failures, 0 errors
|
259
258
|
</shell>
|
260
259
|
|
261
|
-
This will run all the test methods from the test case.
|
260
|
+
This will run all the test methods from the test case. Note that +test_helper.rb+ is in the +test+ directory, hence this directory needs to be added to the load path using the +-I+ switch.
|
262
261
|
|
263
262
|
You can also run a particular test method from the test case by using the +-n+ switch with the +test method name+.
|
264
263
|
|
265
264
|
<shell>
|
266
|
-
$ ruby -Itest test/unit/post_test.rb -n
|
265
|
+
$ ruby -Itest test/unit/post_test.rb -n test_truth
|
267
266
|
|
268
267
|
Loaded suite unit/post_test
|
269
268
|
Started
|
data/lib/rails/application.rb
CHANGED
@@ -211,10 +211,12 @@ module Rails
|
|
211
211
|
end
|
212
212
|
|
213
213
|
def initialize_tasks
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
214
|
+
self.class.rake_tasks do
|
215
|
+
require "rails/tasks"
|
216
|
+
task :environment do
|
217
|
+
$rails_rake_task = true
|
218
|
+
require_environment!
|
219
|
+
end
|
218
220
|
end
|
219
221
|
end
|
220
222
|
|
@@ -47,6 +47,6 @@ module Rails
|
|
47
47
|
end
|
48
48
|
|
49
49
|
# Has to set the RAILS_ENV before config/application is required
|
50
|
-
if ARGV.first && !ARGV.first.index("-") && env = ARGV.
|
50
|
+
if ARGV.first && !ARGV.first.index("-") && env = ARGV.shift # has to shift the env ARGV so IRB doesn't freak
|
51
51
|
ENV['RAILS_ENV'] = %w(production development test).detect {|e| e =~ /^#{env}/} || env
|
52
52
|
end
|
@@ -405,6 +405,13 @@ module Rails
|
|
405
405
|
end
|
406
406
|
end
|
407
407
|
|
408
|
+
def version_constraint_for_database_gem
|
409
|
+
case options[:database]
|
410
|
+
when "mysql" then "~> 0.2.6"
|
411
|
+
else nil
|
412
|
+
end
|
413
|
+
end
|
414
|
+
|
408
415
|
def mysql_socket
|
409
416
|
@mysql_socket ||= [
|
410
417
|
"/tmp/mysql.sock", # default
|
@@ -12,7 +12,7 @@ gem 'rails', '<%= Rails::VERSION::STRING %>'
|
|
12
12
|
<%- end -%>
|
13
13
|
|
14
14
|
<% unless options[:skip_active_record] -%>
|
15
|
-
gem '<%= gem_for_database %>'
|
15
|
+
gem '<%= gem_for_database %>'<%= ", '#{version_constraint_for_database_gem}'" if version_constraint_for_database_gem %>
|
16
16
|
<% end -%>
|
17
17
|
|
18
18
|
# Use unicorn as the web server
|
data/lib/rails/railtie.rb
CHANGED
data/lib/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: railties
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 15424055
|
5
|
+
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
|
9
|
+
- 8
|
10
|
+
- rc
|
11
|
+
- 1
|
12
|
+
version: 3.0.8.rc1
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- David Heinemeier Hansson
|
@@ -15,7 +17,7 @@ autorequire:
|
|
15
17
|
bindir: bin
|
16
18
|
cert_chain: []
|
17
19
|
|
18
|
-
date: 2011-
|
20
|
+
date: 2011-05-25 00:00:00 Z
|
19
21
|
dependencies:
|
20
22
|
- !ruby/object:Gem::Dependency
|
21
23
|
name: rake
|
@@ -57,12 +59,14 @@ dependencies:
|
|
57
59
|
requirements:
|
58
60
|
- - "="
|
59
61
|
- !ruby/object:Gem::Version
|
60
|
-
hash:
|
62
|
+
hash: 15424055
|
61
63
|
segments:
|
62
64
|
- 3
|
63
65
|
- 0
|
64
|
-
-
|
65
|
-
|
66
|
+
- 8
|
67
|
+
- rc
|
68
|
+
- 1
|
69
|
+
version: 3.0.8.rc1
|
66
70
|
type: :runtime
|
67
71
|
version_requirements: *id003
|
68
72
|
- !ruby/object:Gem::Dependency
|
@@ -73,12 +77,14 @@ dependencies:
|
|
73
77
|
requirements:
|
74
78
|
- - "="
|
75
79
|
- !ruby/object:Gem::Version
|
76
|
-
hash:
|
80
|
+
hash: 15424055
|
77
81
|
segments:
|
78
82
|
- 3
|
79
83
|
- 0
|
80
|
-
-
|
81
|
-
|
84
|
+
- 8
|
85
|
+
- rc
|
86
|
+
- 1
|
87
|
+
version: 3.0.8.rc1
|
82
88
|
type: :runtime
|
83
89
|
version_requirements: *id004
|
84
90
|
description: "Rails internals: application bootup, plugins, generators, and rake tasks."
|
@@ -479,16 +485,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
479
485
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
480
486
|
none: false
|
481
487
|
requirements:
|
482
|
-
- - "
|
488
|
+
- - ">"
|
483
489
|
- !ruby/object:Gem::Version
|
484
|
-
hash:
|
490
|
+
hash: 25
|
485
491
|
segments:
|
486
|
-
-
|
487
|
-
|
492
|
+
- 1
|
493
|
+
- 3
|
494
|
+
- 1
|
495
|
+
version: 1.3.1
|
488
496
|
requirements: []
|
489
497
|
|
490
498
|
rubyforge_project: rails
|
491
|
-
rubygems_version: 1.
|
499
|
+
rubygems_version: 1.8.2
|
492
500
|
signing_key:
|
493
501
|
specification_version: 3
|
494
502
|
summary: Tools for creating, working with, and running Rails applications.
|