crashlog 1.0.7 → 1.1.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/.travis.yml +19 -8
  2. data/Appraisals +25 -0
  3. data/Gemfile +4 -4
  4. data/Gemfile.lock +54 -13
  5. data/README.md +1 -1
  6. data/Rakefile +4 -0
  7. data/gemfiles/rails_2_3.gemfile +17 -0
  8. data/gemfiles/rails_2_3.gemfile.lock +111 -0
  9. data/gemfiles/rails_3_0.gemfile +17 -0
  10. data/gemfiles/rails_3_0.gemfile.lock +159 -0
  11. data/gemfiles/rails_3_1.gemfile +17 -0
  12. data/gemfiles/rails_3_1.gemfile.lock +169 -0
  13. data/gemfiles/rails_3_2.gemfile +17 -0
  14. data/gemfiles/rails_3_2.gemfile.lock +168 -0
  15. data/lib/crash_log.rb +2 -0
  16. data/lib/crash_log/payload.rb +2 -1
  17. data/lib/crash_log/rails/controller_methods.rb +98 -18
  18. data/lib/crash_log/rails/middleware/debug_exception_catcher.rb +6 -4
  19. data/lib/crash_log/railtie.rb +5 -4
  20. data/lib/crash_log/reporter.rb +4 -4
  21. data/lib/crash_log/sidekiq.rb +18 -0
  22. data/lib/crash_log/version.rb +1 -1
  23. data/spec/crash_log/initializer_spec.rb +39 -39
  24. data/spec/crash_log/payload_spec.rb +2 -0
  25. data/spec/dummy_rails_2/README +243 -0
  26. data/spec/dummy_rails_2/Rakefile +10 -0
  27. data/spec/dummy_rails_2/app/controllers/application_controller.rb +14 -0
  28. data/spec/dummy_rails_2/app/controllers/welcome_controller.rb +13 -0
  29. data/spec/dummy_rails_2/app/helpers/application_helper.rb +3 -0
  30. data/spec/dummy_rails_2/app/helpers/welcome_helper.rb +3 -0
  31. data/spec/dummy_rails_2/app/models/user.rb +2 -0
  32. data/spec/dummy_rails_2/config/boot.rb +114 -0
  33. data/spec/dummy_rails_2/config/environment.rb +41 -0
  34. data/spec/dummy_rails_2/config/environments/test.rb +28 -0
  35. data/spec/dummy_rails_2/config/initializers/backtrace_silencers.rb +7 -0
  36. data/spec/dummy_rails_2/config/initializers/cookie_verification_secret.rb +7 -0
  37. data/spec/{dummy → dummy_rails_2}/config/initializers/crashlog.rb +0 -0
  38. data/spec/dummy_rails_2/config/initializers/inflections.rb +10 -0
  39. data/spec/{dummy → dummy_rails_2}/config/initializers/mime_types.rb +0 -0
  40. data/spec/dummy_rails_2/config/initializers/new_rails_defaults.rb +13 -0
  41. data/spec/dummy_rails_2/config/initializers/session_store.rb +15 -0
  42. data/spec/dummy_rails_2/config/locales/en.yml +5 -0
  43. data/spec/dummy_rails_2/config/routes.rb +38 -0
  44. data/spec/dummy_rails_2/db/seeds.rb +7 -0
  45. data/spec/{dummy/app/mailers/.gitkeep → dummy_rails_2/log/development.log} +0 -0
  46. data/spec/{dummy/app/models/.gitkeep → dummy_rails_2/log/production.log} +0 -0
  47. data/spec/{dummy/lib/assets/.gitkeep → dummy_rails_2/log/server.log} +0 -0
  48. data/spec/dummy_rails_3/.gitignore +4 -0
  49. data/spec/dummy_rails_3/Gemfile +31 -0
  50. data/spec/dummy_rails_3/README +256 -0
  51. data/spec/dummy_rails_3/Rakefile +7 -0
  52. data/spec/dummy_rails_3/app/controllers/application_controller.rb +7 -0
  53. data/spec/dummy_rails_3/app/controllers/welcome_controller.rb +14 -0
  54. data/spec/{dummy → dummy_rails_3}/app/helpers/application_helper.rb +0 -0
  55. data/spec/dummy_rails_3/app/models/user.rb +3 -0
  56. data/spec/dummy_rails_3/app/views/layouts/application.html.erb +14 -0
  57. data/spec/{dummy → dummy_rails_3}/config.ru +0 -0
  58. data/spec/dummy_rails_3/config/application.rb +52 -0
  59. data/spec/dummy_rails_3/config/boot.rb +6 -0
  60. data/spec/{dummy → dummy_rails_3}/config/environment.rb +0 -0
  61. data/spec/dummy_rails_3/config/environments/development.rb +26 -0
  62. data/spec/dummy_rails_3/config/environments/production.rb +49 -0
  63. data/spec/dummy_rails_3/config/environments/test.rb +35 -0
  64. data/spec/{dummy → dummy_rails_3}/config/initializers/backtrace_silencers.rb +0 -0
  65. data/spec/dummy_rails_3/config/initializers/crashlog.rb +8 -0
  66. data/spec/dummy_rails_3/config/initializers/inflections.rb +10 -0
  67. data/spec/dummy_rails_3/config/initializers/mime_types.rb +5 -0
  68. data/spec/dummy_rails_3/config/initializers/secret_token.rb +7 -0
  69. data/spec/{dummy → dummy_rails_3}/config/initializers/session_store.rb +0 -0
  70. data/spec/dummy_rails_3/config/locales/en.yml +5 -0
  71. data/spec/dummy_rails_3/config/routes.rb +5 -0
  72. data/spec/dummy_rails_3/db/seeds.rb +7 -0
  73. data/spec/{dummy → dummy_rails_3_plus}/README.rdoc +0 -0
  74. data/spec/{dummy → dummy_rails_3_plus}/Rakefile +0 -0
  75. data/spec/{dummy → dummy_rails_3_plus}/app/assets/javascripts/application.js +0 -0
  76. data/spec/{dummy → dummy_rails_3_plus}/app/assets/stylesheets/application.css +0 -0
  77. data/spec/dummy_rails_3_plus/app/controllers/application_controller.rb +7 -0
  78. data/spec/{dummy → dummy_rails_3_plus}/app/controllers/break_controller.rb +0 -0
  79. data/spec/dummy_rails_3_plus/app/controllers/welcome_controller.rb +13 -0
  80. data/spec/dummy_rails_3_plus/app/helpers/application_helper.rb +2 -0
  81. data/spec/{dummy/log → dummy_rails_3_plus/app/mailers}/.gitkeep +0 -0
  82. data/spec/{dummy/public/favicon.ico → dummy_rails_3_plus/app/models/.gitkeep} +0 -0
  83. data/spec/{dummy → dummy_rails_3_plus}/app/models/current_user.rb +0 -0
  84. data/spec/{dummy → dummy_rails_3_plus}/app/views/layouts/application.html.erb +0 -0
  85. data/spec/dummy_rails_3_plus/config.ru +4 -0
  86. data/spec/{dummy → dummy_rails_3_plus}/config/application.rb +3 -3
  87. data/spec/{dummy → dummy_rails_3_plus}/config/boot.rb +0 -0
  88. data/spec/dummy_rails_3_plus/config/environment.rb +5 -0
  89. data/spec/{dummy → dummy_rails_3_plus}/config/environments/development.rb +0 -0
  90. data/spec/{dummy → dummy_rails_3_plus}/config/environments/production.rb +0 -0
  91. data/spec/{dummy → dummy_rails_3_plus}/config/environments/test.rb +2 -2
  92. data/spec/dummy_rails_3_plus/config/initializers/backtrace_silencers.rb +7 -0
  93. data/spec/dummy_rails_3_plus/config/initializers/crashlog.rb +7 -0
  94. data/spec/{dummy → dummy_rails_3_plus}/config/initializers/inflections.rb +0 -0
  95. data/spec/dummy_rails_3_plus/config/initializers/mime_types.rb +5 -0
  96. data/spec/{dummy → dummy_rails_3_plus}/config/initializers/secret_token.rb +0 -0
  97. data/spec/dummy_rails_3_plus/config/initializers/session_store.rb +8 -0
  98. data/spec/{dummy → dummy_rails_3_plus}/config/initializers/wrap_parameters.rb +0 -0
  99. data/spec/dummy_rails_3_plus/config/routes.rb +5 -0
  100. data/spec/dummy_rails_3_plus/lib/assets/.gitkeep +0 -0
  101. data/spec/dummy_rails_3_plus/log/.gitkeep +0 -0
  102. data/spec/dummy_rails_3_plus/log/development.log +13209 -0
  103. data/spec/{dummy → dummy_rails_3_plus}/public/404.html +0 -0
  104. data/spec/{dummy → dummy_rails_3_plus}/public/422.html +0 -0
  105. data/spec/{dummy → dummy_rails_3_plus}/public/500.html +0 -0
  106. data/spec/dummy_rails_3_plus/public/favicon.ico +0 -0
  107. data/spec/{dummy → dummy_rails_3_plus}/script/rails +0 -0
  108. data/spec/rails/action_controller_spec.rb +85 -0
  109. data/spec/rails/rails_2_controller_spec.rb +87 -0
  110. data/spec/rails_spec_helper.rb +42 -0
  111. data/spec/requests/rails_controller_rescue_spec.rb +6 -6
  112. data/spec/spec_helper.rb +0 -4
  113. metadata +204 -87
  114. data/spec/dummy/app/controllers/application_controller.rb +0 -3
  115. data/spec/dummy/config/database.yml +0 -44
  116. data/spec/dummy/config/routes.rb +0 -7
