From 85f71c53296e2f360f723236dee7a3193db35a13 Mon Sep 17 00:00:00 2001 From: Michael Pearson Date: Wed, 2 May 2012 17:42:33 +1000 Subject: Add note about image_tag('') issue in Asset Pipeline guide (see rails issue #3080) --- guides/source/asset_pipeline.textile | 2 ++ 1 file changed, 2 insertions(+) (limited to 'guides/source') diff --git a/guides/source/asset_pipeline.textile b/guides/source/asset_pipeline.textile index d79eb01ab2..010154f1d1 100644 --- a/guides/source/asset_pipeline.textile +++ b/guides/source/asset_pipeline.textile @@ -204,6 +204,8 @@ Images can also be organized into subdirectories if required, and they can be ac <%= image_tag "icons/rails.png" %> +WARNING: If you're precompiling your assets (see "In Production":#in-production below), linking to an asset that does not exist will raise an exception in the calling page. This includes linking to a blank string. As such, be careful using image_tag and the other helpers with user-supplied data. + h5. CSS and ERB The asset pipeline automatically evaluates ERB. This means that if you add an +erb+ extension to a CSS asset (for example, +application.css.erb+), then helpers like +asset_path+ are available in your CSS rules: -- cgit v1.2.3 From a411e8828a50795139df6ed210271c1a6cbd135d Mon Sep 17 00:00:00 2001 From: Ayrton De Craene Date: Wed, 2 May 2012 11:49:43 +0300 Subject: Changed code examples to have a consistent code styling [ci skip] --- guides/source/layouts_and_rendering.textile | 66 ++++++++++++++--------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'guides/source') diff --git a/guides/source/layouts_and_rendering.textile b/guides/source/layouts_and_rendering.textile index f69afaa281..e4a1fd6951 100644 --- a/guides/source/layouts_and_rendering.textile +++ b/guides/source/layouts_and_rendering.textile @@ -78,16 +78,16 @@ If we want to display the properties of all the books in our view, we can do so <%= book.title %> <%= book.content %> - <%= link_to 'Show', book %> - <%= link_to 'Edit', edit_book_path(book) %> - <%= link_to 'Remove', book, :confirm => 'Are you sure?', :method => :delete %> + <%= link_to "Show", book %> + <%= link_to "Edit", edit_book_path(book) %> + <%= link_to "Remove", book, :confirm => "Are you sure?", :method => :delete %> <% end %>
-<%= link_to 'New book', new_book_path %> +<%= link_to "New book", new_book_path %> NOTE: The actual rendering is done by subclasses of +ActionView::TemplateHandlers+. This guide does not dig into that process, but it's important to know that the file extension on your view controls the choice of template handler. Beginning with Rails 2, the standard extensions are +.erb+ for ERB (HTML with embedded Ruby), and +.builder+ for Builder (XML generator). @@ -177,13 +177,13 @@ h5. Rendering an Action's Template from Another Controller What if you want to render a template from an entirely different controller from the one that contains the action code? You can also do that with +render+, which accepts the full path (relative to +app/views+) of the template to render. For example, if you're running code in an +AdminProductsController+ that lives in +app/controllers/admin+, you can render the results of an action to a template in +app/views/products+ this way: -render 'products/show' +render "products/show" Rails knows that this view belongs to a different controller because of the embedded slash character in the string. If you want to be explicit, you can use the +:template+ option (which was required on Rails 2.2 and earlier): -render :template => 'products/show' +render :template => "products/show" h5. Rendering an Arbitrary File @@ -216,18 +216,18 @@ In fact, in the BooksController class, inside of the update action where we want render :edit render :action => :edit -render 'edit' -render 'edit.html.erb' -render :action => 'edit' -render :action => 'edit.html.erb' -render 'books/edit' -render 'books/edit.html.erb' -render :template => 'books/edit' -render :template => 'books/edit.html.erb' -render '/path/to/rails/app/views/books/edit' -render '/path/to/rails/app/views/books/edit.html.erb' -render :file => '/path/to/rails/app/views/books/edit' -render :file => '/path/to/rails/app/views/books/edit.html.erb' +render "edit" +render "edit.html.erb" +render :action => "edit" +render :action => "edit.html.erb" +render "books/edit" +render "books/edit.html.erb" +render :template => "books/edit" +render :template => "books/edit.html.erb" +render "/path/to/rails/app/views/books/edit" +render "/path/to/rails/app/views/books/edit.html.erb" +render :file => "/path/to/rails/app/views/books/edit" +render :file => "/path/to/rails/app/views/books/edit.html.erb" Which one you use is really a matter of style and convention, but the rule of thumb is to use the simplest one that makes sense for the code you are writing. @@ -306,7 +306,7 @@ h6. The +:content_type+ Option By default, Rails will serve the results of a rendering operation with the MIME content-type of +text/html+ (or +application/json+ if you use the +:json+ option, or +application/xml+ for the +:xml+ option.). There are times when you might like to change this, and you can do so by setting the +:content_type+ option: -render :file => filename, :content_type => 'application/rss' +render :file => filename, :content_type => "application/rss" h6. The +:layout+ Option @@ -316,7 +316,7 @@ With most of the options to +render+, the rendered content is displayed as part You can use the +:layout+ option to tell Rails to use a specific file as the layout for the current action: -render :layout => 'special_layout' +render :layout => "special_layout" You can also tell Rails to render with no layout at all: @@ -378,7 +378,7 @@ You can use a symbol to defer the choice of layout until a request is processed: class ProductsController < ApplicationController - layout :products_layout + layout "products_layout" def show @product = Product.find(params[:id]) @@ -398,7 +398,7 @@ You can even use an inline method, such as a Proc, to determine the layout. For class ProductsController < ApplicationController - layout Proc.new { |controller| controller.request.xhr? ? 'popup' : 'application' } + layout Proc.new { |controller| controller.request.xhr? ? "popup" : "application" } end @@ -445,7 +445,7 @@ end class OldPostsController < SpecialPostsController - layout nil + layout false def show @post = Post.find(params[:id]) @@ -583,7 +583,7 @@ def show @book = Book.find_by_id(params[:id]) if @book.nil? @books = Book.all - render "index", :alert => 'Your book was not found!' + render "index", :alert => "Your book was not found!" end end @@ -770,7 +770,7 @@ By default, the combined file will be delivered as +javascripts/all.js+. You can <%= javascript_include_tag "main", "columns", - :cache => 'cache/main/display' %> + :cache => "cache/main/display" %> You can even use dynamic paths such as +cache/#{current_site}/main/display+. @@ -833,7 +833,7 @@ By default, the combined file will be delivered as +stylesheets/all.css+. You ca <%= stylesheet_link_tag "main", "columns", - :cache => 'cache/main/display' %> + :cache => "cache/main/display" %> You can even use dynamic paths such as +cache/#{current_site}/main/display+. @@ -884,7 +884,7 @@ In addition to the above special tags, you can supply a final hash of standard H <%= image_tag "home.gif", :alt => "Go Home", :id => "HomeImage", - :class => 'nav_bar' %> + :class => "nav_bar" %> h5. Linking to Videos with the +video_tag+ @@ -905,7 +905,7 @@ Like an +image_tag+ you can supply a path, either absolute, or relative to the + The video tag also supports all of the +<video>+ HTML options through the HTML options hash, including: -* +:poster => 'image_name.png'+, provides an image to put in place of the video before it starts playing. +* +:poster => "image_name.png"+, provides an image to put in place of the video before it starts playing. * +:autoplay => true+, starts playing the video on page load. * +:loop => true+, loops the video once it gets to the end. * +:controls => true+, provides browser supplied controls for the user to interact with the video. @@ -1159,7 +1159,7 @@ In the event that the collection is empty, +render+ will return nil, so it shoul

Products

-<%= render(@products) || 'There are no products available.' %> +<%= render(@products) || "There are no products available." %>
h5. Local Variables @@ -1175,7 +1175,7 @@ With this change, you can access an instance of the +@products+ collection as th You can also pass in arbitrary local variables to any partial you are rendering with the +:locals => {}+ option: -<%= render :partial => 'products', :collection => @products, +<%= render :partial => "products", :collection => @products, :as => :item, :locals => {:title => "Products Page"} %> @@ -1214,8 +1214,8 @@ Suppose you have the following +ApplicationController+ layout: - <%= @page_title or 'Page Title' %> - <%= stylesheet_link_tag 'layout' %> + <%= @page_title or "Page Title" %> + <%= stylesheet_link_tag "layout" %> @@ -1239,7 +1239,7 @@ On pages generated by +NewsController+, you want to hide the top menu and add a
Right menu items here
<%= content_for?(:news_content) ? yield(:news_content) : yield %> <% end %> -<%= render :template => 'layouts/application' %> +<%= render :template => "layouts/application" %>
That's it. The News views will use the new layout, hiding the top menu and adding a new right menu inside the "content" div. -- cgit v1.2.3 From 47ec49276d40ed565d805069bb2a746e9a7b3157 Mon Sep 17 00:00:00 2001 From: Oscar Del Ben Date: Wed, 2 May 2012 10:42:59 +0200 Subject: Rewrite comments action in getting started guide --- guides/source/getting_started.textile | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) (limited to 'guides/source') diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile index 44f3b978db..7ad01ae636 100644 --- a/guides/source/getting_started.textile +++ b/guides/source/getting_started.textile @@ -1367,60 +1367,53 @@ template. This is where we want the comment to show, so let's add that to the +app/views/posts/show.html.erb+. -

<%= notice %>

- -

- Name: - <%= @post.name %> -

-

- Title: + Title: <%= @post.title %>

- Content: - <%= @post.content %> + Text: + <%= @post.texthttp://beginningruby.org/ %>

Comments

<% @post.comments.each do |comment| %>

- Commenter: + Commenter: <%= comment.commenter %>

- Comment: + Comment: <%= comment.body %>

<% end %>

Add a comment:

<%= form_for([@post, @post.comments.build]) do |f| %> -
+

<%= f.label :commenter %>
<%= f.text_field :commenter %> -

-
+

+

<%= f.label :body %>
<%= f.text_area :body %> -

-
+

+

<%= f.submit %> -

+

<% end %> -
- <%= link_to 'Edit Post', edit_post_path(@post) %> | -<%= link_to 'Back to Posts', posts_path %> | +<%= link_to 'Back to Posts', posts_path %>
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)! + h3. Refactoring Now that we have posts and comments working, take a look at the -- cgit v1.2.3 From 323d2c42c3782db9e30b37abb4787fe73d6d7c8d Mon Sep 17 00:00:00 2001 From: Oscar Del Ben Date: Wed, 2 May 2012 11:13:20 +0200 Subject: Rewrite refactoring section in getting started guide --- guides/source/getting_started.textile | 65 ++++++++++++----------------------- 1 file changed, 22 insertions(+), 43 deletions(-) (limited to 'guides/source') diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile index 7ad01ae636..8ea7c5ab6e 100644 --- a/guides/source/getting_started.textile +++ b/guides/source/getting_started.textile @@ -1428,12 +1428,12 @@ following into it:

