railties 3.0.0.beta4 → 3.0.0.rc
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +24 -6
- data/README.rdoc +25 -0
- data/guides/assets/javascripts/code_highlighter.js +0 -0
- data/guides/assets/javascripts/guides.js +0 -0
- data/guides/assets/stylesheets/print.css +0 -0
- data/guides/assets/stylesheets/reset.css +0 -0
- data/guides/assets/stylesheets/style.css +0 -0
- data/guides/source/3_0_release_notes.textile +5 -3
- data/guides/source/action_controller_overview.textile +19 -0
- data/guides/source/active_record_basics.textile +27 -21
- data/guides/source/active_record_querying.textile +39 -37
- data/guides/source/{activerecord_validations_callbacks.textile → active_record_validations_callbacks.textile} +30 -29
- data/guides/source/active_support_core_extensions.textile +232 -107
- data/guides/source/api_documentation_guidelines.textile +187 -0
- data/guides/source/association_basics.textile +45 -1
- data/guides/source/configuring.textile +7 -7
- data/guides/source/contributing_to_rails.textile +42 -15
- data/guides/source/form_helpers.textile +1 -1
- data/guides/source/generators.textile +37 -37
- data/guides/source/getting_started.textile +11 -11
- data/guides/source/i18n.textile +1 -1
- data/guides/source/index.html.erb +14 -6
- data/guides/source/initialization.textile +130 -124
- data/guides/source/layout.html.erb +5 -2
- data/guides/source/layouts_and_rendering.textile +2 -2
- data/guides/source/migrations.textile +4 -3
- data/guides/source/plugins.textile +15 -15
- data/guides/source/rails_application_templates.textile +2 -2
- data/guides/source/routing.textile +83 -62
- data/guides/source/security.textile +2 -2
- data/guides/w3c_validator.rb +30 -6
- data/lib/rails.rb +3 -3
- data/lib/rails/application.rb +43 -19
- data/lib/rails/application/bootstrap.rb +2 -0
- data/lib/rails/application/configuration.rb +3 -3
- data/lib/rails/application/finisher.rb +6 -6
- data/lib/rails/cli.rb +1 -19
- data/lib/rails/commands.rb +5 -5
- data/lib/rails/commands/application.rb +1 -1
- data/lib/rails/commands/console.rb +1 -4
- data/lib/rails/commands/generate.rb +0 -0
- data/lib/rails/commands/plugin.rb +57 -52
- data/lib/rails/commands/runner.rb +2 -1
- data/lib/rails/commands/server.rb +6 -2
- data/lib/rails/configuration.rb +2 -3
- data/lib/rails/console/app.rb +0 -2
- data/lib/rails/engine.rb +14 -15
- data/lib/rails/engine/configuration.rb +5 -5
- data/lib/rails/generators.rb +2 -3
- data/lib/rails/generators/actions.rb +4 -4
- data/lib/rails/generators/base.rb +1 -1
- data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +1 -6
- data/lib/rails/generators/erb/scaffold/templates/_form.html.erb +4 -4
- data/lib/rails/generators/erb/scaffold/templates/edit.html.erb +3 -3
- data/lib/rails/generators/erb/scaffold/templates/index.html.erb +7 -7
- data/lib/rails/generators/erb/scaffold/templates/new.html.erb +2 -2
- data/lib/rails/generators/erb/scaffold/templates/show.html.erb +3 -3
- data/lib/rails/generators/generated_attribute.rb +2 -1
- data/lib/rails/generators/named_base.rb +24 -0
- data/lib/rails/generators/rails/app/app_generator.rb +10 -9
- data/lib/rails/generators/rails/app/templates/Gemfile +4 -3
- data/lib/rails/generators/rails/app/templates/README +6 -31
- data/lib/rails/generators/rails/app/templates/Rakefile +1 -1
- data/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb +0 -1
- data/lib/rails/generators/rails/app/templates/app/mailers/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/config/application.rb +11 -11
- data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml +36 -24
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml +1 -1
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +3 -0
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +3 -0
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +3 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb +1 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/secret_token.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/routes.rb +1 -1
- data/lib/rails/generators/rails/app/templates/public/index.html +0 -17
- data/lib/rails/generators/rails/app/templates/public/javascripts/prototype.js +2027 -900
- data/lib/rails/generators/rails/app/templates/public/javascripts/rails.js +114 -57
- data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +1 -1
- data/lib/rails/generators/rails/model/USAGE +1 -1
- data/lib/rails/generators/rails/resource/resource_generator.rb +4 -14
- data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +0 -2
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +28 -30
- data/lib/rails/generators/resource_helpers.rb +1 -1
- data/lib/rails/generators/test_case.rb +25 -11
- data/lib/rails/generators/test_unit/model/model_generator.rb +1 -1
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +0 -1
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb +13 -15
- data/lib/rails/info.rb +1 -2
- data/lib/rails/info_routes.rb +1 -1
- data/lib/rails/initializable.rb +3 -16
- data/lib/rails/paths.rb +31 -36
- data/lib/rails/plugin.rb +10 -6
- data/lib/rails/rack/logger.rb +11 -13
- data/lib/rails/railtie.rb +14 -42
- data/lib/rails/ruby_version_check.rb +19 -5
- data/lib/rails/script_rails_loader.rb +29 -0
- data/lib/rails/tasks/annotations.rake +2 -2
- data/lib/rails/tasks/documentation.rake +47 -16
- data/lib/rails/tasks/framework.rake +9 -9
- data/lib/rails/tasks/middleware.rake +1 -1
- data/lib/rails/tasks/misc.rake +5 -5
- data/lib/rails/tasks/routes.rake +1 -1
- data/lib/rails/tasks/tmp.rake +5 -5
- data/lib/rails/test_unit/testing.rake +38 -14
- data/lib/rails/version.rb +1 -1
- metadata +29 -17
- data/README +0 -281
- data/lib/rails/application/routes_reloader.rb +0 -46
- data/lib/rails/log_subscriber.rb +0 -115
- data/lib/rails/log_subscriber/test_helper.rb +0 -97
- data/lib/rails/webrick_server.rb +0 -156
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: railties
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 7712042
|
4
5
|
prerelease: true
|
5
6
|
segments:
|
6
7
|
- 3
|
7
8
|
- 0
|
8
9
|
- 0
|
9
|
-
-
|
10
|
-
version: 3.0.0.
|
10
|
+
- rc
|
11
|
+
version: 3.0.0.rc
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- David Heinemeier Hansson
|
@@ -15,16 +16,18 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2010-
|
19
|
+
date: 2010-07-26 00:00:00 -05:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
23
|
name: rake
|
23
24
|
prerelease: false
|
24
25
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
25
27
|
requirements:
|
26
28
|
- - ">="
|
27
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 57
|
28
31
|
segments:
|
29
32
|
- 0
|
30
33
|
- 8
|
@@ -36,44 +39,50 @@ dependencies:
|
|
36
39
|
name: thor
|
37
40
|
prerelease: false
|
38
41
|
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
39
43
|
requirements:
|
40
44
|
- - ~>
|
41
45
|
- !ruby/object:Gem::Version
|
46
|
+
hash: 39
|
42
47
|
segments:
|
43
48
|
- 0
|
44
|
-
-
|
45
|
-
-
|
46
|
-
version: 0.
|
49
|
+
- 14
|
50
|
+
- 0
|
51
|
+
version: 0.14.0
|
47
52
|
type: :runtime
|
48
53
|
version_requirements: *id002
|
49
54
|
- !ruby/object:Gem::Dependency
|
50
55
|
name: activesupport
|
51
56
|
prerelease: false
|
52
57
|
requirement: &id003 !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
53
59
|
requirements:
|
54
60
|
- - "="
|
55
61
|
- !ruby/object:Gem::Version
|
62
|
+
hash: 7712042
|
56
63
|
segments:
|
57
64
|
- 3
|
58
65
|
- 0
|
59
66
|
- 0
|
60
|
-
-
|
61
|
-
version: 3.0.0.
|
67
|
+
- rc
|
68
|
+
version: 3.0.0.rc
|
62
69
|
type: :runtime
|
63
70
|
version_requirements: *id003
|
64
71
|
- !ruby/object:Gem::Dependency
|
65
72
|
name: actionpack
|
66
73
|
prerelease: false
|
67
74
|
requirement: &id004 !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
68
76
|
requirements:
|
69
77
|
- - "="
|
70
78
|
- !ruby/object:Gem::Version
|
79
|
+
hash: 7712042
|
71
80
|
segments:
|
72
81
|
- 3
|
73
82
|
- 0
|
74
83
|
- 0
|
75
|
-
-
|
76
|
-
version: 3.0.0.
|
84
|
+
- rc
|
85
|
+
version: 3.0.0.rc
|
77
86
|
type: :runtime
|
78
87
|
version_requirements: *id004
|
79
88
|
description: "Rails internals: application bootup, plugins, generators, and rake tasks."
|
@@ -86,7 +95,7 @@ extra_rdoc_files: []
|
|
86
95
|
|
87
96
|
files:
|
88
97
|
- CHANGELOG
|
89
|
-
- README
|
98
|
+
- README.rdoc
|
90
99
|
- guides/assets/images/belongs_to.png
|
91
100
|
- guides/assets/images/book_icon.gif
|
92
101
|
- guides/assets/images/bullet.gif
|
@@ -177,9 +186,10 @@ files:
|
|
177
186
|
- guides/source/action_view_overview.textile
|
178
187
|
- guides/source/active_record_basics.textile
|
179
188
|
- guides/source/active_record_querying.textile
|
189
|
+
- guides/source/active_record_validations_callbacks.textile
|
180
190
|
- guides/source/active_support_core_extensions.textile
|
181
|
-
- guides/source/activerecord_validations_callbacks.textile
|
182
191
|
- guides/source/ajax_on_rails.textile
|
192
|
+
- guides/source/api_documentation_guidelines.textile
|
183
193
|
- guides/source/association_basics.textile
|
184
194
|
- guides/source/caching_with_rails.textile
|
185
195
|
- guides/source/command_line.textile
|
@@ -212,7 +222,6 @@ files:
|
|
212
222
|
- lib/rails/application/configuration.rb
|
213
223
|
- lib/rails/application/finisher.rb
|
214
224
|
- lib/rails/application/railties.rb
|
215
|
-
- lib/rails/application/routes_reloader.rb
|
216
225
|
- lib/rails/application.rb
|
217
226
|
- lib/rails/backtrace_cleaner.rb
|
218
227
|
- lib/rails/cli.rb
|
@@ -371,8 +380,6 @@ files:
|
|
371
380
|
- lib/rails/info_controller.rb
|
372
381
|
- lib/rails/info_routes.rb
|
373
382
|
- lib/rails/initializable.rb
|
374
|
-
- lib/rails/log_subscriber/test_helper.rb
|
375
|
-
- lib/rails/log_subscriber.rb
|
376
383
|
- lib/rails/paths.rb
|
377
384
|
- lib/rails/performance_test_help.rb
|
378
385
|
- lib/rails/plugin.rb
|
@@ -386,6 +393,7 @@ files:
|
|
386
393
|
- lib/rails/railtie.rb
|
387
394
|
- lib/rails/ruby_version_check.rb
|
388
395
|
- lib/rails/rubyprof_ext.rb
|
396
|
+
- lib/rails/script_rails_loader.rb
|
389
397
|
- lib/rails/source_annotation_extractor.rb
|
390
398
|
- lib/rails/tasks/annotations.rake
|
391
399
|
- lib/rails/tasks/documentation.rake
|
@@ -401,8 +409,8 @@ files:
|
|
401
409
|
- lib/rails/test_unit/railtie.rb
|
402
410
|
- lib/rails/test_unit/testing.rake
|
403
411
|
- lib/rails/version.rb
|
404
|
-
- lib/rails/webrick_server.rb
|
405
412
|
- lib/rails.rb
|
413
|
+
- lib/rails/generators/rails/app/templates/app/mailers/.empty_directory
|
406
414
|
- lib/rails/generators/rails/app/templates/app/models/.empty_directory
|
407
415
|
- lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory
|
408
416
|
- lib/rails/generators/rails/app/templates/test/fixtures/.empty_directory
|
@@ -421,18 +429,22 @@ rdoc_options:
|
|
421
429
|
require_paths:
|
422
430
|
- lib
|
423
431
|
required_ruby_version: !ruby/object:Gem::Requirement
|
432
|
+
none: false
|
424
433
|
requirements:
|
425
434
|
- - ">="
|
426
435
|
- !ruby/object:Gem::Version
|
436
|
+
hash: 57
|
427
437
|
segments:
|
428
438
|
- 1
|
429
439
|
- 8
|
430
440
|
- 7
|
431
441
|
version: 1.8.7
|
432
442
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
443
|
+
none: false
|
433
444
|
requirements:
|
434
445
|
- - ">"
|
435
446
|
- !ruby/object:Gem::Version
|
447
|
+
hash: 25
|
436
448
|
segments:
|
437
449
|
- 1
|
438
450
|
- 3
|
@@ -441,7 +453,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
441
453
|
requirements: []
|
442
454
|
|
443
455
|
rubyforge_project: rails
|
444
|
-
rubygems_version: 1.3.
|
456
|
+
rubygems_version: 1.3.7
|
445
457
|
signing_key:
|
446
458
|
specification_version: 3
|
447
459
|
summary: Tools for creating, working with, and running Rails applications.
|
data/README
DELETED
@@ -1,281 +0,0 @@
|
|
1
|
-
== Welcome to Rails
|
2
|
-
|
3
|
-
Rails is a web-application framework that includes everything needed to create
|
4
|
-
database-backed web applications according to the Model-View-Control pattern.
|
5
|
-
|
6
|
-
This pattern splits the view (also called the presentation) into "dumb"
|
7
|
-
templates that are primarily responsible for inserting pre-built data in between
|
8
|
-
HTML tags. The model contains the "smart" domain objects (such as Account,
|
9
|
-
Product, Person, Post) that holds all the business logic and knows how to
|
10
|
-
persist themselves to a database. The controller handles the incoming requests
|
11
|
-
(such as Save New Account, Update Product, Show Post) by manipulating the model
|
12
|
-
and directing data to the view.
|
13
|
-
|
14
|
-
In Rails, the model is handled by what's called an object-relational mapping
|
15
|
-
layer entitled Active Record. This layer allows you to present the data from
|
16
|
-
database rows as objects and embellish these data objects with business logic
|
17
|
-
methods. You can read more about Active Record in
|
18
|
-
link:files/vendor/rails/activerecord/README.html.
|
19
|
-
|
20
|
-
The controller and view are handled by the Action Pack, which handles both
|
21
|
-
layers by its two parts: Action View and Action Controller. These two layers
|
22
|
-
are bundled in a single package due to their heavy interdependence. This is
|
23
|
-
unlike the relationship between the Active Record and Action Pack that is much
|
24
|
-
more separate. Each of these packages can be used independently outside of
|
25
|
-
Rails. You can read more about Action Pack in
|
26
|
-
link:files/vendor/rails/actionpack/README.html.
|
27
|
-
|
28
|
-
|
29
|
-
== Getting Started
|
30
|
-
|
31
|
-
1. At the command prompt, create a new Rails application:
|
32
|
-
<tt>rails myapp</tt> (where <tt>myapp</tt> is the application name)
|
33
|
-
|
34
|
-
2. Change directory to <tt>myapp</tt> and start the web server:
|
35
|
-
<tt>cd myapp; rails server</tt> (run with --help for options)
|
36
|
-
|
37
|
-
3. Go to http://localhost:3000/ and you'll see:
|
38
|
-
"Welcome aboard: You're riding the Rails!"
|
39
|
-
|
40
|
-
4. Follow the guidelines to start developing your application. You can find
|
41
|
-
the following resources handy:
|
42
|
-
|
43
|
-
* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
|
44
|
-
* Ruby on Rails Tutorial Book: http://www.railstutorial.org/
|
45
|
-
|
46
|
-
|
47
|
-
== Web Servers
|
48
|
-
|
49
|
-
By default, Rails will try to use Mongrel if it's installed when started with
|
50
|
-
<tt>rails server</tt>, otherwise Rails will use WEBrick, the web server that
|
51
|
-
ships with Ruby.
|
52
|
-
|
53
|
-
Mongrel is a Ruby-based web server with a C component (which requires
|
54
|
-
compilation) that is suitable for development. If you have Ruby Gems installed,
|
55
|
-
getting up and running with mongrel is as easy as:
|
56
|
-
<tt>sudo gem install mongrel</tt>.
|
57
|
-
|
58
|
-
You can find more info at: http://mongrel.rubyforge.org
|
59
|
-
|
60
|
-
You can alternatively run Rails applications with other Ruby web servers, e.g.,
|
61
|
-
{Thin}[http://code.macournoyer.com/thin/], {Ebb}[http://ebb.rubyforge.org/], and
|
62
|
-
Apache with {mod_rails}[http://www.modrails.com/]. However, <tt>rails server</tt>
|
63
|
-
doesn't search for or start them.
|
64
|
-
|
65
|
-
For production use, often a web/proxy server, e.g., {Apache}[http://apache.org],
|
66
|
-
{Nginx}[http://nginx.net/], {LiteSpeed}[http://litespeedtech.com/],
|
67
|
-
{Lighttpd}[http://www.lighttpd.net/], or {IIS}[http://www.iis.net/], is deployed
|
68
|
-
as the front end server with the chosen Ruby web server running in the back end
|
69
|
-
and receiving the proxied requests via one of several protocols (HTTP, CGI, FCGI).
|
70
|
-
|
71
|
-
|
72
|
-
== Debugging Rails
|
73
|
-
|
74
|
-
Sometimes your application goes wrong. Fortunately there are a lot of tools that
|
75
|
-
will help you debug it and get it back on the rails.
|
76
|
-
|
77
|
-
First area to check is the application log files. Have "tail -f" commands
|
78
|
-
running on the server.log and development.log. Rails will automatically display
|
79
|
-
debugging and runtime information to these files. Debugging info will also be
|
80
|
-
shown in the browser on requests from 127.0.0.1.
|
81
|
-
|
82
|
-
You can also log your own messages directly into the log file from your code
|
83
|
-
using the Ruby logger class from inside your controllers. Example:
|
84
|
-
|
85
|
-
class WeblogController < ActionController::Base
|
86
|
-
def destroy
|
87
|
-
@weblog = Weblog.find(params[:id])
|
88
|
-
@weblog.destroy
|
89
|
-
logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
The result will be a message in your log file along the lines of:
|
94
|
-
|
95
|
-
Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
|
96
|
-
|
97
|
-
More information on how to use the logger is at http://www.ruby-doc.org/core/
|
98
|
-
|
99
|
-
Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
|
100
|
-
several books available online as well:
|
101
|
-
|
102
|
-
* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
|
103
|
-
* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
|
104
|
-
|
105
|
-
These two books will bring you up to speed on the Ruby language and also on
|
106
|
-
programming in general.
|
107
|
-
|
108
|
-
|
109
|
-
== Debugger
|
110
|
-
|
111
|
-
Debugger support is available through the debugger command when you start your
|
112
|
-
Mongrel or WEBrick server with --debugger. This means that you can break out of
|
113
|
-
execution at any point in the code, investigate and change the model, and then,
|
114
|
-
resume execution! You need to install ruby-debug to run the server in debugging
|
115
|
-
mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
|
116
|
-
|
117
|
-
class WeblogController < ActionController::Base
|
118
|
-
def index
|
119
|
-
@posts = Post.find(:all)
|
120
|
-
debugger
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
So the controller will accept the action, run the first line, then present you
|
125
|
-
with a IRB prompt in the server window. Here you can do things like:
|
126
|
-
|
127
|
-
>> @posts.inspect
|
128
|
-
=> "[#<Post:0x14a6be8
|
129
|
-
@attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
|
130
|
-
#<Post:0x14a6620
|
131
|
-
@attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
|
132
|
-
>> @posts.first.title = "hello from a debugger"
|
133
|
-
=> "hello from a debugger"
|
134
|
-
|
135
|
-
...and even better, you can examine how your runtime objects actually work:
|
136
|
-
|
137
|
-
>> f = @posts.first
|
138
|
-
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
|
139
|
-
>> f.
|
140
|
-
Display all 152 possibilities? (y or n)
|
141
|
-
|
142
|
-
Finally, when you're ready to resume execution, you can enter "cont".
|
143
|
-
|
144
|
-
|
145
|
-
== Console
|
146
|
-
|
147
|
-
The console is a Ruby shell, which allows you to interact with your
|
148
|
-
application's domain model. Here you'll have all parts of the application
|
149
|
-
configured, just like it is when the application is running. You can inspect
|
150
|
-
domain models, change values, and save to the database. Starting the script
|
151
|
-
without arguments will launch it in the development environment.
|
152
|
-
|
153
|
-
To start the console, run <tt>rails console</tt> from the application
|
154
|
-
directory.
|
155
|
-
|
156
|
-
Options:
|
157
|
-
|
158
|
-
* Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
|
159
|
-
made to the database.
|
160
|
-
* Passing an environment name as an argument will load the corresponding
|
161
|
-
environment. Example: <tt>rails console production</tt>.
|
162
|
-
|
163
|
-
To reload your controllers and models after launching the console run
|
164
|
-
<tt>reload!</tt>
|
165
|
-
|
166
|
-
More information about irb can be found at:
|
167
|
-
link:http://www.rubycentral.com/pickaxe/irb.html
|
168
|
-
|
169
|
-
|
170
|
-
== dbconsole
|
171
|
-
|
172
|
-
You can go to the command line of your database directly through <tt>rails
|
173
|
-
dbconsole</tt>. You would be connected to the database with the credentials
|
174
|
-
defined in database.yml. Starting the script without arguments will connect you
|
175
|
-
to the development database. Passing an argument will connect you to a different
|
176
|
-
database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
|
177
|
-
PostgreSQL and SQLite 3.
|
178
|
-
|
179
|
-
== Description of Contents
|
180
|
-
|
181
|
-
The default directory structure of a generated Ruby on Rails application:
|
182
|
-
|
183
|
-
|-- app
|
184
|
-
| |-- controllers
|
185
|
-
| |-- helpers
|
186
|
-
| |-- models
|
187
|
-
| `-- views
|
188
|
-
| `-- layouts
|
189
|
-
|-- config
|
190
|
-
| |-- environments
|
191
|
-
| |-- initializers
|
192
|
-
| `-- locales
|
193
|
-
|-- db
|
194
|
-
|-- doc
|
195
|
-
|-- lib
|
196
|
-
| `-- tasks
|
197
|
-
|-- log
|
198
|
-
|-- public
|
199
|
-
| |-- images
|
200
|
-
| |-- javascripts
|
201
|
-
| `-- stylesheets
|
202
|
-
|-- script
|
203
|
-
| `-- performance
|
204
|
-
|-- test
|
205
|
-
| |-- fixtures
|
206
|
-
| |-- functional
|
207
|
-
| |-- integration
|
208
|
-
| |-- performance
|
209
|
-
| `-- unit
|
210
|
-
|-- tmp
|
211
|
-
| |-- cache
|
212
|
-
| |-- pids
|
213
|
-
| |-- sessions
|
214
|
-
| `-- sockets
|
215
|
-
`-- vendor
|
216
|
-
`-- plugins
|
217
|
-
|
218
|
-
app
|
219
|
-
Holds all the code that's specific to this particular application.
|
220
|
-
|
221
|
-
app/controllers
|
222
|
-
Holds controllers that should be named like weblogs_controller.rb for
|
223
|
-
automated URL mapping. All controllers should descend from
|
224
|
-
ApplicationController which itself descends from ActionController::Base.
|
225
|
-
|
226
|
-
app/models
|
227
|
-
Holds models that should be named like post.rb. Models descend from
|
228
|
-
ActiveRecord::Base by default.
|
229
|
-
|
230
|
-
app/views
|
231
|
-
Holds the template files for the view that should be named like
|
232
|
-
weblogs/index.html.erb for the WeblogsController#index action. All views use
|
233
|
-
eRuby syntax by default.
|
234
|
-
|
235
|
-
app/views/layouts
|
236
|
-
Holds the template files for layouts to be used with views. This models the
|
237
|
-
common header/footer method of wrapping views. In your views, define a layout
|
238
|
-
using the <tt>layout :default</tt> and create a file named default.html.erb.
|
239
|
-
Inside default.html.erb, call <% yield %> to render the view using this
|
240
|
-
layout.
|
241
|
-
|
242
|
-
app/helpers
|
243
|
-
Holds view helpers that should be named like weblogs_helper.rb. These are
|
244
|
-
generated for you automatically when using generators for controllers.
|
245
|
-
Helpers can be used to wrap functionality for your views into methods.
|
246
|
-
|
247
|
-
config
|
248
|
-
Configuration files for the Rails environment, the routing map, the database,
|
249
|
-
and other dependencies.
|
250
|
-
|
251
|
-
db
|
252
|
-
Contains the database schema in schema.rb. db/migrate contains all the
|
253
|
-
sequence of Migrations for your schema.
|
254
|
-
|
255
|
-
doc
|
256
|
-
This directory is where your application documentation will be stored when
|
257
|
-
generated using <tt>rake doc:app</tt>
|
258
|
-
|
259
|
-
lib
|
260
|
-
Application specific libraries. Basically, any kind of custom code that
|
261
|
-
doesn't belong under controllers, models, or helpers. This directory is in
|
262
|
-
the load path.
|
263
|
-
|
264
|
-
public
|
265
|
-
The directory available for the web server. Contains subdirectories for
|
266
|
-
images, stylesheets, and javascripts. Also contains the dispatchers and the
|
267
|
-
default HTML files. This should be set as the DOCUMENT_ROOT of your web
|
268
|
-
server.
|
269
|
-
|
270
|
-
script
|
271
|
-
Helper scripts for automation and generation.
|
272
|
-
|
273
|
-
test
|
274
|
-
Unit and functional tests along with fixtures. When using the rails generate
|
275
|
-
command, template test files will be generated for you and placed in this
|
276
|
-
directory.
|
277
|
-
|
278
|
-
vendor
|
279
|
-
External libraries that the application depends on. Also includes the plugins
|
280
|
-
subdirectory. If the app has frozen rails, those gems also go here, under
|
281
|
-
vendor/rails/. This directory is in the load path.
|