@@ -19,9 +19,11 @@ module CrashLog
19
19
  end
20
20
 
21
21
  rescue Exception => e
22
+ raise e if CrashLog.config.development_mode.eql?(true)
22
23
  # If it breaks here there is possibly something wrong with us, so
23
24
  # instead of crashing again, we'll just pass it on.
24
25
  end
26
+
25
27
  render_exception_without_crash_log(env, exception)
26
28
  end
27
29
 
@@ -29,13 +31,13 @@ module CrashLog
29
31
 
30
32
  def crash_log_context(controller, env)
31
33
  if controller.respond_to?(:crash_log_context)
32
- controller.crash_log_context
34
+ controller.crash_log_context(env)
33
35
  else
34
- {:rack_env => env}
36
+ {}
35
37
  end
36
38
 
37
- rescue => e
38
- {:failed_context => true}
39
+ # rescue => e
40
+ # {}
39
41
  end
40
42
 
41
43
  end
@@ -17,12 +17,12 @@ module CrashLog
17
17
 
18
18
  config.after_initialize do
19
19
  CrashLog.configure(true) do |config|
20
- config.params_filters += Rails.configuration.filter_parameters
21
- config.logger = ::Rails.logger
20
+ config.params_filters += ::Rails.application.config.filter_parameters
21
+ config.logger = ::Rails.logger
22
22
  end