- Commenter: + Commenter: <%= comment.commenter %>

- Comment: + Comment: <%= comment.body %>

@@ -1442,21 +1442,14 @@ Then you can change +app/views/posts/show.html.erb+ to look like the following: -

<%= notice %>

- -

- Name: - <%= @post.name %> -

-

- Title: + Title: <%= @post.title %>

- Content: - <%= @post.content %> + Text: + <%= @post.texthttp://beginningruby.org/ %>

Comments

@@ -1464,23 +1457,21 @@ following:

Add a comment:

<%= form_for([@post, @post.comments.build]) do |f| %> -
+

<%= f.label :commenter %>
<%= f.text_field :commenter %> -

-
+

+

<%= f.label :body %>
<%= f.text_area :body %> -

-
+

+

<%= f.submit %> -

+

<% end %> -
- <%= link_to 'Edit Post', edit_post_path(@post) %> | -<%= link_to 'Back to Posts', posts_path %> | +<%= link_to 'Back to Posts', posts_path %>
This will now render the partial in +app/views/comments/_comment.html.erb+ once @@ -1496,50 +1487,38 @@ create a file +app/views/comments/_form.html.erb+ containing: <%= form_for([@post, @post.comments.build]) do |f| %> -
+

<%= f.label :commenter %>
<%= f.text_field :commenter %> -

