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(-) (limited to 'railties') 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(-) (limited to 'railties') 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(-) (limited to 'railties') 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(+) (limited to 'railties') 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(-) (limited to 'railties') 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(-) (limited to 'railties') 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(-) (limited to 'railties') 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(+) (limited to 'railties') 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 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(-) (limited to 'railties') 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(-) (limited to 'railties') 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(-) (limited to 'railties') 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 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(-) (limited to 'railties') 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(-) (limited to 'railties') 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(-) (limited to 'railties') 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(+) (limited to 'railties') 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(-) (limited to 'railties') 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 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(+) (limited to 'railties') 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(+) (limited to 'railties') 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(+) (limited to 'railties') 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(-) (limited to 'railties') 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(-) (limited to 'railties') 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(-) (limited to 'railties') 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(-) (limited to 'railties') 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 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(-) (limited to 'railties') 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 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(-) (limited to 'railties') 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(-) (limited to 'railties') 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(-) (limited to 'railties') 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(-) (limited to 'railties') 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(-) (limited to 'railties') 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(-) (limited to 'railties') 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(-) (limited to 'railties') 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 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(+) (limited to 'railties') 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