From 94c52e8bd7ce39ed36c75b6af5ac636f58a63263 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Fri, 10 Jun 2011 17:06:21 +0530 Subject: minor fixes in action view guide --- railties/guides/source/action_view_overview.textile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/railties/guides/source/action_view_overview.textile b/railties/guides/source/action_view_overview.textile index a3454579ad..7703d6c720 100644 --- a/railties/guides/source/action_view_overview.textile +++ b/railties/guides/source/action_view_overview.textile @@ -165,7 +165,7 @@ will produce emphasized emph & bold A link - + Any method with a block will be treated as an XML markup tag with nested markup in the block. For example, the following: @@ -211,7 +211,7 @@ xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do end -h5. Template caching +h5. Template Caching By default, Rails will compile each template to a method in order to render it. When you alter a template, Rails will check the file's modification time and recompile it in development mode. @@ -235,7 +235,7 @@ This will render a file named +_menu.html.erb+ at that point within the view is That code will pull in the partial from +app/views/shared/_menu.html.erb+. -h5. Using Partials to Simplify Views +h5. Using Partials to simplify Views One way to use partials is to treat them as the equivalent of subroutines: as a way to move details out of a view so that you can grasp what's going on more easily. For example, you might have a view that looked like this: -- cgit v1.2.3 From 83289bedddd488e3b3bdd7ff58cd9dd2334d9623 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Fri, 10 Jun 2011 17:17:51 +0530 Subject: fixed incorrect command usage. (This section needs to be updated in any case). --- railties/guides/source/performance_testing.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/guides/source/performance_testing.textile b/railties/guides/source/performance_testing.textile index fe0915bfea..d3b0f84a86 100644 --- a/railties/guides/source/performance_testing.textile +++ b/railties/guides/source/performance_testing.textile @@ -481,7 +481,7 @@ h4. +profiler+ Usage: -Usage: rails benchmarker 'Ruby.code' 'Ruby.more_code' ... [OPTS] +Usage: rails profiler 'Ruby.code' 'Ruby.more_code' ... [OPTS] -r, --runs N Number of runs. Default: 1 -o, --output PATH Directory to use when writing the results. -- cgit v1.2.3 From 3c06d25cf948bd7325454b1d4a843b5178221494 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Fri, 10 Jun 2011 17:18:57 +0530 Subject: favor includes over old AR way --- railties/guides/source/performance_testing.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/guides/source/performance_testing.textile b/railties/guides/source/performance_testing.textile index d3b0f84a86..a4187a3135 100644 --- a/railties/guides/source/performance_testing.textile +++ b/railties/guides/source/performance_testing.textile @@ -66,7 +66,7 @@ resources :posts # home_controller.rb class HomeController < ApplicationController def dashboard - @users = User.last_ten(:include => :avatars) + @users = User.last_ten.includes(:avatars) @posts = Post.all_today end end -- cgit v1.2.3 From 53a9849551f64f0c60fe10a2037268eea9b46341 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Fri, 10 Jun 2011 17:27:46 +0530 Subject: add missing end in example --- railties/guides/source/caching_with_rails.textile | 1 + 1 file changed, 1 insertion(+) diff --git a/railties/guides/source/caching_with_rails.textile b/railties/guides/source/caching_with_rails.textile index f058dce42b..252003edd0 100644 --- a/railties/guides/source/caching_with_rails.textile +++ b/railties/guides/source/caching_with_rails.textile @@ -382,6 +382,7 @@ class ProductsController < ApplicationController # anything. The default render checks for this using the parameters # used in the previous call to stale? and will automatically send a # :not_modified. So that's it, you're done. + end end -- cgit v1.2.3 From db027aa47e94d125be029ca72e21b44e6a937ee1 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sat, 11 Jun 2011 21:31:45 +0530 Subject: minor changes in templates guide --- railties/guides/source/rails_application_templates.textile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/railties/guides/source/rails_application_templates.textile b/railties/guides/source/rails_application_templates.textile index 388d8eea3e..3db47a70e8 100644 --- a/railties/guides/source/rails_application_templates.textile +++ b/railties/guides/source/rails_application_templates.textile @@ -1,6 +1,6 @@ h2. Rails Application Templates -Application templates are simple ruby files containing DSL for adding plugins/gems/initializers etc. to your freshly created Rails project or an existing Rails project. +Application templates are simple Ruby files containing DSL for adding plugins/gems/initializers etc. to your freshly created Rails project or an existing Rails project. By referring to this guide, you will be able to: @@ -58,14 +58,12 @@ gem "bj" gem "nokogiri" -Please note that this will NOT install the gems for you. So you may want to run the +rake gems:install+ task too: +Please note that this will NOT install the gems for you and you will have to run +bundle install+ to do that. -rake "gems:install" +bundle install -And let Rails take care of installing the required gems if they’re not already installed. - h4. add_source(source, options = {}) Adds the given source to the generated application's +Gemfile+. @@ -229,7 +227,7 @@ rake("rails:freeze:gems") if yes?("Freeze rails gems ?") no?(question) acts just the opposite. -h4. git(:must => "-a love") +h4. git(:command) Rails templates let you run any git command: -- cgit v1.2.3 From 940552ef42e1761fa3a6502d388f533a952ffe54 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sat, 11 Jun 2011 22:11:16 +0530 Subject: make some changes to the command line guide --- railties/guides/source/command_line.textile | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/railties/guides/source/command_line.textile b/railties/guides/source/command_line.textile index 026c15feba..8de7101030 100644 --- a/railties/guides/source/command_line.textile +++ b/railties/guides/source/command_line.textile @@ -51,7 +51,7 @@ $ rails new commandsapp Rails will set you up with what seems like a huge amount of stuff for such a tiny command! You've got the entire Rails directory structure now with all the code you need to run our simple application right out of the box. -INFO: This output will seem very familiar when we get to the +generate+ command. Creepy foreshadowing! +INFO: This output will seem very familiar when we get to the +generate+ command. h4. +rails server+ @@ -288,11 +288,7 @@ You can also use the alias "db" to invoke the dbconsole: rails db. h4. +rails plugin+ -The +rails plugin+ command simplifies plugin management; think a miniature version of the Gem utility. Let's walk through installing a plugin. You can call the sub-command +discover+, which sifts through repositories looking for plugins, or call +source+ to add a specific repository of plugins, or you can specify the plugin location directly. - -Let's say you're creating a website for a client who wants a small accounting system. Every event having to do with money must be logged, and must never be deleted. Wouldn't it be great if we could override the behavior of a model to never actually take its record out of the database, but instead, just set a field? - -There is such a thing! The plugin we're installing is called +acts_as_paranoid+, and it lets models implement a +deleted_at+ column that gets set when you call destroy. Later, when calling find, the plugin will tack on a database check to filter out "deleted" things. +The +rails plugin+ command simplifies plugin management; think a miniature version of the Gem utility. $ rails plugin install https://github.com/technoweenie/acts_as_paranoid.git @@ -310,6 +306,12 @@ h4. +rails runner+ $ rails runner "Model.long_running_method" +You can specify the environment in which the +runner+ command should operate using the +-e+ switch. + + +$ rails runner -e staging "Model.long_running_method" + + h4. +rails destroy+ Think of +destroy+ as the opposite of +generate+. It'll figure out what generate did, and undo it. @@ -388,6 +390,8 @@ h4. +db+ The most common tasks of the +db:+ Rake namespace are +migrate+ and +create+, and it will pay off to try out all of the migration rake tasks (+up+, +down+, +redo+, +reset+). +rake db:version+ is useful when troubleshooting, telling you the current version of the database. +More information about migrations can be found in the "Migrations":migrations.html guide. + h4. +doc+ If you want to strip out or rebuild any of the Rails documentation (including this guide!), the +doc:+ namespace has the tools. Stripping documentation is mainly useful for slimming your codebase, like if you're writing a Rails application for an embedded platform. @@ -478,7 +482,9 @@ development: ... -It also generated some lines in our database.yml configuration corresponding to our choice of PostgreSQL for database. The only catch with using the SCM options is that you have to make your application's directory first, then initialize your SCM, then you can run the +rails new+ command to generate the basis of your app. +It also generated some lines in our database.yml configuration corresponding to our choice of PostgreSQL for database. + +NOTE. The only catch with using the SCM options is that you have to make your application's directory first, then initialize your SCM, then you can run the +rails new+ command to generate the basis of your app. h4. +server+ with Different Backends -- cgit v1.2.3 From d91ee6cba43b474df47751c130da781f9febeb90 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sun, 12 Jun 2011 01:30:40 +0530 Subject: more command guide changes --- railties/guides/source/command_line.textile | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/railties/guides/source/command_line.textile b/railties/guides/source/command_line.textile index 8de7101030..013476a4dd 100644 --- a/railties/guides/source/command_line.textile +++ b/railties/guides/source/command_line.textile @@ -51,15 +51,13 @@ $ rails new commandsapp Rails will set you up with what seems like a huge amount of stuff for such a tiny command! You've got the entire Rails directory structure now with all the code you need to run our simple application right out of the box. -INFO: This output will seem very familiar when we get to the +generate+ command. - h4. +rails server+ -The +rails server+ command launches a small web server named WEBrick which comes bundled with Ruby. You'll use this any time you want to view your work through a web browser. +The +rails server+ command launches a small web server named WEBrick which comes bundled with Ruby. You'll use this any time you want to access your application through a web browser. -INFO: WEBrick isn't your only option for serving Rails. We'll get to that in a later section. +INFO: WEBrick isn't your only option for serving Rails. We'll get to that "later":#different-servers. -Without any prodding of any kind, +rails server+ will run our new shiny Rails app: +With no further work, +rails server+ will run our new shiny Rails app: $ cd commandsapp @@ -83,7 +81,7 @@ The +rails generate+ command uses templates to create a whole lot of things. You $ rails generate -Usage: rails generate generator [args] [options] +Usage: rails generate GENERATOR [args] [options] ... ... @@ -171,7 +169,7 @@ Then the view, to display our message (in +app/views/greetings/hello.html.erb+):