-
+

+

<%= f.label :body %>
<%= f.text_area :body %> -

-
+

+

<%= f.submit %> -

+

<% end %>
Then you make the +app/views/posts/show.html.erb+ look like the following: -

<%= notice %>

- -

- Name: - <%= @post.name %> -

-

- Title: + Title: <%= @post.title %>

- Content: - <%= @post.content %> + Text: + <%= @post.texthttp://beginningruby.org/ %>

-

Comments

-<%= render @post.comments %> -

Add a comment:

<%= render "comments/form" %> -
- <%= link_to 'Edit Post', edit_post_path(@post) %> | -<%= link_to 'Back to Posts', posts_path %> | +<%= link_to 'Back to Posts', posts_path %>
The second render just defines the partial template we want to render, -- cgit v1.2.3 From c55ee776232f77a9bd45684a3e6f3f3b13380e4c Mon Sep 17 00:00:00 2001 From: Oscar Del Ben Date: Wed, 2 May 2012 11:39:36 +0200 Subject: Remove tags from getting started guide and adapt some of the content to the new guide --- guides/source/getting_started.textile | 216 +--------------------------------- 1 file changed, 2 insertions(+), 214 deletions(-) (limited to 'guides/source') diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile index 8ea7c5ab6e..1fbbd8af67 100644 --- a/guides/source/getting_started.textile +++ b/guides/source/getting_started.textile @@ -1540,12 +1540,12 @@ So first, let's add the delete link in the

