|
|
(42 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
| == Application Setup ==
| |
| * create project with
| |
| <pre>
| |
| rails new my_project
| |
| </pre>
| |
| * add gem dependencies to <code>Gemfile</code> at the root level
| |
| * update <code>config/application.rb</code> to load needed dependencies and update defaults
| |
| * double-check <code>/config/initializers</code> and <code>/config/environments</code>
| |
|
| |
|
| Files in <code>lib/</code> are not automatically loaded, so you need to <code>require</code> them.
| |
|
| |
| In <code>config/environments/development.rb</code>, set
| |
| <pre>
| |
| config.action_mailer.perform_deliveries = false
| |
| </pre>
| |
| No delivery attempt is performed, but you can still see the mail in the log file to check it looks good
| |
|
| |
|
| |
| == Other rails commands ==
| |
| <pre>
| |
| rails console
| |
| rails server
| |
| rails runner
| |
| </pre>
| |
|
| |
|
| |
| == Logging ==
| |
| Use these in models, views, controllers to send timestamped messages to the log.
| |
| <pre>
| |
| logger.debug "debug message"
| |
| logger.info "info message"
| |
| logger.warn "something bad"
| |
| logger.error "bad"
| |
| logger.fatal "application dead"
| |
| </pre>
| |