<%= @message %>

-Deal. Go check it out in your browser. Fire up your server using +rails server+. +Fire up your server using +rails server+. $ rails server @@ -486,7 +484,7 @@ It also generated some lines in our database.yml configuration corresponding to NOTE. The only catch with using the SCM options is that you have to make your application's directory first, then initialize your SCM, then you can run the +rails new+ command to generate the basis of your app. -h4. +server+ with Different Backends +h4(#different-servers). +server+ with Different Backends Many people have created a large number different web servers in Ruby, and many of them can be used to run Rails. Since version 2.3, Rails uses Rack to serve its webpages, which means that any webserver that implements a Rack handler can be used. This includes WEBrick, Mongrel, Thin, and Phusion Passenger (to name a few!). -- cgit v1.2.3 From 07bf60864474ba2217636ca1d2216fe7b89a6628 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sun, 12 Jun 2011 02:16:08 +0530 Subject: document server options --- railties/guides/source/command_line.textile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/railties/guides/source/command_line.textile b/railties/guides/source/command_line.textile index 013476a4dd..57c71eee09 100644 --- a/railties/guides/source/command_line.textile +++ b/railties/guides/source/command_line.textile @@ -75,6 +75,12 @@ With just three commands we whipped up a Rails server listening on port 3000. Go You can also use the alias "s" to start the server: rails s. +The server can be run on a different port using the +-p+ option. The default development environment can be changed using +-e+. + + +$ rails server -e production + + h4. +rails generate+ The +rails generate+ command uses templates to create a whole lot of things. You can always find out what's available by running +rails generate+ by itself. Let's do that: -- cgit v1.2.3 From 70cafa2bff345fe50837ad9879e01258a27b89b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Sun, 12 Jun 2011 00:41:42 +0300 Subject: with -> will --- activesupport/lib/active_support/core_ext/hash/indifferent_access.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb b/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb index c2a6476604..0b368fe7b7 100644 --- a/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb +++ b/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb @@ -11,7 +11,7 @@ class Hash end # Called when object is nested under an object that receives - # #with_indifferent_access. This method with be called on the current object + # #with_indifferent_access. This method will be called on the current object # by the enclosing object and is aliased to #with_indifferent_access by # default. Subclasses of Hash may overwrite this method to return +self+ if # converting to an +ActiveSupport::HashWithIndifferentAccess+ would not be -- cgit v1.2.3 From 04c31e2a108d08bc142485488d06ac4a716fca7a Mon Sep 17 00:00:00 2001 From: thoefer Date: Sat, 11 Jun 2011 23:56:29 +0200 Subject: fixed typo for a methodname --- railties/lib/rails/railtie.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/lib/rails/railtie.rb b/railties/lib/rails/railtie.rb index 5f50943626..f96dd6b9eb 100644 --- a/railties/lib/rails/railtie.rb +++ b/railties/lib/rails/railtie.rb @@ -84,7 +84,7 @@ module Rails # == Loading rake tasks and generators # # If your railtie has rake tasks, you can tell Rails to load them through the method - # rake tasks: + # rake_tasks: # # class MyRailtie < Rails::Railtie # rake_tasks do -- cgit v1.2.3 From d48bbc895f08efd9b98e79986d1e9aeb43c1baef Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Sat, 11 Jun 2011 19:32:01 -0300 Subject: Add example for rails server port option. --- railties/guides/source/command_line.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/guides/source/command_line.textile b/railties/guides/source/command_line.textile index 57c71eee09..6110846b19 100644 --- a/railties/guides/source/command_line.textile +++ b/railties/guides/source/command_line.textile @@ -78,7 +78,7 @@ You can also use the alias "s" to start the server: rails s. The server can be run on a different port using the +-p+ option. The default development environment can be changed using +-e+. -$ rails server -e production +$ rails server -e production -p 4000 h4. +rails generate+ -- cgit v1.2.3 From 00b4756790b04272da3e1ce821a35cc5a9ab1c77 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sun, 12 Jun 2011 16:17:34 +0530 Subject: assets are in app now and not in public --- railties/guides/source/getting_started.textile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index 670979c3c2..7ae3da560e 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -177,14 +177,14 @@ In any case, Rails will create a folder in your working directory called blo |Gemfile|This file allows you to specify what gem dependencies are needed for your Rails application.| |README|This is a brief instruction manual for your application. Use it to tell others what your application does, how to set it up, and so on.| |Rakefile|This file contains batch jobs that can be run from the terminal.| -|app/|Contains the controllers, models, and views for your application. You'll focus on this folder for the remainder of this guide.| +|app/|Contains the controllers, models, views and assets for your application. You'll focus on this folder for the remainder of this guide.| |config/|Configure your application's runtime rules, routes, database, and more.| |config.ru|Rack configuration for Rack based servers used to start the application.| |db/|Shows your current database schema, as well as the database migrations. You'll learn about migrations shortly.| |doc/|In-depth documentation for your application.| |lib/|Extended modules for your application (not covered in this guide).| |log/|Application log files.| -|public/|The only folder seen to the world as-is. This is where your images, JavaScript files, stylesheets (CSS), and other static files go.| +|public/|The only folder seen to the world as-is. Contains the static files and compiled assets.| |script/|Contains the rails script that starts your app and can contain other scripts you use to deploy or run your application.| |test/|Unit tests, fixtures, and other test apparatus. These are covered in "Testing Rails Applications":testing.html| |tmp/|Temporary files| @@ -290,7 +290,7 @@ This will fire up an instance of the WEBrick web server by default (Rails can al 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 stop the server; changes you make in files will be automatically picked up by the server. -The "Welcome Aboard" page is the _smoke test_ for a new Rails application: it makes sure that you have your software configured correctly enough to serve a page. You can also click on the _About your application’s environment_ link to see a summary of your Application's environment. +The "Welcome Aboard" page is the _smoke test_ for a new Rails application: it makes sure that you have your software configured correctly enough to serve a page. You can also click on the _About your application’s environment_ link to see a summary of your application's environment. h4. Say "Hello", Rails @@ -364,11 +364,11 @@ The scaffold generator will build 15 files in your application, along with some |app/views/posts/new.html.erb |A view to create a new post| |app/views/posts/_form.html.erb |A partial to control the overall look and feel of the form used in edit and new views| |app/helpers/posts_helper.rb |Helper functions to be used from the post views| +|app/assets/stylesheets/scaffold.css.scss |Cascading style sheet to make the scaffolded views look better| |test/unit/post_test.rb |Unit testing harness for the posts model| |test/functional/posts_controller_test.rb |Functional testing harness for the posts controller| |test/unit/helpers/posts_helper_test.rb |Unit testing harness for the posts helper| |config/routes.rb |Edited to include routing information for posts| -|app/assets/stylesheets/scaffold.css.scss |Cascading style sheet to make the scaffolded views look better| h4. Running a Migration -- cgit v1.2.3 From 657ba2a9f089d68171bb1820d4aa278f7ed022ca Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Sun, 12 Jun 2011 10:31:21 -0500 Subject: Remove trailing whitespaces --- activemodel/lib/active_model/mass_assignment_security/sanitizer.rb | 2 +- .../lib/active_record/connection_adapters/postgresql_adapter.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/activemodel/lib/active_model/mass_assignment_security/sanitizer.rb b/activemodel/lib/active_model/mass_assignment_security/sanitizer.rb index ee43a6694f..bb0526adc3 100644 --- a/activemodel/lib/active_model/mass_assignment_security/sanitizer.rb +++ b/activemodel/lib/active_model/mass_assignment_security/sanitizer.rb @@ -19,7 +19,7 @@ module ActiveModel removed_keys = attributes.keys - sanitized_attributes.keys process_removed_attributes(removed_keys) if removed_keys.any? end - + def process_removed_attributes(attrs) raise NotImplementedError, "#process_removed_attributes(attrs) suppose to be overwritten" end diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 3e390ba994..1a24ed1375 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -806,7 +806,7 @@ module ActiveRecord if pk && sequence quoted_sequence = quote_table_name(sequence) - + select_value <<-end_sql, 'Reset sequence' SELECT setval('#{quoted_sequence}', (SELECT COALESCE(MAX(#{quote_column_name pk})+(SELECT increment_by FROM #{quoted_sequence}), (SELECT min_value FROM #{quoted_sequence})) FROM #{quote_table_name(table)}), false) end_sql @@ -835,7 +835,7 @@ module ActiveRecord else sequence = result.second+'.'+result.last end - + [result.first, sequence] rescue nil -- cgit v1.2.3 From d7a2431408429d0967d9b59f07c0d4637f744d71 Mon Sep 17 00:00:00 2001 From: Robert Massaioli Date: Mon, 13 Jun 2011 14:58:56 +1000 Subject: cycle: make an odd number be marked as odd. Just a minor issue that was annoying me so I thought that I would jump in and fix it. --- actionpack/lib/action_view/helpers/text_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb index 8f97eb7d75..472b996a5e 100644 --- a/actionpack/lib/action_view/helpers/text_helper.rb +++ b/actionpack/lib/action_view/helpers/text_helper.rb @@ -280,7 +280,7 @@ module ActionView # @items = [1,2,3,4] # # <% @items.each do |item| %> - # "> + # "> # # # <% end %> -- cgit v1.2.3 From 67a705f95241e447b996487e5c42f2245f83aca2 Mon Sep 17 00:00:00 2001 From: Lukas Stejskal Date: Mon, 13 Jun 2011 14:21:17 +0200 Subject: fix two typos: and array -> an array --- railties/guides/source/active_support_core_extensions.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 7512f7bcb9..16cacc9928 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -2282,7 +2282,7 @@ NOTE: Defined in +active_support/core_ext/array/grouping.rb+. h5. +in_groups(number, fill_with = nil)+ -The method +in_groups+ splits an array into a certain number of groups. The method returns and array with the groups: +The method +in_groups+ splits an array into a certain number of groups. The method returns an array with the groups: %w(1 2 3 4 5 6 7).in_groups(3) @@ -2714,7 +2714,7 @@ Active Support extends the method +Range#step+ so that it can be invoked without (1..10).step(2) # => [1, 3, 5, 7, 9] -As the example shows, in that case the method returns and array with the corresponding elements. +As the example shows, in that case the method returns an array with the corresponding elements. NOTE: Defined in +active_support/core_ext/range/blockless_step.rb+. -- cgit v1.2.3 From 3b4f04ab832b00806b2de78f1947d6438dd13f59 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Mon, 13 Jun 2011 23:14:15 +0530 Subject: document the instance_accessor option for cattr_accessor --- .../source/active_support_core_extensions.textile | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 16cacc9928..f9f7f2d83c 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -1036,18 +1036,24 @@ module ActionView end -we can access +field_error_proc+ in views. The generation of the writer instance method can be prevented by setting +:instance_writer+ to +false+ (not any false value, but exactly +false+): +we can access +field_error_proc+ in views. + +The generation of the reader instance method can be prevented by setting +:instance_reader+ to +false+ and the generation of the writer instance method can be prevented by setting +:instance_writer+ to +false+. Generation of both methods can be prevented by setting +:instance_accessor+ to +false+. In all cases, the value must be exactly +false+ and not any false value. -module ActiveRecord - class Base - # No pluralize_table_names= instance writer is generated. - cattr_accessor :pluralize_table_names, :instance_writer => false +module A + class B + # No first_name instance reader is generated. + cattr_accessor :first_name, :instance_reader => false + # No last_name= instance writer is generated. + cattr_accessor :last_name, :instance_writer => false + # No surname instance reader or surname= writer is generated. + cattr_accessor :surname, :instance_accessor => false end end -A model may find that option useful as a way to prevent mass-assignment from setting the attribute. +A model may find it useful to set +:instance_accessor+ to +false+ as a way to prevent mass-assignment from setting the attribute. NOTE: Defined in +active_support/core_ext/class/attribute_accessors.rb+. -- cgit v1.2.3 From 9db268db651bcd4d8a2ee5af7e37b4d2aeab98ec Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Tue, 14 Jun 2011 00:30:13 +0530 Subject: fix minor errors in nested model guide --- railties/guides/source/nested_model_forms.textile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/railties/guides/source/nested_model_forms.textile b/railties/guides/source/nested_model_forms.textile index 55694c0eb4..4b1fd2e0ac 100644 --- a/railties/guides/source/nested_model_forms.textile +++ b/railties/guides/source/nested_model_forms.textile @@ -90,7 +90,7 @@ h3. Views h4. Controller code -A nested model form will _only_ be build if the associated object(s) exist. This means that for a new model instance you would probably want to build the associated object(s) first. +A nested model form will _only_ be built if the associated object(s) exist. This means that for a new model instance you would probably want to build the associated object(s) first. Consider the following typical RESTful controller which will prepare a new Person instance and its +address+ and +projects+ associations before rendering the +new+ template: @@ -144,7 +144,7 @@ Now add a nested form for the +address+ association: <%= f.text_field :name %> <%= f.fields_for :address do |af| %> - <%= f.text_field :street %> + <%= af.text_field :street %> <% end %> <% end %> @@ -159,7 +159,7 @@ This generates: -Notice that +fields_for+ recognized the +address+ as an association for which a nested model form should be build by the way it has namespaced the +name+ attribute. +Notice that +fields_for+ recognized the +address+ as an association for which a nested model form should be built by the way it has namespaced the +name+ attribute. When this form is posted the Rails parameter parser will construct a hash like the following: @@ -185,7 +185,7 @@ The form code for an association collection is pretty similar to that of a singl <%= f.text_field :name %> <%= f.fields_for :projects do |pf| %> - <%= f.text_field :name %> + <%= pf.text_field :name %> <% end %> <% end %> @@ -201,7 +201,7 @@ Which generates: -As you can see it has generated 2 +project name+ inputs, one for each new +project+ that’s build in the controllers +new+ action. Only this time the +name+ attribute of the input contains a digit as an extra namespace. This will be parsed by the Rails parameter parser as: +As you can see it has generated 2 +project name+ inputs, one for each new +project+ that was built in the controller's +new+ action. Only this time the +name+ attribute of the input contains a digit as an extra namespace. This will be parsed by the Rails parameter parser as: { @@ -215,7 +215,7 @@ As you can see it has generated 2 +project name+ inputs, one for each new +proje } -You can basically see the +projects_attributes+ hash as an array of attribute hashes. One for each model instance. +You can basically see the +projects_attributes+ hash as an array of attribute hashes, one for each model instance. NOTE: The reason that +fields_for+ constructed a form which would result in a hash instead of an array is that it won't work for any forms nested deeper than one level deep. -- cgit v1.2.3 From 10c203508415767eb0a15f9da3a48e56f552c1ce Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Tue, 14 Jun 2011 10:53:38 -0300 Subject: Add Time#all_* to AS guides. --- .../source/active_support_core_extensions.textile | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index f9f7f2d83c..763e0d585b 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -3322,6 +3322,32 @@ Active Support defines +Time.current+ to be today in the current time zone. That When making Time comparisons using methods which honor the user time zone, make sure to use +Time.current+ and not +Time.now+. There are cases where the user time zone might be in the future compared to the system time zone, which +Time.today+ uses by default. This means +Time.now+ may equal +Time.yesterday+. +h5. +all_day+, +all_week+, +all_month+, +all_quarter+ and +all_year+ + +The method +all_day+ returns a range representing the whole day of the current time. + + +now = Time.now +# => Mon, 09 Aug 2010 23:20:05 UTC +00:00 +now.all_day +# => Mon, 09 Aug 2010 00:00:00 UTC +00:00..Mon, 09 Aug 2010 23:59:59 UTC +00:00 + + +Analogously, +all_week+, +all_month+, +all_quarter+ and +all_year+ all serve the purpose of generating time ranges. + + +now = Time.now +# => Mon, 09 Aug 2010 23:20:05 UTC +00:00 +now.all_week +# => Mon, 09 Aug 2010 00:00:00 UTC +00:00..Sun, 15 Aug 2010 23:59:59 UTC +00:00 +now.all_month +# => Sat, 01 Aug 2010 00:00:00 UTC +00:00..Tue, 31 Aug 2010 23:59:59 UTC +00:00 +now.all_quarter +# => Thu, 01 Jul 2010 00:00:00 UTC +00:00..Thu, 30 Sep 2010 23:59:59 UTC +00:00 +now.all_year +# => Fri, 01 Jan 2010 00:00:00 UTC +00:00..Fri, 31 Dec 2010 23:59:59 UTC +00:00 + + h4. Time Constructors Active Support defines +Time.current+ to be +Time.zone.now+ if there's a user time zone defined, with fallback to +Time.now+: -- cgit v1.2.3 From 0c1e630d181fdf63a03ce87b70820832f22d00d8 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Tue, 14 Jun 2011 11:01:00 -0300 Subject: Prefer Time.current over Time.now on example code --- railties/guides/source/active_support_core_extensions.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 763e0d585b..21708e0fba 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -3327,7 +3327,7 @@ h5. +all_day+, +all_week+, +all_month+, +all_quarter+ and +all_year+ The method +all_day+ returns a range representing the whole day of the current time. -now = Time.now +now = Time.current # => Mon, 09 Aug 2010 23:20:05 UTC +00:00 now.all_day # => Mon, 09 Aug 2010 00:00:00 UTC +00:00..Mon, 09 Aug 2010 23:59:59 UTC +00:00 @@ -3336,7 +3336,7 @@ now.all_day Analogously, +all_week+, +all_month+, +all_quarter+ and +all_year+ all serve the purpose of generating time ranges. -now = Time.now +now = Time.current # => Mon, 09 Aug 2010 23:20:05 UTC +00:00 now.all_week # => Mon, 09 Aug 2010 00:00:00 UTC +00:00..Sun, 15 Aug 2010 23:59:59 UTC +00:00 -- cgit v1.2.3 From f391f944283909b0416aec907e375543f70f267b Mon Sep 17 00:00:00 2001 From: JudeArasu Date: Tue, 14 Jun 2011 23:16:05 +0530 Subject: typo changes --- actionmailer/lib/rails/generators/mailer/USAGE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionmailer/lib/rails/generators/mailer/USAGE b/actionmailer/lib/rails/generators/mailer/USAGE index 448ddbd5df..7c24125bd8 100644 --- a/actionmailer/lib/rails/generators/mailer/USAGE +++ b/actionmailer/lib/rails/generators/mailer/USAGE @@ -10,7 +10,7 @@ Example: ======== rails generate mailer Notifications signup forgot_password invoice - creates a Notifications mailer class, views, test, and fixtures: + creates a Notifications mailer class, views, test and fixtures: Mailer: app/mailers/notifications.rb Views: app/views/notifications/signup.erb [...] Test: test/functional/notifications_test.rb -- cgit v1.2.3 From d5b1cf592b5e9e4363ff6ee87e33850ae7e9c929 Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Wed, 15 Jun 2011 07:36:04 +0530 Subject: Adding doc for Sqlite3 database for Jruby platform #jruby --- railties/guides/source/getting_started.textile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index 7ae3da560e..a3d8178eac 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -258,6 +258,16 @@ development: Change the username and password in the +development+ section as appropriate. +h5. Configuring an SQLite3 Database for Jruby Platform + +If you choose to use SQLite3 and using Jruby, your +config/database.yml+ will look a little different. Here's the development section: + + +development: + adapter: jdbcsqlite3 + database: db/development.sqlite3 + + TIP: You don't have to update the database configurations manually. If you had a look at the options of application generator, you have seen that one of them is named --database. It lets you choose an adapter for couple of most used relational databases. You can even run the generator repeatedly: cd .. && rails new blog --database=mysql. When you confirm the overwriting of the +config/database.yml+ file, your application will be configured for MySQL instead of SQLite. h4. Creating the Database -- cgit v1.2.3 From aed85375caad9bbbb3a97aa49cec22c5771d5f8b Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Wed, 15 Jun 2011 07:36:52 +0530 Subject: Added doc for Mysql database with Jruby platform #jruby --- railties/guides/source/getting_started.textile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index a3d8178eac..3549dd89ab 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -268,6 +268,18 @@ development: database: db/development.sqlite3 +h5. Configuring an Mysql Database for Jruby Platform + +If you choose to use Mysql and using Jruby, your +config/database.yml+ will look a little different. Here's the development section: + + +development: + adapter: jdbcmysql + database: blog_development + username: root + password: + + TIP: You don't have to update the database configurations manually. If you had a look at the options of application generator, you have seen that one of them is named --database. It lets you choose an adapter for couple of most used relational databases. You can even run the generator repeatedly: cd .. && rails new blog --database=mysql. When you confirm the overwriting of the +config/database.yml+ file, your application will be configured for MySQL instead of SQLite. h4. Creating the Database -- cgit v1.2.3 From 900dbca96536f6036a3621bd01b5c5a94386d51e Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Wed, 15 Jun 2011 07:38:08 +0530 Subject: Added Doc for Postgresql database with Jruby Platform. #jruby --- railties/guides/source/getting_started.textile | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index 3549dd89ab..459063ad4b 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -280,6 +280,19 @@ development: password: +h5. Configuring an PostgreSQL Database for Jruby Platform + +If you choose to use PostgreSQL and using Jruby, your +config/database.yml+ will look a little different. Here's the development section: + + +development: + adapter: jdbcpostgresql + encoding: unicode + database: blog_development + username: blog + password: + + TIP: You don't have to update the database configurations manually. If you had a look at the options of application generator, you have seen that one of them is named --database. It lets you choose an adapter for couple of most used relational databases. You can even run the generator repeatedly: cd .. && rails new blog --database=mysql. When you confirm the overwriting of the +config/database.yml+ file, your application will be configured for MySQL instead of SQLite. h4. Creating the Database -- cgit v1.2.3 From 8f05a2f7aeae0d1185417882d1939c9c0aba1379 Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Wed, 15 Jun 2011 07:39:24 +0530 Subject: Using "Finally" at the end of database section. --- railties/guides/source/getting_started.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index 459063ad4b..a6396c029a 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -244,7 +244,7 @@ If your development computer's MySQL installation includes a root user with an e h5. Configuring a PostgreSQL Database -Finally if you choose to use PostgreSQL, your +config/database.yml+ will be customized to use PostgreSQL databases: +If you choose to use PostgreSQL, your +config/database.yml+ will be customized to use PostgreSQL databases: development: @@ -282,7 +282,7 @@ development: h5. Configuring an PostgreSQL Database for Jruby Platform -If you choose to use PostgreSQL and using Jruby, your +config/database.yml+ will look a little different. Here's the development section: +Finally if you choose to use PostgreSQL and using Jruby, your +config/database.yml+ will look a little different. Here's the development section: development: -- cgit v1.2.3 From 57ace9868aa076ab2dc9763c0ef1892af0501fc3 Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Wed, 15 Jun 2011 07:40:49 +0530 Subject: Moving hint down. As required after all database examples. --- railties/guides/source/getting_started.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index a6396c029a..7bd300c188 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -256,8 +256,6 @@ development: password: -Change the username and password in the +development+ section as appropriate. - h5. Configuring an SQLite3 Database for Jruby Platform If you choose to use SQLite3 and using Jruby, your +config/database.yml+ will look a little different. Here's the development section: @@ -293,6 +291,8 @@ development: password: +Change the username and password in the +development+ section as appropriate. + TIP: You don't have to update the database configurations manually. If you had a look at the options of application generator, you have seen that one of them is named --database. It lets you choose an adapter for couple of most used relational databases. You can even run the generator repeatedly: cd .. && rails new blog --database=mysql. When you confirm the overwriting of the +config/database.yml+ file, your application will be configured for MySQL instead of SQLite. h4. Creating the Database -- cgit v1.2.3 From 0bdeddb97e61dbfde01e928cf577c7bf7cfd0592 Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Wed, 15 Jun 2011 10:45:05 +0530 Subject: Jruby => JRuby, Mysql => MySQL --- railties/guides/source/getting_started.textile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index 7bd300c188..5e9d37df85 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -256,9 +256,9 @@ development: password: -h5. Configuring an SQLite3 Database for Jruby Platform +h5. Configuring an SQLite3 Database for JRuby Platform -If you choose to use SQLite3 and using Jruby, your +config/database.yml+ will look a little different. Here's the development section: +If you choose to use SQLite3 and using JRuby, your +config/database.yml+ will look a little different. Here's the development section: development: @@ -266,9 +266,9 @@ development: database: db/development.sqlite3 -h5. Configuring an Mysql Database for Jruby Platform +h5. Configuring an MySQL Database for JRuby Platform -If you choose to use Mysql and using Jruby, your +config/database.yml+ will look a little different. Here's the development section: +If you choose to use MySQL and using JRuby, your +config/database.yml+ will look a little different. Here's the development section: development: @@ -278,9 +278,9 @@ development: password: -h5. Configuring an PostgreSQL Database for Jruby Platform +h5. Configuring an PostgreSQL Database for JRuby Platform -Finally if you choose to use PostgreSQL and using Jruby, your +config/database.yml+ will look a little different. Here's the development section: +Finally if you choose to use PostgreSQL and using JRuby, your +config/database.yml+ will look a little different. Here's the development section: development: -- cgit v1.2.3 From 045d9d2baeb0e733edcd7b1815132ac2a48b2d5a Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Wed, 15 Jun 2011 11:44:31 +0530 Subject: minor copy edit 0bdeddb --- railties/guides/source/getting_started.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index 5e9d37df85..3011f7136b 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -266,7 +266,7 @@ development: database: db/development.sqlite3 -h5. Configuring an MySQL Database for JRuby Platform +h5. Configuring a MySQL Database for JRuby Platform If you choose to use MySQL and using JRuby, your +config/database.yml+ will look a little different. Here's the development section: @@ -278,7 +278,7 @@ development: password: -h5. Configuring an PostgreSQL Database for JRuby Platform +h5. Configuring a PostgreSQL Database for JRuby Platform Finally if you choose to use PostgreSQL and using JRuby, your +config/database.yml+ will look a little different. Here's the development section: -- cgit v1.2.3 From 8da91036c0f6b4caf10e46db07f04d49398eea28 Mon Sep 17 00:00:00 2001 From: Christine Yen Date: Wed, 15 Jun 2011 01:55:57 -0700 Subject: Improve documentation around status code argument of redirect_to --- actionpack/lib/action_controller/metal/redirecting.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/actionpack/lib/action_controller/metal/redirecting.rb b/actionpack/lib/action_controller/metal/redirecting.rb index 55c650df6c..99e200caa5 100644 --- a/actionpack/lib/action_controller/metal/redirecting.rb +++ b/actionpack/lib/action_controller/metal/redirecting.rb @@ -42,7 +42,8 @@ module ActionController # redirect_to :action=>'atom', :status => 302 # # The status code can either be a standard {HTTP Status code}[http://www.iana.org/assignments/http-status-codes] as an - # integer, or a symbol representing the downcased, underscored and symbolized description. + # integer, or a symbol representing the downcased, underscored and symbolized description. Note that the status code + # must be a 3xx HTTP code, or redirection will not occur. # # It is also possible to assign a flash message as part of the redirection. There are two special accessors for commonly used the flash names # +alert+ and +notice+ as well as a general purpose +flash+ bucket. -- cgit v1.2.3 From 6d965355244055e7bef995f1a263cb1cd2993e45 Mon Sep 17 00:00:00 2001 From: thoefer Date: Wed, 15 Jun 2011 12:14:17 +0200 Subject: =?UTF-8?q?Updated=20rails=C2=B4s=20guides=20on=20the=20config.ser?= =?UTF-8?q?ve=5Fstatic=5Fassets=20and=20it=C2=B4s=20settings=20in=20produc?= =?UTF-8?q?tion=20mode=20using=20WEBrick.=20This=20documentation=20has=20i?= =?UTF-8?q?t=C2=B4s=20roots=20in=20#issue1657.=20You=20have=20to=20set=20c?= =?UTF-8?q?onfig.serve=5Fstatic=5Fassets=20to=20true=20in=20production=20m?= =?UTF-8?q?ode=20with=20WEBrick=20as=20only=20this=20includes=20ActionDisp?= =?UTF-8?q?atch::Static.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- railties/guides/source/configuring.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/guides/source/configuring.textile b/railties/guides/source/configuring.textile index a4cc62c117..84b5fbc73b 100644 --- a/railties/guides/source/configuring.textile +++ b/railties/guides/source/configuring.textile @@ -98,7 +98,7 @@ NOTE. The +config.asset_path+ configuration is ignored if the asset pipeline is * +config.secret_token+ used for specifying a key which allows sessions for the application to be verified against a known secure key to prevent tampering. Applications get +config.secret_token+ initialized to a random key in +config/initializers/secret_token.rb+. -* +config.serve_static_assets+ configures Rails to serve static assets. Defaults to true, but in the production environment is turned off. The server software used to run the application should be used to serve the assets instead. +* +config.serve_static_assets+ configures Rails itself to serve static assets. Defaults to true, but in the production environment is turned off as the server software (e.g. Nginx or Apache) used to run the application should serve static assets instead. Unlike the default setting set this to true when running (absolutely not recommended!) or testing your app in production mode using WEBrick. Otherwise you won´t be able use page caching and requests for files that exist regularly under the public directory will anyway hit your Rails app. * +config.session_store+ is usually set up in +config/initializers/session_store.rb+ and specifies what class to use to store the session. Possible values are +:cookie_store+ which is the default, +:mem_cache_store+, and +:disabled+. The last one tells Rails not to deal with sessions. Custom session stores can also be specified: -- cgit v1.2.3 From c6381657b7c9dbf38d2afad61c61ad000c190927 Mon Sep 17 00:00:00 2001 From: Christine Yen Date: Wed, 15 Jun 2011 03:15:27 -0700 Subject: Clarify importance of *_attributes= writer methods for nested fields --- actionpack/lib/action_view/helpers/form_helper.rb | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 7ed949504d..c1273e0f3d 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -517,6 +517,18 @@ module ActionView # end # end # + # Note that the projects_attributes= writer method is in fact + # required for fields_for to correctly identify :projects as a + # collection, and the correct indices to be set in the form markup. + # + # When projects is already an association on Person you can use + # +accepts_nested_attributes_for+ to define the writer method for you: + # + # class Person < ActiveRecord::Base + # has_many :projects + # accepts_nested_attributes_for :projects + # end + # # This model can now be used with a nested fields_for. The block given to # the nested fields_for call will be repeated for each instance in the # collection: @@ -568,14 +580,6 @@ module ActionView # ... # <% end %> # - # When projects is already an association on Person you can use - # +accepts_nested_attributes_for+ to define the writer method for you: - # - # class Person < ActiveRecord::Base - # has_many :projects - # accepts_nested_attributes_for :projects - # end - # # If you want to destroy any of the associated models through the # form, you have to enable it first using the :allow_destroy # option for +accepts_nested_attributes_for+: -- cgit v1.2.3 From 0a67b745be4eeb756160e6fa690e6551e0dde5ab Mon Sep 17 00:00:00 2001 From: Christine Yen Date: Wed, 15 Jun 2011 03:18:28 -0700 Subject: Tweak linebreak in ActionController::Redirecting doc --- actionpack/lib/action_controller/metal/redirecting.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/actionpack/lib/action_controller/metal/redirecting.rb b/actionpack/lib/action_controller/metal/redirecting.rb index 99e200caa5..dee7eb1ec8 100644 --- a/actionpack/lib/action_controller/metal/redirecting.rb +++ b/actionpack/lib/action_controller/metal/redirecting.rb @@ -42,8 +42,8 @@ module ActionController # redirect_to :action=>'atom', :status => 302 # # The status code can either be a standard {HTTP Status code}[http://www.iana.org/assignments/http-status-codes] as an - # integer, or a symbol representing the downcased, underscored and symbolized description. Note that the status code - # must be a 3xx HTTP code, or redirection will not occur. + # integer, or a symbol representing the downcased, underscored and symbolized description. + # Note that the status code must be a 3xx HTTP code, or redirection will not occur. # # It is also possible to assign a flash message as part of the redirection. There are two special accessors for commonly used the flash names # +alert+ and +notice+ as well as a general purpose +flash+ bucket. -- cgit v1.2.3 From 77c8cd75162e0771dd45930a4309d3183707731a Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Wed, 15 Jun 2011 18:56:22 +0530 Subject: form => form_for --- actionpack/lib/action_view/helpers/form_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index c1273e0f3d..649acffa77 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -290,7 +290,7 @@ module ActionView # # Example: # - # <%= form(@post) do |f| %> + # <%= form_for(@post) do |f| %> # <% f.fields_for(:comments, :include_id => false) do |cf| %> # ... # <% end %> -- cgit v1.2.3 From b62c5493d1e8c06c3189f47c29515c8bc8b5e123 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Wed, 15 Jun 2011 12:38:01 -0400 Subject: The name for the plain text template in Rails3 appears to be method.text.erb, not, method.text.plain.erb. Updated the doc to reflect this change. Also fixed a reference to an example that was incorrect. --- actionmailer/lib/action_mailer/base.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 3b4e59d703..085afb57c1 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -57,7 +57,7 @@ module ActionMailer #:nodoc: # will accept (any valid Email header including optional fields). # # The mail method, if not passed a block, will inspect your views and send all the views with - # the same name as the method, so the above action would send the +welcome.text.plain.erb+ view + # the same name as the method, so the above action would send the +welcome.text.erb+ view # file as well as the +welcome.text.html.erb+ view file in a +multipart/alternative+ email. # # If you want to explicitly render only certain templates, pass a block: @@ -88,7 +88,7 @@ module ActionMailer #:nodoc: # # To define a template to be used with a mailing, create an .erb file with the same # name as the method in your mailer model. For example, in the mailer defined above, the template at - # app/views/notifier/signup_notification.text.plain.erb would be used to generate the email. + # app/views/notifier/welcome.text.erb would be used to generate the email. # # Variables defined in the model are accessible as instance variables in the view. # @@ -153,7 +153,7 @@ module ActionMailer #:nodoc: # by the content type. Each such detected template will be added as separate part to the message. # # For example, if the following templates exist: - # * signup_notification.text.plain.erb + # * signup_notification.text.erb # * signup_notification.text.html.erb # * signup_notification.text.xml.builder # * signup_notification.text.yaml.erb @@ -178,7 +178,7 @@ module ActionMailer #:nodoc: # end # end # - # Which will (if it had both a welcome.text.plain.erb and welcome.text.html.erb + # Which will (if it had both a welcome.text.erb and welcome.text.html.erb # template in the view directory), send a complete multipart/mixed email with two parts, # the first part being a multipart/alternative with the text and HTML email parts inside, # and the second being a application/pdf with a Base64 encoded copy of the file.pdf book -- cgit v1.2.3 From 3e441596509bbb5eb485c60efe78a629c028562e Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Wed, 15 Jun 2011 22:53:26 +0530 Subject: document how rake notes work --- railties/guides/source/command_line.textile | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/railties/guides/source/command_line.textile b/railties/guides/source/command_line.textile index 6110846b19..c71baa76d1 100644 --- a/railties/guides/source/command_line.textile +++ b/railties/guides/source/command_line.textile @@ -402,7 +402,28 @@ If you want to strip out or rebuild any of the Rails documentation (including th h4. +notes+ -These tasks will search through your code for commented lines beginning with "FIXME", "OPTIMIZE", "TODO", or any custom annotation (like XXX) and show you them. ++rake notes+ will search through your code for comments beginning with FIXME, OPTIMIZE or TODO. This checks only for files with extension +.builder+, +.rb+, +.rxml+, +.rhtml+ and +.erb+. + + +$ rake notes +(in /home/foobar/commandsapp) +app/controllers/admin/users_controller.rb: + * [ 20] [TODO] any other way to do this? + * [132] [FIXME] high priority for next deploy + +app/model/school.rb: + * [ 13] [OPTIMIZE] refactor this code to make it faster + * [ 17] [FIXME] + + +You can also use custom annotations in your code and list them using +rake notes:custom+ and specify the annotation using an environment variable +ANNOTATION+. + + +$ rake notes:custom ANNOTATION=BUG +(in /home/foobar/commandsapp) +app/model/post.rb: + * [ 23] Have to fix this one before pushing! + h4. +routes+ -- cgit v1.2.3 From 406d61ee8c0311f742ac74b9a15845cc3cd214d3 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Wed, 15 Jun 2011 23:26:19 +0530 Subject: add details on how to use specific annotations in rake:notes --- railties/guides/source/command_line.textile | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/railties/guides/source/command_line.textile b/railties/guides/source/command_line.textile index c71baa76d1..03ff3097da 100644 --- a/railties/guides/source/command_line.textile +++ b/railties/guides/source/command_line.textile @@ -402,7 +402,7 @@ If you want to strip out or rebuild any of the Rails documentation (including th h4. +notes+ -+rake notes+ will search through your code for comments beginning with FIXME, OPTIMIZE or TODO. This checks only for files with extension +.builder+, +.rb+, +.rxml+, +.rhtml+ and +.erb+. ++rake notes+ will search through your code for comments beginning with FIXME, OPTIMIZE or TODO. The search is only done in files with extension +.builder+, +.rb+, +.rxml+, +.rhtml+ and +.erb+ for both default and custom annotations. $ rake notes @@ -416,7 +416,19 @@ app/model/school.rb: * [ 17] [FIXME] -You can also use custom annotations in your code and list them using +rake notes:custom+ and specify the annotation using an environment variable +ANNOTATION+. +If you are looking for a specific annotation, say FIXME, you can use +rake notes:fixme+. Note that you have to lower case the annotation's name. + + +$ rake notes:fixme +(in /home/foobar/commandsapp) +app/controllers/admin/users_controller.rb: + * [132] high priority for next deploy + +app/model/school.rb: + * [ 17] + + +You can also use custom annotations in your code and list them using +rake notes:custom+ by specifying the annotation using an environment variable +ANNOTATION+. $ rake notes:custom ANNOTATION=BUG @@ -425,6 +437,8 @@ app/model/post.rb: * [ 23] Have to fix this one before pushing! +NOTE. When using specific annotations and custom annotations, the annotation name (FIXME, BUG etc) is not displayed in the output lines. + h4. +routes+ +rake routes+ will list all of your defined routes, which is useful for tracking down routing problems in your app, or giving you a good overview of the URLs in an app you're trying to get familiar with. -- cgit v1.2.3 From 0dd9db871d78408db7b1fe7397c3fcf7c9ffb541 Mon Sep 17 00:00:00 2001 From: JudeAr Date: Wed, 15 Jun 2011 22:04:20 -0700 Subject: fixed typo chnages --- railties/guides/source/command_line.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/guides/source/command_line.textile b/railties/guides/source/command_line.textile index 03ff3097da..bedb9fc6d9 100644 --- a/railties/guides/source/command_line.textile +++ b/railties/guides/source/command_line.textile @@ -527,7 +527,7 @@ NOTE. The only catch with using the SCM options is that you have to make your ap h4(#different-servers). +server+ with Different Backends -Many people have created a large number different web servers in Ruby, and many of them can be used to run Rails. Since version 2.3, Rails uses Rack to serve its webpages, which means that any webserver that implements a Rack handler can be used. This includes WEBrick, Mongrel, Thin, and Phusion Passenger (to name a few!). +Many people have created a large number of different web servers in Ruby, and many of them can be used to run Rails. Since version 2.3, Rails uses Rack to serve its webpages, which means that any webserver that implements a Rack handler can be used. This includes WEBrick, Mongrel, Thin, and Phusion Passenger (to name a few!). NOTE: For more details on the Rack integration, see "Rails on Rack":rails_on_rack.html. -- cgit v1.2.3 From cbf2af1e81fcae8c0ee4472e7bb0620c77786106 Mon Sep 17 00:00:00 2001 From: JudeAr Date: Wed, 15 Jun 2011 22:15:53 -0700 Subject: typo changes fixed --- railties/guides/source/command_line.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/guides/source/command_line.textile b/railties/guides/source/command_line.textile index bedb9fc6d9..8c78cab84f 100644 --- a/railties/guides/source/command_line.textile +++ b/railties/guides/source/command_line.textile @@ -3,7 +3,7 @@ h2. A Guide to The Rails Command Line Rails comes with every command line tool you'll need to * Create a Rails application -* Generate models, controllers, database migrations, and unit tests +* Generate models, controllers, database migrations and unit tests * Start a development server * Experiment with objects through an interactive shell * Profile and benchmark your new creation -- cgit v1.2.3 From bfb022adae4b8f6ba35872531bc5774b72fbe467 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Thu, 16 Jun 2011 12:29:47 +0530 Subject: document doc:* rake tasks --- railties/guides/source/command_line.textile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/railties/guides/source/command_line.textile b/railties/guides/source/command_line.textile index 8c78cab84f..b42fdac7e4 100644 --- a/railties/guides/source/command_line.textile +++ b/railties/guides/source/command_line.textile @@ -398,7 +398,13 @@ More information about migrations can be found in the "Migrations":migrations.ht h4. +doc+ -If you want to strip out or rebuild any of the Rails documentation (including this guide!), the +doc:+ namespace has the tools. Stripping documentation is mainly useful for slimming your codebase, like if you're writing a Rails application for an embedded platform. +The +doc:+ namespace has the tools to generate documentation for your app, API documentation, guides. Documentation can also be stripped which is mainly useful for slimming your codebase, like if you're writing a Rails application for an embedded platform. + +* +rake doc:app+ generates documentation for your application in +doc/app+. +* +rake doc:guides+ generates Rails guides in +doc/guides+. +* +rake doc:rails+ generates API documentation for Rails in +doc/api+. +* +rake doc:plugins+ generates API documentation for all the plugins installed in the application in +doc/plugins+. +* +rake doc:clobber_plugins+ removes the generated documentation for all plugins. h4. +notes+ -- cgit v1.2.3 From 7c2db6ce37aa37014ad216e0f5070c6b147382e7 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Thu, 16 Jun 2011 22:48:47 +0530 Subject: add info that plugin installs need git or svn installed --- railties/guides/source/command_line.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/guides/source/command_line.textile b/railties/guides/source/command_line.textile index b42fdac7e4..dd21fb0e93 100644 --- a/railties/guides/source/command_line.textile +++ b/railties/guides/source/command_line.textile @@ -292,7 +292,7 @@ You can also use the alias "db" to invoke the dbconsole: rails db. h4. +rails plugin+ -The +rails plugin+ command simplifies plugin management; think a miniature version of the Gem utility. +The +rails plugin+ command simplifies plugin management. Plugins can be installed by name or their repository urls. You need to have git installed if you want to install a plugin from a git repo. The same holds for Subversion too. $ rails plugin install https://github.com/technoweenie/acts_as_paranoid.git -- cgit v1.2.3 From 07d62ff7191f3334dffece1495a38b35f5669cbf Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Thu, 16 Jun 2011 22:48:05 +0530 Subject: minor clean up generators section --- railties/guides/source/command_line.textile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/railties/guides/source/command_line.textile b/railties/guides/source/command_line.textile index dd21fb0e93..43f2aad5bf 100644 --- a/railties/guides/source/command_line.textile +++ b/railties/guides/source/command_line.textile @@ -83,7 +83,7 @@ $ rails server -e production -p 4000 h4. +rails generate+ -The +rails generate+ command uses templates to create a whole lot of things. You can always find out what's available by running +rails generate+ by itself. Let's do that: +The +rails generate+ command uses templates to create a whole lot of things. Running +rails generate+ by itself gives a list of available generators: $ rails generate @@ -103,7 +103,7 @@ Rails: NOTE: You can install more generators through generator gems, portions of plugins you'll undoubtedly install, and you can even create your own! -Using generators will save you a large amount of time by writing *boilerplate code*, code that is necessary for the app to work, but not necessary for you to spend time writing. That's what we have computers for. +Using generators will save you a large amount of time by writing *boilerplate code*, code that is necessary for the app to work. Let's make our own controller with the controller generator. But what command should we use? Let's ask the generator: @@ -152,7 +152,8 @@ $ rails generate controller Greetings hello create test/unit/helpers/greetings_helper_test.rb invoke assets create app/assets/javascripts/greetings.js - create app/assets/stylesheets/greetings.css + invoke css + create app/assets/stylesheets/greetings.css @@ -188,7 +189,7 @@ The URL will be "http://localhost:3000/greetings/hello":http://localhost:3000/gr 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. -Rails comes with a generator for data models too: +Rails comes with a generator for data models too. $ rails generate model -- cgit v1.2.3 From 6ca18f9037b8ce86d9fd3e19be754cc3f97de0fd Mon Sep 17 00:00:00 2001 From: "R.T. Lechow" Date: Thu, 16 Jun 2011 15:39:22 -0400 Subject: Typo. --- actionpack/lib/action_view/helpers/form_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 649acffa77..3debc9cc66 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -219,9 +219,9 @@ module ActionView # <% end %> # # If you have an object that needs to be represented as a different - # parameter, like a Client that acts as a Person: + # parameter, like a Person that acts as a Client: # - # <%= form_for(@post, :as => :client) do |f| %> + # <%= form_for(@person, :as => :client) do |f| %> # ... # <% end %> # -- cgit v1.2.3 From 144a388dec5ae906e8a6900f37706e795188b066 Mon Sep 17 00:00:00 2001 From: Lucia Escanellas Date: Fri, 17 Jun 2011 15:55:07 -0300 Subject: Update remove_index documentation * Changes should better reflect present code behavior * Related to issue: https://github.com/rails/rails/issues/1624 --- .../connection_adapters/abstract/schema_definitions.rb | 10 +++++----- .../connection_adapters/abstract/schema_statements.rb | 8 ++++---- activerecord/lib/active_record/migration.rb | 6 ++++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb index 70a8f6bb58..a9e3c83eb0 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb @@ -386,13 +386,13 @@ module ActiveRecord # Removes the given index from the table. # # ===== Examples - # ====== Remove the suppliers_name_index in the suppliers table - # t.remove_index :name - # ====== Remove the index named accounts_branch_id_index in the accounts table + # ====== Remove the index_table_name_on_column in the table_name table + # t.remove_index :column + # ====== Remove the index named index_table_name_on_branch_id in the table_name table # t.remove_index :column => :branch_id - # ====== Remove the index named accounts_branch_id_party_id_index in the accounts table + # ====== Remove the index named index_table_name_on_branch_id_and_party_id in the table_name table # t.remove_index :column => [:branch_id, :party_id] - # ====== Remove the index named by_branch_party in the accounts table + # ====== Remove the index named by_branch_party in the table_name table # t.remove_index :name => :by_branch_party def remove_index(options = {}) @base.remove_index(@table_name, options) diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb index 74c07c624d..8e3ba1297e 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -346,11 +346,11 @@ module ActiveRecord # Remove the given index from the table. # - # Remove the suppliers_name_index in the suppliers table. - # remove_index :suppliers, :name - # Remove the index named accounts_branch_id_index in the accounts table. + # Remove the index_accounts_on_column in the accounts table. + # remove_index :accounts, :column + # Remove the index named index_accounts_on_branch_id in the accounts table. # remove_index :accounts, :column => :branch_id - # Remove the index named accounts_branch_id_party_id_index in the accounts table. + # Remove the index named index_accounts_on_branch_id_and_party_id in the accounts table. # remove_index :accounts, :column => [:branch_id, :party_id] # Remove the index named by_branch_party in the accounts table. # remove_index :accounts, :name => :by_branch_party diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index de26b21f1a..3d1bc5c1e0 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -116,8 +116,10 @@ module ActiveRecord # with the name of the column. Other options include # :name and :unique (e.g. # { :name => "users_name_index", :unique => true }). - # * remove_index(table_name, index_name): Removes the index specified - # by +index_name+. + # * remove_index(table_name, :column => column_name): Removes the index + # specified by +column_name+. + # * remove_index(table_name, :name => index_name): Removes the index + # specified by +index_name+. # # == Irreversible transformations # -- cgit v1.2.3 From c56618ec0dccc20dc23b993d2f71225be71cbc75 Mon Sep 17 00:00:00 2001 From: Jason Noble Date: Fri, 17 Jun 2011 14:12:11 -0700 Subject: Change ActiveRecord and ActionPack links to point to the right place --- README.rdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rdoc b/README.rdoc index 7e2d7850c8..4a9a56d390 100644 --- a/README.rdoc +++ b/README.rdoc @@ -18,7 +18,7 @@ you to present the data from database rows as objects and embellish these data o with business logic methods. Although most Rails models are backed by a database, models can also be ordinary Ruby classes, or Ruby classes that implement a set of interfaces as provided by the ActiveModel module. You can read more about Active Record in its -{README}[link:files/activerecord/README_rdoc.html]. +{README}[link:master/activerecord/README_rdoc.html]. The Controller layer is responsible for handling incoming HTTP requests and providing a suitable response. Usually this means returning HTML, but Rails controllers can also @@ -29,7 +29,7 @@ In Rails, the Controller and View layers are handled together by Action Pack. These two layers are bundled in a single package due to their heavy interdependence. This is unlike the relationship between the Active Record and Action Pack which are independent. Each of these packages can be used independently outside of Rails. You -can read more about Action Pack in its {README}[link:files/actionpack/README_rdoc.html]. +can read more about Action Pack in its {README}[link:master/actionpack/README_rdoc.html]. == Getting Started -- cgit v1.2.3 From 51cb74596a8caaff7500fa6a8813b867e9e8dd80 Mon Sep 17 00:00:00 2001 From: Jason Noble Date: Fri, 17 Jun 2011 14:13:30 -0700 Subject: Change ActiveRecord and ActionPack links to point to the right place --- README.rdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rdoc b/README.rdoc index 4a9a56d390..2de83670b3 100644 --- a/README.rdoc +++ b/README.rdoc @@ -18,7 +18,7 @@ you to present the data from database rows as objects and embellish these data o with business logic methods. Although most Rails models are backed by a database, models can also be ordinary Ruby classes, or Ruby classes that implement a set of interfaces as provided by the ActiveModel module. You can read more about Active Record in its -{README}[link:master/activerecord/README_rdoc.html]. +{README}[link:master/activerecord/README.html]. The Controller layer is responsible for handling incoming HTTP requests and providing a suitable response. Usually this means returning HTML, but Rails controllers can also @@ -29,7 +29,7 @@ In Rails, the Controller and View layers are handled together by Action Pack. These two layers are bundled in a single package due to their heavy interdependence. This is unlike the relationship between the Active Record and Action Pack which are independent. Each of these packages can be used independently outside of Rails. You -can read more about Action Pack in its {README}[link:master/actionpack/README_rdoc.html]. +can read more about Action Pack in its {README}[link:master/actionpack/README.html]. == Getting Started -- cgit v1.2.3 From 030950a7ee67d8e525ee39c6d53e18b762303f37 Mon Sep 17 00:00:00 2001 From: Jason Noble Date: Fri, 17 Jun 2011 14:13:54 -0700 Subject: Change ActiveRecord and ActionPack links to point to the right place --- README.rdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rdoc b/README.rdoc index 2de83670b3..344a29073f 100644 --- a/README.rdoc +++ b/README.rdoc @@ -18,7 +18,7 @@ you to present the data from database rows as objects and embellish these data o with business logic methods. Although most Rails models are backed by a database, models can also be ordinary Ruby classes, or Ruby classes that implement a set of interfaces as provided by the ActiveModel module. You can read more about Active Record in its -{README}[link:master/activerecord/README.html]. +{README}[link:master/activerecord/README.rdoc]. The Controller layer is responsible for handling incoming HTTP requests and providing a suitable response. Usually this means returning HTML, but Rails controllers can also @@ -29,7 +29,7 @@ In Rails, the Controller and View layers are handled together by Action Pack. These two layers are bundled in a single package due to their heavy interdependence. This is unlike the relationship between the Active Record and Action Pack which are independent. Each of these packages can be used independently outside of Rails. You -can read more about Action Pack in its {README}[link:master/actionpack/README.html]. +can read more about Action Pack in its {README}[link:master/actionpack/README.rdoc]. == Getting Started -- cgit v1.2.3 From 0fd52bb6c79f20b8dbd5c8afb774ef1dae155fc4 Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Sat, 18 Jun 2011 11:16:10 +1000 Subject: Added 'Configuring Assets' section to configuring guide --- railties/guides/source/configuring.textile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/railties/guides/source/configuring.textile b/railties/guides/source/configuring.textile index 84b5fbc73b..ca11f757ff 100644 --- a/railties/guides/source/configuring.textile +++ b/railties/guides/source/configuring.textile @@ -116,8 +116,23 @@ WARNING: Threadsafe operation is incompatible with the normal workings of develo * +config.whiny_nils+ enables or disables warnings when a certain set of methods are invoked on +nil+ and it does not respond to them. Defaults to true in development and test environments. +h4. Configuring Assets + +Rails 3.1, by default, is set up to use the +sprockets+ gem to manage assets within an application. This gem concatenates and compresses assets in order to make serving them much less painful. + +* +config.assets.css_compressor+ defines the CSS compressor to use. Only supported value at the moment is +:yui+, which uses the +yui-compressor+ gem. + * +config.assets.enabled+ a flag that controls whether the asset pipeline is enabled. It is explicitly initialized in +config/application.rb+. +* +config.assets.js_compressor+ defines the JavaScript compressor to use. Possible values are +:closure+, +:uglifier+ and +:yui+ which require the use of the +closure-compiler+, +uglifier+ or +yui-compressor+ gems respectively. + +* +config.assets.paths+ contains the paths which are used to look for assets. Appending paths to this configuration option will cause those paths to be used in the search for assets. + +* +config.assets.precompile+ allows you to specify additional assets (other than +application.css+ and +application.js+) which are to be precompiled when +rake assets:precompile+ is run. + +* +config.assets.prefix+ defines the prefix where assets are served from. Defaults to +/assets+. + + h4. Configuring Generators Rails 3 allows you to alter what generators are used with the +config.generators+ method. This method takes a block: -- cgit v1.2.3
item