- Commenter: + Commenter: <%= comment.commenter %>

- Comment: + Comment: <%= comment.body %>

@@ -1594,7 +1594,6 @@ model, +app/models/post.rb+, as follows: class Post < ActiveRecord::Base - validates :name, :presence => true validates :title, :presence => true, :length => { :minimum => 5 } has_many :comments, :dependent => :destroy @@ -1623,11 +1622,8 @@ class PostsController < ApplicationController http_basic_authenticate_with :name => "dhh", :password => "secret", :except => [:index, :show] - # GET /posts - # GET /posts.json def index @posts = Post.all - respond_to do |format| # snipped for brevity @@ -1649,214 +1645,6 @@ Authentication challenge !images/challenge.png(Basic HTTP Authentication Challenge)! -h3. Building a Multi-Model Form - -Another feature of your average blog is the ability to tag posts. To implement -this feature your application needs to interact with more than one model on a -single form. Rails offers support for nested forms. - -To demonstrate this, we will add support for giving each post multiple tags, -right in the form where you create the post. First, create a new model to hold -the tags: - - -$ rails generate model Tag name:string post:references - - -Again, run the migration to create the database table: - - -$ rake db:migrate - - -Next, edit the +post.rb+ file to create the other side of the association, and -to tell Rails (via the +accepts_nested_attributes_for+ macro) that you intend to -edit tags via posts: - - -class Post < ActiveRecord::Base - validates :name, :presence => true - validates :title, :presence => true, - :length => { :minimum => 5 } - - has_many :comments, :dependent => :destroy - has_many :tags - attr_protected :tags - - accepts_nested_attributes_for :tags, :allow_destroy => :true, - :reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? } } -end - - -The +:allow_destroy+ option tells Rails to enable destroying tags through the -nested attributes (you'll handle that by displaying a "remove" checkbox on the -view that you'll build shortly). The +:reject_if+ option prevents saving new -tags that do not have any attributes filled in. - -We will modify +views/posts/_form.html.erb+ to render a partial to make a tag: - - -<% @post.tags.build %> -<%= form_for(@post) do |post_form| %> - <% if @post.errors.any? %> -
-

<%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:

-
    - <% @post.errors.full_messages.each do |msg| %> -
  • <%= msg %>
  • - <% end %> -
-
- <% end %> - -
- <%= post_form.label :name %>
- <%= post_form.text_field :name %> -
-
- <%= post_form.label :title %>
- <%= post_form.text_field :title %> -
-
- <%= post_form.label :content %>
- <%= post_form.text_area :content %> -
-

Tags

- <%= render :partial => 'tags/form', - :locals => {:form => post_form} %> -
- <%= post_form.submit %> -
-<% end %> -
- -Note that we have changed the +f+ in +form_for(@post) do |f|+ to +post_form+ to -make it easier to understand what is going on. - -This example shows another option of the render helper, being able to pass in -local variables, in this case, we want the local variable +form+ in the partial -to refer to the +post_form+ object. - -We also add a @post.tags.build at the top of this form. This is to make -sure there is a new tag ready to have its name filled in by the user. If you do -not build the new tag, then the form will not appear as there is no new Tag -object ready to create. - -Now create the folder app/views/tags and make a file in there called -_form.html.erb which contains the form for the tag: - - -<%= form.fields_for :tags do |tag_form| %> -
- <%= tag_form.label :name, 'Tag:' %> - <%= tag_form.text_field :name %> -
- <% unless tag_form.object.nil? || tag_form.object.new_record? %> -
- <%= tag_form.label :_destroy, 'Remove:' %> - <%= tag_form.check_box :_destroy %> -
- <% end %> -<% end %> -
- -Finally, we will edit the app/views/posts/show.html.erb template to -show our tags. - - -

<%= notice %>

- -