23
23
 
24
24
  # Attach our Rails Controller methods
25
- if defined?(::ActionController::Base)
25
+ if defined?(::ActionController::Metal)
26
26
  require "crash_log/rails/controller_methods"
27
27
  ::ActionController::Base.send(:include, CrashLog::Rails::ControllerMethods)
28
28
  end
@@ -33,10 +33,11 @@ module CrashLog
33
33
  ::ActionDispatch::DebugExceptions.__send__(:include, CrashLog::Rails::Middleware::DebugExceptionCatcher)
34
34
  elsif defined?(::ActionDispatch::ShowExceptions)
35
35
 
36
+
36
37
  # ActionDispatch::DebugExceptions is not defined in Rails 3.0.x and 3.1.x so
37
38
  # catch the exceptions in ShowExceptions.
38
39
  require 'crash_log/rails/middleware/debug_exception_catcher'
39
- ::ActionDispatch::ShowExceptions.send(:include, CrashLog::Rails::Middleware::DebugExceptionCatcher)
40
+ ::ActionDispatch::ShowExceptions.__send__(:include, CrashLog::Rails::Middleware::DebugExceptionCatcher)
40
41
  end
41
42
  end
42
43
 
@@ -132,12 +132,12 @@ module CrashLog
132
132
  end
133
133
 
134
134
  def decode(string, options = {})
135
- if MultiJson.respond_to?(:load)
136
- # MultiJson >= 1.3
137
- MultiJson.load(string, options)
138
- elsif MultiJson.respond_to?(:decode)
135
+ if MultiJson.respond_to?(:decode)
139
136
  # MultiJson < 1.3
140
137
  MultiJson.decode(string, options)
138
+ elsif MultiJson.respond_to?(:load)
139
+ # MultiJson >= 1.3
140
+ MultiJson.load(string, options)
141
141
  end
142
142
  end
143
143
  end
@@ -0,0 +1,18 @@
1
+ module CrashLog
2
+ class Sidekiq
3
+ def call(worker, msg, queue)
4
+ begin
5
+ yield
6
+ rescue => ex
7
+ CrashLog.notify_or_ignore(ex, :context => {:sidekiq => msg })
8
+ raise
9
+ end
10
+ end
11
+ end
12
+ end
13
+
14
+ ::Sidekiq.configure_server do |config|
15
+ config.server_middleware do |chain|
16
+ chain.add ::CrashLog::Sidekiq
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module CrashLog
2
- VERSION = "1.0.7"
2
+ VERSION = "1.1.0.pre1"
3
3
  end
