Browse files

Convert image tags to Markdown syntax

  • Loading branch information...
1 parent 2c38567 commit 2e89ac34cf25d1045dcef50d1a03dd84fb37d739 @sikachu sikachu committed with sikachu Sep 2, 2012
@@ -897,7 +897,7 @@ end
If you submit the form with empty fields, the result will be similar to the one shown below:
-!images/error_messages.png(Error messages)!
+![Error messages](images/error_messages.png)
NOTE: The appearance of the generated HTML will be different from the one shown, unless you have used scaffolding. See [Customizing the Error Messages CSS](#customizing-error-messages-css).
@@ -919,7 +919,7 @@ Both the `form.error_messages` and the `error_messages_for` helpers accept optio
results in:
-!images/customized_error_messages.png(Customized error messages)!
+![Customized error messages](images/customized_error_messages.png)
If you pass `nil` in any of these options, the corresponding section of the `div` will be discarded.
@@ -957,7 +957,7 @@ end
The result looks like the following:
-!images/validation_error_messages.png(Validation error messages)!
+![Validation error messages](images/validation_error_messages.png)
Callbacks Overview
@@ -89,7 +89,7 @@ class Order < ActiveRecord::Base
-!images/belongs_to.png(belongs_to Association Diagram)!
+![belongs_to Association Diagram](images/belongs_to.png)
NOTE: `belongs_to` associations _must_ use the singular term. If you used the pluralized form in the above example for the `customer` association in the `Order` model, you would be told that there was an "uninitialized constant Order::Customers". This is because Rails automatically infers the class name from the association name. If the association name is wrongly pluralized, then the inferred class will be wrongly pluralized too.
@@ -103,7 +103,7 @@ class Supplier < ActiveRecord::Base
-!images/has_one.png(has_one Association Diagram)!
+![has_one Association Diagram](images/has_one.png)
### The `has_many` Association
@@ -117,7 +117,7 @@ end
NOTE: The name of the other model is pluralized when declaring a `has_many` association.
-!images/has_many.png(has_many Association Diagram)!
+![has_many Association Diagram](images/has_many.png)
### The `has_many :through` Association
@@ -140,7 +140,7 @@ class Patient < ActiveRecord::Base
-!images/has_many_through.png(has_many :through Association Diagram)!
+![has_many :through Association Diagram](images/has_many_through.png)
The collection of join models can be managed via the API. For example, if you assign
@@ -196,7 +196,7 @@ class AccountHistory < ActiveRecord::Base
-!images/has_one_through.png(has_one :through Association Diagram)!
+![has_one :through Association Diagram](images/has_one_through.png)
### The `has_and_belongs_to_many` Association
@@ -212,7 +212,7 @@ class Part < ActiveRecord::Base
-!images/habtm.png(has_and_belongs_to_many Association Diagram)!
+![has_and_belongs_to_many Association Diagram](images/habtm.png)
### Choosing Between `belongs_to` and `has_one`
@@ -339,7 +339,7 @@ class CreatePictures < ActiveRecord::Migration
-!images/polymorphic.png(Polymorphic Association Diagram)!
+![Polymorphic Association Diagram](images/polymorphic.png)
### Self Joins
@@ -157,7 +157,7 @@ TIP: Compiling CoffeeScript to JavaScript requires a JavaScript runtime and the
This will fire up WEBrick, a webserver built into Ruby by default. To see your application in action, open a browser window and navigate to [http://localhost:3000](http://localhost:3000). You should see the Rails default information page:
-!images/rails_welcome.png(Welcome Aboard screenshot)!
+![Welcome Aboard screenshot](images/rails_welcome.png)
TIP: To stop the web server, hit Ctrl+C in the terminal window where it's running. In development mode, Rails does not generally require you to restart the server; changes you make in files will be automatically picked up by the server.
@@ -251,15 +251,15 @@ In the Blog application, you will now create a new _resource_. A resource is the
In the next section, you will add the ability to create new posts in your application and be able to view them. This is the "C" and the "R" from CRUD: creation and reading. The form for doing this will look like this:
-!images/getting_started/new_post.png(The new post form)!
+![The new post form](images/getting_started/new_post.png)
It will look a little basic for now, but that's ok. We'll look at improving the styling for it afterwards.
### Laying down the ground work
The first thing that you are going to need to create a new post within the application is a place to do that. A great place for that would be at `/posts/new`. If you attempt to navigate to that now -- by visiting [http://localhost:3000/posts/new](http://localhost:3000/posts/new) -- Rails will give you a routing error:
-!images/getting_started/routing_error_no_route_matches.png(A routing error, no route matches /posts/new)!
+![A routing error, no route matches /posts/new](images/getting_started/routing_error_no_route_matches.png)
This is because there is nowhere inside the routes for the application -- defined inside `config/routes.rb` -- that defines this route. By default, Rails has no routes configured at all, besides the root route you defined earlier, and so you must define your routes as you need them.
@@ -273,7 +273,7 @@ This route is a super-simple route: it defines a new route that only responds to
With the route defined, requests can now be made to `/posts/new` in the application. Navigate to [http://localhost:3000/posts/new](http://localhost:3000/posts/new) and you'll see another routing error:
-!images/getting_started/routing_error_no_controller.png(Another routing error, uninitialized constant PostsController)!
+![Another routing error, uninitialized constant PostsController](images/getting_started/routing_error_no_controller.png)
This error is happening because this route need a controller to be defined. The route is attempting to find that controller so it can serve the request, but with the controller undefined, it just can't do that. The solution to this particular problem is simple: you need to create a controller called `PostsController`. You can do this by running this command:
@@ -292,7 +292,7 @@ A controller is simply a class that is defined to inherit from `ApplicationContr
If you refresh [http://localhost:3000/posts/new](http://localhost:3000/posts/new) now, you'll get a new error:
-!images/getting_started/unknown_action_new_for_posts.png(Unknown action new for PostsController!)!
+![Unknown action new for PostsController!](images/getting_started/unknown_action_new_for_posts.png)
This error indicates that Rails cannot find the `new` action inside the `PostsController` that you just generated. This is because when controllers are generated in Rails they are empty by default, unless you tell it you wanted actions during the generation process.
@@ -305,7 +305,7 @@ end
With the `new` method defined in `PostsController`, if you refresh [http://localhost:3000/posts/new](http://localhost:3000/posts/new) you'll see another error:
-!images/getting_started/template_is_missing_posts_new.png(Template is missing for posts/new)!
+![Template is missing for posts/new](images/getting_started/template_is_missing_posts_new.png)
You're getting this error now because Rails expects plain actions like this one to have views associated with them to display their information. With no view available, Rails errors out.
@@ -387,7 +387,7 @@ By using the `post` method rather than the `get` method, Rails will define a rou
With the form and its associated route defined, you will be able to fill in the form and then click the submit button to begin the process of creating a new post, so go ahead and do that. When you submit the form, you should see a familiar error:
-!images/getting_started/unknown_action_create_for_posts.png(Unknown action create for PostsController)!
+![Unknown action create for PostsController](images/getting_started/unknown_action_create_for_posts.png)
You now need to create the `create` action within the `PostsController` for this to work.
@@ -584,7 +584,7 @@ Finally, if you now go to
[http://localhost:3000/posts/new](http://localhost:3000/posts/new) you'll
be able to create a post. Try it!
-!images/getting_started/show_action_for_posts.png(Show action for posts)!
+![Show action for posts](images/getting_started/show_action_for_posts.png)
### Listing all posts
@@ -814,7 +814,7 @@ standout.
Now you'll get a nice error message when saving a post without title when you
attempt to do just that on the [new post form(http://localhost:3000/posts/new)](http://localhost:3000/posts/new).
-!images/getting_started/form_with_errors.png(Form With Errors)!
+![Form With Errors](images/getting_started/form_with_errors.png)
### Updating Posts
@@ -1166,7 +1166,7 @@ This is done via the JavaScript file `jquery_ujs` which is automatically include
into your application's layout (`app/views/layouts/application.html.erb`) when you
generated the application. Without this file, the confirmation dialog box wouldn't appear.
-!images/getting_started/confirm_dialog.png(Confirm Dialog)!
+![Confirm Dialog](images/getting_started/confirm_dialog.png)
Congratulations, you can now create, show, list, update and destroy
posts. In the next section will see how Rails can aid us when creating
@@ -1497,7 +1497,7 @@ template. This is where we want the comment to show, so let's add that to the
Now you can add posts and comments to your blog and have them show up in the
right places.
-!images/getting_started/post_with_comments.png(Post with Comments)!
+![Post with Comments](images/getting_started/post_with_comments.png)
@@ -1731,7 +1731,7 @@ class CommentsController < ApplicationController
Now if you try to create a new post, you will be greeted with a basic HTTP
Authentication challenge
-!images/challenge.png(Basic HTTP Authentication Challenge)!
+![Basic HTTP Authentication Challenge](images/challenge.png)
What's Next?
@@ -318,7 +318,7 @@ end
<p><%= flash[:notice] %></p>
-!images/i18n/demo_untranslated.png(rails i18n demo untranslated)!
+![rails i18n demo untranslated](images/i18n/demo_untranslated.png)
### Adding Translations
@@ -339,7 +339,7 @@ end
When you now render this view, it will show an error message which tells you that the translations for the keys `:hello_world` and `:hello_flash` are missing.
-!images/i18n/demo_translation_missing.png(rails i18n demo translation missing)!
+![rails i18n demo translation missing](images/i18n/demo_translation_missing.png)
NOTE: Rails adds a `t` (`translate`) helper method to your views so that you do not need to spell out `I18n.t` all the time. Additionally this helper will catch missing translations and wrap the resulting error message into a `&lt;span class="translation_missing"&gt;`.
@@ -359,11 +359,11 @@ pirate:
There you go. Because you haven't changed the default_locale, I18n will use English. Your application now shows:
-!images/i18n/demo_translated_en.png(rails i18n demo translated to English)!
+![rails i18n demo translated to English](images/i18n/demo_translated_en.png)
And when you change the URL to pass the pirate locale (`http://localhost:3000?locale=pirate`), you'll get:
-!images/i18n/demo_translated_pirate.png(rails i18n demo translated to pirate)!
+![rails i18n demo translated to pirate](images/i18n/demo_translated_pirate.png)
NOTE: You need to restart the server when you add new locale files.
@@ -405,7 +405,7 @@ pirate:
So that would give you:
-!images/i18n/demo_localized_pirate.png(rails i18n demo localized time to pirate)!
+![rails i18n demo localized time to pirate](images/i18n/demo_localized_pirate.png)
TIP: Right now you might need to add some more date/time formats in order to make the I18n backend work as expected (at least for the 'pirate' locale). Of course, there's a great chance that somebody already did all the work by *translating Rails' defaults for your locale*. See the [rails-i18n repository at Github]( for an archive of various locale files. When you put such file(s) in `config/locales/` directory, they will automatically be ready for use.
@@ -644,7 +644,7 @@ en:
<div><%= t('title.html') %></div>
-!images/i18n/demo_html_safe.png(i18n demo html safe)!
+![i18n demo html safe](images/i18n/demo_html_safe.png)
How to Store your Custom Translations
@@ -123,7 +123,7 @@ The best _(highlight)solution against it is not to store this kind of data in a
NOTE: _Apart from stealing a user's session id, the attacker may fix a session id known to him. This is called session fixation._
-!images/session_fixation.png(Session fixation)!
+![Session fixation](images/session_fixation.png)
This attack focuses on fixing a user's session id known to the attacker, and forcing the user's browser into using this id. It is therefore not necessary for the attacker to steal the session id afterwards. Here is how this attack works:
@@ -178,7 +178,7 @@ Cross-Site Request Forgery (CSRF)
This attack method works by including malicious code or a link in a page that accesses a web application that the user is believed to have authenticated. If the session for that web application has not timed out, an attacker may execute unauthorized commands.
In the <a href="#sessions">session chapter</a> you have learned that most Rails applications use cookie-based sessions. Either they store the session id in the cookie and have a server-side session hash, or the entire session hash is on the client-side. In either case the browser will automatically send along the cookie on every request to a domain, if it can find a cookie for that domain. The controversial point is, that it will also send the cookie, if the request comes from a site of a different domain. Let's start with an example:

0 comments on commit 2e89ac3

Please sign in to comment.