diff options
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/action_view_overview.textile | 2 | ||||
-rw-r--r-- | guides/source/active_model_basics.textile | 5 | ||||
-rw-r--r-- | guides/source/ajax_on_rails.textile | 4 | ||||
-rw-r--r-- | guides/source/asset_pipeline.textile | 12 | ||||
-rw-r--r-- | guides/source/form_helpers.textile | 2 | ||||
-rw-r--r-- | guides/source/initialization.textile | 2 |
6 files changed, 11 insertions, 16 deletions
diff --git a/guides/source/action_view_overview.textile b/guides/source/action_view_overview.textile index fd1b6c5fc2..bde30ba21c 100644 --- a/guides/source/action_view_overview.textile +++ b/guides/source/action_view_overview.textile @@ -59,7 +59,6 @@ Now we'll create a simple "Hello World" application that uses the +titleize+ met *hello_world.rb:* <ruby> -require 'rubygems' require 'active_support/core_ext/string/inflections' require 'rack' @@ -94,7 +93,6 @@ Now we'll create the same "Hello World" application in Sinatra. *hello_world.rb:* <ruby> -require 'rubygems' require 'action_view' require 'sinatra' diff --git a/guides/source/active_model_basics.textile b/guides/source/active_model_basics.textile index 98b3533000..d373f4ac85 100644 --- a/guides/source/active_model_basics.textile +++ b/guides/source/active_model_basics.textile @@ -20,7 +20,7 @@ class Person attribute_method_prefix 'reset_' attribute_method_suffix '_highest?' - define_attribute_methods ['age'] + define_attribute_methods 'age' attr_accessor :age @@ -95,12 +95,11 @@ h4. Dirty An object becomes dirty when an object is gone through one or more changes to its attributes and not yet saved. This gives the ability to check whether an object has been changed or not. It also has attribute based accessor methods. Lets consider a Person class with attributes first_name and last_name <ruby> -require 'rubygems' require 'active_model' class Person include ActiveModel::Dirty - define_attribute_methods [:first_name, :last_name] + define_attribute_methods :first_name, :last_name def first_name @first_name diff --git a/guides/source/ajax_on_rails.textile b/guides/source/ajax_on_rails.textile index cda9c64460..bfd007490a 100644 --- a/guides/source/ajax_on_rails.textile +++ b/guides/source/ajax_on_rails.textile @@ -78,7 +78,7 @@ will produce <ruby> button_to('Destroy', 'http://www.example.com', :confirm => 'Are you sure?', - :method => "delete", :remote => true, :disable_with => 'loading...') + :method => "delete", :remote => true, 'data-disable-with' => 'loading...') </ruby> will produce @@ -87,7 +87,7 @@ will produce <form class='button_to' method='post' action='http://www.example.com' data-remote='true'> <div> <input name='_method' value='delete' type='hidden' /> - <input value='Destroy' type='submit' disable_with='loading...' data-confirm='Are you sure?' /> + <input value='Destroy' type='submit' data-disable-with='loading...' data-confirm='Are you sure?' /> </div> </form> </html> diff --git a/guides/source/asset_pipeline.textile b/guides/source/asset_pipeline.textile index 59f106acb2..116a0a371a 100644 --- a/guides/source/asset_pipeline.textile +++ b/guides/source/asset_pipeline.textile @@ -518,7 +518,7 @@ A robust configuration for Apache is possible but tricky; please Google around. h4. Local Precompilation -There are several reasons why you might precompile your assets locally. Among them are: +There are several reasons why you might want to precompile your assets locally. Among them are: * You may not have write access to your production file system. * You may be deploying to more than one server, and want to avoid the duplication of work. @@ -528,10 +528,10 @@ Local compilation allows you to commit the compiled files into source control, a There are two caveats: -* You must not run the Capistrano deployment task. +* You must not run the Capistrano deployment task that precompiles assets. * You must change the following two application configuration settings. -In development.rb place the following line: +In <tt>config/environments/development.rb</tt>, place the following line: <erb> config.assets.prefix = "/dev-assets" @@ -543,11 +543,9 @@ You will also need this in application.rb: config.assets.initialize_on_precompile = false </erb> -The +prefix+ change makes rails use a different URL for serving assets in development mode, and so pass all requests to Sprockets. Production is still set to +/assets+. Without this changes the application would serve the precompiled assets in development, and you would not see any local changes until you next compiled assets. +The +prefix+ change makes Rails use a different URL for serving assets in development mode, and pass all requests to Sprockets. The prefix is still set to +/assets+ in the production environment. Without this change, the application would serve the precompiled assets from +public/assets+ in development, and you would not see any local changes until you compile assets again. -The +initialize_on_precompile+ change tell the precompile task to run without invoking Rails. - -You will also need to ensure that any compressors or minifers are available on you development system. +The +initialize_on_precompile+ change tell the precompile task to run without invoking Rails. You will also need to ensure that any compressors or minifiers are available on your development system. In practice, this will allow you to precompile locally, have those files in your working tree, and commit those files to source control when needed. Development mode will work as expected. diff --git a/guides/source/form_helpers.textile b/guides/source/form_helpers.textile index b6420db798..711ed3d859 100644 --- a/guides/source/form_helpers.textile +++ b/guides/source/form_helpers.textile @@ -405,6 +405,8 @@ Whenever Rails sees that the internal value of an option being generated matches TIP: The second argument to +options_for_select+ must be exactly equal to the desired internal value. In particular if the value is the integer 2 you cannot pass "2" to +options_for_select+ -- you must pass 2. Be aware of values extracted from the +params+ hash as they are all strings. +WARNING: when +:inlude_blank+ or +:prompt:+ are not present, +:include_blank+ is forced true if the select attribute +required+ is true, display +size+ is one and +multiple+ is not true. + h4. Select Boxes for Dealing with Models In most cases form controls will be tied to a specific database model and as you might expect Rails provides helpers tailored for that purpose. Consistent with other form helpers, when dealing with models you drop the +_tag+ suffix from +select_tag+: diff --git a/guides/source/initialization.textile b/guides/source/initialization.textile index 69e5c1edcc..155a439e64 100644 --- a/guides/source/initialization.textile +++ b/guides/source/initialization.textile @@ -137,8 +137,6 @@ h4. +config/boot.rb+ +config/boot.rb+ contains this: <ruby> -require 'rubygems' - # Set up gems listed in the Gemfile. gemfile = File.expand_path('../../Gemfile', __FILE__) begin |