@@ -1,52 +1,52 @@
1
1
  require 'spec_helper'
2
- require 'crash_log/rails'
2
+ # require 'crash_log/rails'
3
3
 
4
- describe "Initializer" do
4
+ # describe "Initializer" do
5
5
 
6
- let(:logger) { stub("Logger") }
7
- let(:other_logger) { stub("OtherLogger") }
6
+ # let(:logger) { stub("Logger") }
7
+ # let(:other_logger) { stub("OtherLogger") }
8
8
 
9
- let(:rails) { double('Rails') }
9
+ # let(:rails) { double('Rails') }
10
10
 
11
- before(:each) do
12
- define_constant('Rails', rails)
13
- end
11
+ # before(:each) do
12
+ # define_constant('Rails', rails)
13
+ # end
14
14
 
15
- it "triggers use of Rails' logger if logger isn't set and Rails' logger exists" do
16
- rails = Module.new do
17
- def self.logger
18
- "RAILS LOGGER"
19
- end
20
- end
21
- define_constant("Rails", rails)
22
- CrashLog::Rails.initialize
23
- expect("RAILS LOGGER").to eq(CrashLog.logger)
24
- end
15
+ # it "triggers use of Rails' logger if logger isn't set and Rails' logger exists" do
16
+ # rails = Module.new do
17
+ # def self.logger
18
+ # "RAILS LOGGER"
19
+ # end
20
+ # end
21
+ # define_constant("Rails", rails)
22
+ # CrashLog::Rails.initialize
23
+ # expect("RAILS LOGGER").to eq(CrashLog.logger)
24
+ # end
25
25
 
26
- describe 'auto configure logger' do
27
- before do
28
- Rails.stub(:logger).and_return(logger)
29
- logger.stub(:error)
30
- other_logger.stub(:error)
31
- end
26
+ # describe 'auto configure logger' do
27
+ # before do
28
+ # Rails.stub(:logger).and_return(logger)
29
+ # logger.stub(:error)
30
+ # other_logger.stub(:error)
31
+ # end
32
32
 
33
33
 
34
- it 'detects presence of Rails logger' do
35
- CrashLog::Rails.__send__(:initialize)
36
- CrashLog.logger.should eq(logger)
37
- end
34
+ # it 'detects presence of Rails logger' do
35
+ # CrashLog::Rails.__send__(:initialize)
36
+ # CrashLog.logger.should eq(logger)
37
+ # end
38
38
 
39
- it "allows overriding of the logger if already assigned" do
40
- CrashLog.logger.should_not == logger
41
- CrashLog::Rails.initialize
42
- CrashLog.logger.should == logger
39
+ # it "allows overriding of the logger if already assigned" do
40
+ # CrashLog.logger.should_not == logger
41
+ # CrashLog::Rails.initialize
42
+ # CrashLog.logger.should == logger
43
43
 
44
- CrashLog.configure do |config|
45
- config.logger = other_logger
46
- end
44
+ # CrashLog.configure do |config|
45
+ # config.logger = other_logger
46
+ # end
47
47
 
48
- CrashLog.logger.should == other_logger
49
- end
50
- end
48
+ # CrashLog.logger.should == other_logger
49
+ # end
50
+ # end
51
51
 
52
- end
52
+ # end
@@ -40,12 +40,14 @@ describe CrashLog::Payload do
40
40
  end
41
41
 
42
42
  it 'allows merging in data' do
43
+ pending
43
44
  data = {:path => '/problematic/path'}
44
45
  subject.add_session_data(data)
45
46
  subject.data[:session].should == data
46
47
  end
47
48
 
48
49
  it 'allows adding more data' do
50
+ pending
49
51
  data_1 = {:path => '/problematic/path'}
50
52
  data_2 = {:count => 42}
51
53
  subject.add_session_data(data_1)