- Name: - <%= @post.name %> -

- -

- Title: - <%= @post.title %> -

- -

- Content: - <%= @post.content %> -

- -

- Tags: - <%= @post.tags.map { |t| t.name }.join(", ") %> -

- -

Comments

-<%= render @post.comments %> - -

Add a comment:

-<%= render "comments/form" %> - - -<%= link_to 'Edit Post', edit_post_path(@post) %> | -<%= link_to 'Back to Posts', posts_path %> | -
- -With these changes in place, you'll find that you can edit a post and its tags -directly on the same view. - -However, that method call @post.tags.map { |t| t.name }.join(", ") is -awkward, we could handle this by making a helper method. - -h3. View Helpers - -View Helpers live in app/helpers and provide small snippets of reusable -code for views. In our case, we want a method that strings a bunch of objects -together using their name attribute and joining them with a comma. As this is -for the Post show template, we put it in the PostsHelper. - -Open up app/helpers/posts_helper.rb and add the following: - - -module PostsHelper - def join_tags(post) - post.tags.map { |t| t.name }.join(", ") - end -end - - -Now you can edit the view in app/views/posts/show.html.erb to look like -this: - - -

<%= notice %>

- -

- Name: - <%= @post.name %> -

- -

- Title: - <%= @post.title %> -

- -

- Content: - <%= @post.content %> -

- -

- Tags: - <%= join_tags(@post) %> -

- -

Comments

-<%= render @post.comments %> - -

Add a comment:

