diff options
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/action_controller_overview.md | 7 | ||||
-rw-r--r-- | guides/source/development_dependencies_install.md | 2 | ||||
-rw-r--r-- | guides/source/getting_started.md | 8 |
3 files changed, 10 insertions, 7 deletions
diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md index 8ea3859475..a67eba8f7c 100644 --- a/guides/source/action_controller_overview.md +++ b/guides/source/action_controller_overview.md @@ -665,7 +665,10 @@ The first is to use a block directly with the *_action methods. The block receiv ```ruby class ApplicationController < ActionController::Base before_action do |controller| - redirect_to new_login_url unless controller.send(:logged_in?) + unless controller.send(:logged_in?) + flash[:error] = "You must be logged in to access this section" + redirect_to new_login_url + end end end ``` @@ -682,7 +685,7 @@ end class LoginFilter def self.filter(controller) unless controller.send(:logged_in?) - controller.flash[:error] = "You must be logged in" + controller.flash[:error] = "You must be logged in to access this section" controller.redirect_to controller.new_login_url end end diff --git a/guides/source/development_dependencies_install.md b/guides/source/development_dependencies_install.md index c4e5789a1a..4ee43b6a97 100644 --- a/guides/source/development_dependencies_install.md +++ b/guides/source/development_dependencies_install.md @@ -233,6 +233,8 @@ mysql> GRANT ALL PRIVILEGES ON activerecord_unittest.* to 'rails'@'localhost'; mysql> GRANT ALL PRIVILEGES ON activerecord_unittest2.* to 'rails'@'localhost'; +mysql> GRANT ALL PRIVILEGES ON inexistent_activerecord_unittest.* + to 'rails'@'localhost'; ``` and create the test databases: diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index afb3bb22bf..0634c93712 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -757,7 +757,7 @@ the `show` action. That's not very useful though, so let's add the As we have seen in the output of `rake routes`, the route for `show` action is as follows: -```ruby +``` post GET /posts/:id(.:format) posts#show ``` @@ -804,7 +804,7 @@ Visit <http://localhost:3000/posts/new> and give it a try! We still need a way to list all our posts, so let's do that. The route for this as per output of `rake routes` is: -```ruby +``` posts GET /posts(.:format) posts#index ``` @@ -816,7 +816,7 @@ def index end ``` -And then finally a view for this action, located at `app/views/posts/index.html.erb`: +And then finally, add view for this action, located at `app/views/posts/index.html.erb`: ```html+erb <h1>Listing posts</h1> @@ -1406,7 +1406,6 @@ class Post < ActiveRecord::Base has_many :comments validates :title, presence: true, length: { minimum: 5 } - [...] end ``` @@ -1771,7 +1770,6 @@ class Post < ActiveRecord::Base has_many :comments, dependent: :destroy validates :title, presence: true, length: { minimum: 5 } - [...] end ``` |