@@ -0,0 +1,243 @@
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" templates
7
+ that are primarily responsible for inserting pre-built data in between HTML tags.
8
+ The model contains the "smart" domain objects (such as Account, Product, Person,
9
+ Post) that holds all the business logic and knows how to persist themselves to
10
+ a database. The controller handles the incoming requests (such as Save New Account,
11
+ Update Product, Show Post) by manipulating the model and directing data to the view.
12
+
13
+ In Rails, the model is handled by what's called an object-relational mapping
14
+ layer entitled Active Record. This layer allows you to present the data from
15
+ database rows as objects and embellish these data objects with business logic
16
+ methods. You can read more about Active Record in
17
+ link:files/vendor/rails/activerecord/README.html.
18
+
19
+ The controller and view are handled by the Action Pack, which handles both
20
+ layers by its two parts: Action View and Action Controller. These two layers
21
+ are bundled in a single package due to their heavy interdependence. This is
22
+ unlike the relationship between the Active Record and Action Pack that is much
23
+ more separate. Each of these packages can be used independently outside of
24
+ Rails. You can read more about Action Pack in
25
+ link:files/vendor/rails/actionpack/README.html.
26
+
27
+
28
+ == Getting Started
29
+
30
+ 1. At the command prompt, start a new Rails application using the <tt>rails</tt> command
31
+ and your application name. Ex: rails myapp
32
+ 2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options)
33
+ 3. Go to http://localhost:3000/ and get "Welcome aboard: You're riding the Rails!"
34
+ 4. Follow the guidelines to start developing your application
35
+
36
+
37
+ == Web Servers
38
+
39
+ 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
40
+ with a variety of other web servers.
41
+
42
+ Mongrel is a Ruby-based webserver with a C component (which requires compilation) that is
43
+ suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
44
+ getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>.
45
+ More info at: http://mongrel.rubyforge.org
46
+
47
+ Say other Ruby web servers like Thin and Ebb or regular web servers like Apache or LiteSpeed or
48
+ Lighttpd or IIS. The Ruby web servers are run through Rack and the latter can either be setup to use
49
+ FCGI or proxy to a pack of Mongrels/Thin/Ebb servers.
50
+
51
+ == Apache .htaccess example for FCGI/CGI
52
+
53
+ # General Apache options
54
+ AddHandler fastcgi-script .fcgi
55
+ AddHandler cgi-script .cgi
56
+ Options +FollowSymLinks +ExecCGI
57
+
58
+ # If you don't want Rails to look in certain directories,
59
+ # use the following rewrite rules so that Apache won't rewrite certain requests
60
+ #
61
+ # Example:
62
+ # RewriteCond %{REQUEST_URI} ^/notrails.*
63
+ # RewriteRule .* - [L]
64
+
65
+ # Redirect all requests not available on the filesystem to Rails
66
+ # By default the cgi dispatcher is used which is very slow
67
+ #
68
+ # For better performance replace the dispatcher with the fastcgi one
69
+ #
70
+ # Example:
71
+ # RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
72
+ RewriteEngine On
73
+
74
+ # If your Rails application is accessed via an Alias directive,
75
+ # then you MUST also set the RewriteBase in this htaccess file.
76
+ #
77
+ # Example:
78
+ # Alias /myrailsapp /path/to/myrailsapp/public
79
+ # RewriteBase /myrailsapp
80
+
81
+ RewriteRule ^$ index.html [QSA]
82
+ RewriteRule ^([^.]+)$ $1.html [QSA]
83
+ RewriteCond %{REQUEST_FILENAME} !-f
84
+ RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
85
+
86
+ # In case Rails experiences terminal errors
87
+ # Instead of displaying this message you can supply a file here which will be rendered instead
88
+ #
89
+ # Example:
90
+ # ErrorDocument 500 /500.html
91
+
92
+ ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
93
+
94
+
95
+ == Debugging Rails
96
+
97
+ Sometimes your application goes wrong. Fortunately there are a lot of tools that
98
+ will help you debug it and get it back on the rails.
99
+
100
+ First area to check is the application log files. Have "tail -f" commands running
101
+ on the server.log and development.log. Rails will automatically display debugging
102
+ and runtime information to these files. Debugging info will also be shown in the
103
+ browser on requests from 127.0.0.1.
104
+
105
+ You can also log your own messages directly into the log file from your code using
106
+ the Ruby logger class from inside your controllers. Example:
107
+
108
+ class WeblogController < ActionController::Base
109
+ def destroy
110
+ @weblog = Weblog.find(params[:id])
111
+ @weblog.destroy
112
+ logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
113
+ end
114
+ end
115
+
116
+ The result will be a message in your log file along the lines of:
117
+
118
+ Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1
119
+
120
+ More information on how to use the logger is at http://www.ruby-doc.org/core/
121
+
122
+ Also, Ruby documentation can be found at http://www.ruby-lang.org/ including:
123
+
124
+ * The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/
125
+ * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
126
+
127
+ These two online (and free) books will bring you up to speed on the Ruby language
128
+ and also on programming in general.
129
+
130
+
131
+ == Debugger
132
+
133
+ Debugger support is available through the debugger command when you start your Mongrel or
134
+ Webrick server with --debugger. This means that you can break out of execution at any point
135
+ in the code, investigate and change the model, AND then resume execution!
136
+ You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
137
+ Example:
138
+
139
+ class WeblogController < ActionController::Base
140
+ def index
141
+ @posts = Post.find(:all)
142
+ debugger
143
+ end
144
+ end
145
+
146
+ So the controller will accept the action, run the first line, then present you
147
+ with a IRB prompt in the server window. Here you can do things like:
148
+
149
+ >> @posts.inspect
150
+ => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
151
+ #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
152
+ >> @posts.first.title = "hello from a debugger"
153
+ => "hello from a debugger"
154
+
155
+ ...and even better is that you can examine how your runtime objects actually work:
156
+
157
+ >> f = @posts.first
158
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
159
+ >> f.
160
+ Display all 152 possibilities? (y or n)
161
+
162
+ Finally, when you're ready to resume execution, you enter "cont"
163
+
164
+
165
+ == Console
166
+
167
+ You can interact with the domain model by starting the console through <tt>script/console</tt>.
168
+ Here you'll have all parts of the application configured, just like it is when the
169
+ application is running. You can inspect domain models, change values, and save to the
170
+ database. Starting the script without arguments will launch it in the development environment.
171
+ Passing an argument will specify a different environment, like <tt>script/console production</tt>.
172
+
173
+ To reload your controllers and models after launching the console run <tt>reload!</tt>
174
+
175
+ == dbconsole
176
+
177
+ You can go to the command line of your database directly through <tt>script/dbconsole</tt>.
178
+ You would be connected to the database with the credentials defined in database.yml.
179
+ Starting the script without arguments will connect you to the development database. Passing an
180
+ argument will connect you to a different database, like <tt>script/dbconsole production</tt>.
181
+ Currently works for mysql, postgresql and sqlite.
182
+
183
+ == Description of Contents
184
+
185
+ app
186
+ Holds all the code that's specific to this particular application.
187
+
188
+ app/controllers
189
+ Holds controllers that should be named like weblogs_controller.rb for
190
+ automated URL mapping. All controllers should descend from ApplicationController
191
+ which itself descends from ActionController::Base.
192
+
193
+ app/models
194
+ Holds models that should be named like post.rb.
195
+ Most models will descend from ActiveRecord::Base.
196
+
197
+ app/views
198
+ Holds the template files for the view that should be named like
199
+ weblogs/index.html.erb for the WeblogsController#index action. All views use eRuby
200
+ syntax.
201
+
202
+ app/views/layouts
203
+ Holds the template files for layouts to be used with views. This models the common
204
+ header/footer method of wrapping views. In your views, define a layout using the
205
+ <tt>layout :default</tt> and create a file named default.html.erb. Inside default.html.erb,
206
+ call <% yield %> to render the view using this layout.
207
+
208
+ app/helpers
209
+ Holds view helpers that should be named like weblogs_helper.rb. These are generated
210
+ for you automatically when using script/generate for controllers. Helpers can be used to
211
+ wrap functionality for your views into methods.
212
+
213
+ config
214
+ Configuration files for the Rails environment, the routing map, the database, and other dependencies.
215
+
216
+ db
217
+ Contains the database schema in schema.rb. db/migrate contains all
218
+ the sequence of Migrations for your schema.
219
+
220
+ doc
221
+ This directory is where your application documentation will be stored when generated
222
+ using <tt>rake doc:app</tt>
223
+
224
+ lib
225
+ Application specific libraries. Basically, any kind of custom code that doesn't
226
+ belong under controllers, models, or helpers. This directory is in the load path.
227
+
228
+ public
229
+ The directory available for the web server. Contains subdirectories for images, stylesheets,
230
+ and javascripts. Also contains the dispatchers and the default HTML files. This should be
231
+ set as the DOCUMENT_ROOT of your web server.
232
+
233
+ script
234
+ Helper scripts for automation and generation.
235
+
236
+ test
237
+ Unit and functional tests along with fixtures. When using the script/generate scripts, template
238
+ test files will be generated for you and placed in this directory.
239
+
240
+ vendor
241
+ External libraries that the application depends on. Also includes the plugins subdirectory.
242
+ If the app has frozen rails, those gems also go here, under vendor/rails/.
243
+ This directory is in the load path.