-<%= render "comments/form" %> - - -<%= link_to 'Edit Post', edit_post_path(@post) %> | -<%= link_to 'Back to Posts', posts_path %> | -
- h3. What's Next? Now that you've seen your first Rails application, you should feel free to -- cgit v1.2.3 From b7394646af80cd632b1b4c48feb57f5f48ed160a Mon Sep 17 00:00:00 2001 From: Oscar Del Ben Date: Wed, 2 May 2012 12:34:35 +0200 Subject: Mention mac os x installation tools on getting started guide --- guides/source/getting_started.textile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile index 1fbbd8af67..59c7a167fb 100644 --- a/guides/source/getting_started.textile +++ b/guides/source/getting_started.textile @@ -87,7 +87,10 @@ To install Rails, use the +gem install+ command provided by RubyGems: # gem install rails -TIP. If you're working on Windows, you can quickly install Ruby and Rails with "Rails Installer":http://railsinstaller.org. +TIP. A number of tools exist to help you quickly install Ruby and Ruby +on Rails on your system. Windows users can use "Rails +Installer":http://railsinstaller.org, while Mac Os X users can use +"Rails One Click":http://railsoneclick.com. To verify that you have everything installed correctly, you should be able to run the following: -- cgit v1.2.3 From 31500f7284515604891a74d9853f691e67c76261 Mon Sep 17 00:00:00 2001 From: Oscar Del Ben Date: Wed, 2 May 2012 13:44:08 +0300 Subject: Typo --- guides/source/getting_started.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile index 59c7a167fb..31eb332c89 100644 --- a/guides/source/getting_started.textile +++ b/guides/source/getting_started.textile @@ -89,7 +89,7 @@ To install Rails, use the +gem install+ command provided by RubyGems: TIP. A number of tools exist to help you quickly install Ruby and Ruby on Rails on your system. Windows users can use "Rails -Installer":http://railsinstaller.org, while Mac Os X users can use +Installer":http://railsinstaller.org, while Mac OS X users can use "Rails One Click":http://railsoneclick.com. To verify that you have everything installed correctly, you should be able to run the following: -- cgit v1.2.3 From c9e809c8e49ed9af43044554ad1698aa07748851 Mon Sep 17 00:00:00 2001 From: Paul McMahon Date: Thu, 3 May 2012 17:20:59 +0900 Subject: I found it strange that this guide is redirecting questions to a specific person. Heiko Webers' (@hawe) last blog post is a year and a half old, so it's not obvious that he's still active with Rails security. If he is, feel free to revert. --- guides/source/security.textile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'guides/source') diff --git a/guides/source/security.textile b/guides/source/security.textile index c065529cac..ac64b82bf6 100644 --- a/guides/source/security.textile +++ b/guides/source/security.textile @@ -1,7 +1,6 @@ h2. Ruby On Rails Security Guide -This manual describes common security problems in web applications and how to avoid them with Rails. If you have any questions or suggestions, please -mail me, Heiko Webers, at 42 {_et_} rorsecurity.info. After reading it, you should be familiar with: +This manual describes common security problems in web applications and how to avoid them with Rails. After reading it, you should be familiar with: * All countermeasures _(highlight)that are highlighted_ * The concept of sessions in Rails, what to put in there and popular attack methods -- cgit v1.2.3 From e608588d3a8dce80d62d78d88d6dea4008bf0d37 Mon Sep 17 00:00:00 2001 From: Oscar Del Ben Date: Thu, 3 May 2012 13:58:19 +0200 Subject: Update command line guide --- guides/source/command_line.textile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'guides/source') diff --git a/guides/source/command_line.textile b/guides/source/command_line.textile index 95a01710b5..71386f427a 100644 --- a/guides/source/command_line.textile +++ b/guides/source/command_line.textile @@ -12,7 +12,7 @@ endprologue. NOTE: This tutorial assumes you have basic Rails knowledge from reading the "Getting Started with Rails Guide":getting_started.html. -WARNING. This Guide is based on Rails 3.0. Some of the code shown here will not work in earlier versions of Rails. +WARNING. This Guide is based on Rails 3.2. Some of the code shown here will not work in earlier versions of Rails. h3. Command Line Basics @@ -31,7 +31,7 @@ h4. +rails new+ The first thing we'll want to do is create a new Rails application by running the +rails new+ command after installing Rails. -WARNING: You can install the rails gem by typing +gem install rails+, if you don't have it already. Follow the instructions in the "Rails 3 Release Notes":/3_0_release_notes.html +TIP: You can install the rails gem by typing +gem install rails+, if you don't have it already. $ rails new commandsapp @@ -185,8 +185,6 @@ $ rails server => Booting WEBrick... -WARNING: Make sure that you do not have any "tilde backup" files in +app/views/(controller)+, or else WEBrick will _not_ show the expected output. This seems to be a *bug* in Rails 2.3.0. - The URL will be "http://localhost:3000/greetings/hello":http://localhost:3000/greetings/hello. INFO: With a normal, plain-old Rails application, your URLs will generally follow the pattern of http://(host)/(controller)/(action), and a URL like http://(host)/(controller) will hit the *index* action of that controller. -- cgit v1.2.3 From 026e0d1c4df68c3471a93b0f9d90a581d1511bd1 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Thu, 3 May 2012 22:16:04 -0300 Subject: Remove vestiges of the http_only! config from configuring guide --- guides/source/configuring.textile | 8 -------- 1 file changed, 8 deletions(-) (limited to 'guides/source') diff --git a/guides/source/configuring.textile b/guides/source/configuring.textile index 68426221bf..f17912e63c 100644 --- a/guides/source/configuring.textile +++ b/guides/source/configuring.textile @@ -248,14 +248,6 @@ They can also be removed from the stack completely: config.middleware.delete ActionDispatch::BestStandardsSupport
-In addition to these methods to handle the stack, if your application is going to be used as an API endpoint only, the middleware stack can be configured like this: - - -config.middleware.http_only! - - -By doing this, Rails will create a smaller middleware stack, by not adding some middlewares that are usually useful for browser access only, such as Cookies, Session and Flash, BestStandardsSupport, and MethodOverride. You can always add any of them later manually if you want. Refer to the "API App docs":api_app.html for more info on how to setup your application for API only apps. - h4. Configuring i18n * +config.i18n.default_locale+ sets the default locale of an application used for i18n. Defaults to +:en+. -- cgit v1.2.3 From c058a773b89b1bf4103f9bd4910743f60f238792 Mon Sep 17 00:00:00 2001 From: Oscar Del Ben Date: Fri, 4 May 2012 08:36:30 +0200 Subject: mention database mapping in getting started guide --- guides/source/getting_started.textile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile index 31eb332c89..947abd7ba0 100644 --- a/guides/source/getting_started.textile +++ b/guides/source/getting_started.textile @@ -404,7 +404,10 @@ $ rails generate model Post title:string text:text With that command we told Rails that we want a +Post+ model, which in turn should have a title attribute of type string, and a text attribute -of type text. Rails in turn responded by creating a bunch of files. For +of type text. Those attributes are automatically added to the +posts+ +table in the database and mapped to the +Post+ model. + +Rails in turn responded by creating a bunch of files. For now, we're only interested in +app/models/post.rb+ and +db/migrate/20120419084633_create_posts.rb+. The latter is responsible for creating the database structure, which is what we'll look at next. -- cgit v1.2.3