From 0ddec98b950ad73028c6c11f7d0b7a19e96687d7 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Wed, 2 May 2012 01:29:46 +0530 Subject: copy-edit guide [ci skip] --- guides/source/command_line.textile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'guides') diff --git a/guides/source/command_line.textile b/guides/source/command_line.textile index 95a01710b5..6dc78880f8 100644 --- a/guides/source/command_line.textile +++ b/guides/source/command_line.textile @@ -446,8 +446,7 @@ app/model/post.rb: NOTE. When using specific annotations and custom annotations, the annotation name (FIXME, BUG etc) is not displayed in the output lines. -Be default, rake notes will look in the app, config, lib, script and test directories for notes. If you would like to search additional directories, -simply provide the directories as a comma seperated list in an environment variable +SOURCE_ANNOTATION_DIRECTORIES+. +By default, +rake notes+ will look in the +app+, +config+, +lib+, +script+ and +test+ directories. If you would like to search other directories, you can provide them as a comma separated list in an environment variable +SOURCE_ANNOTATION_DIRECTORIES+. $ export SOURCE_ANNOTATION_DIRECTORIES='rspec,vendor' -- cgit v1.2.3 From 7273adabed9a3a7aa04014e50ec0ad077ee364aa Mon Sep 17 00:00:00 2001 From: Teng Siong Ong Date: Thu, 3 May 2012 03:28:32 -0500 Subject: cache_store has an extra option of :null_store. --- guides/source/configuring.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/configuring.textile b/guides/source/configuring.textile index 68426221bf..66e453c3ff 100644 --- a/guides/source/configuring.textile +++ b/guides/source/configuring.textile @@ -70,7 +70,7 @@ NOTE. The +config.asset_path+ configuration is ignored if the asset pipeline is * +config.action_view.cache_template_loading+ controls whether or not templates should be reloaded on each request. Defaults to whatever is set for +config.cache_classes+. -* +config.cache_store+ configures which cache store to use for Rails caching. Options include one of the symbols +:memory_store+, +:file_store+, +:mem_cache_store+, or an object that implements the cache API. Defaults to +:file_store+ if the directory +tmp/cache+ exists, and to +:memory_store+ otherwise. +* +config.cache_store+ configures which cache store to use for Rails caching. Options include one of the symbols +:memory_store+, +:file_store+, +:mem_cache_store+, +:null_store+, or an object that implements the cache API. Defaults to +:file_store+ if the directory +tmp/cache+ exists, and to +:memory_store+ otherwise. * +config.colorize_logging+ specifies whether or not to use ANSI color codes when logging information. Defaults to true. -- cgit v1.2.3 From 7a6116b633479effe81a820d84aaf29572cc3412 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Thu, 3 May 2012 22:26:30 -0300 Subject: Add some docs and changelog entry --- guides/source/configuring.textile | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'guides') diff --git a/guides/source/configuring.textile b/guides/source/configuring.textile index 66e453c3ff..71cc972517 100644 --- a/guides/source/configuring.textile +++ b/guides/source/configuring.textile @@ -76,6 +76,17 @@ NOTE. The +config.asset_path+ configuration is ignored if the asset pipeline is * +config.consider_all_requests_local+ is a flag. If true then any error will cause detailed debugging information to be dumped in the HTTP response, and the +Rails::Info+ controller will show the application runtime context in +/rails/info/properties+. True by default in development and test environments, and false in production mode. For finer-grained control, set this to false and implement +local_request?+ in controllers to specify which requests should provide debugging information on errors. +* +config.console+ allows you to set class that will be used as console you run +rails console+. It's best to run it in +console+ block: + + +console do + # this block is called only when running console, + # so we can safely require pry here + require "pry" + config.console = Pry +end + + * +config.dependency_loading+ is a flag that allows you to disable constant autoloading setting it to false. It only has effect if +config.cache_classes+ is true, which it is by default in production mode. This flag is set to false by +config.threadsafe!+. * +config.eager_load_paths+ accepts an array of paths from which Rails will eager load on boot if cache classes is enabled. Defaults to every folder in the +app+ directory of the application. @@ -100,6 +111,10 @@ NOTE. The +config.asset_path+ configuration is ignored if the asset pipeline is * +config.preload_frameworks+ enables or disables preloading all frameworks at startup. Enabled by +config.threadsafe!+. Defaults to +nil+, so is disabled. +* +config.queue+ configures a different queue implementation for the application. Defaults to +Rails::Queueing::Queue+. Note that, if the default queue is changed, the default +queue_consumer+ is not going to be initialized, it is up to the new queue implementation to handle starting and shutting down its own consumer(s). + +* +config.queue_consumer+ configures a different consumer implementation for the default queue. Defaults to +Rails::Queueing::ThreadedConsumer+. + * +config.reload_classes_only_on_change+ enables or disables reloading of classes only when tracked files change. By default tracks everything on autoload paths and is set to true. If +config.cache_classes+ is true, this option is ignored. * +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+. @@ -122,17 +137,6 @@ 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. -* +config.console+ allows you to set class that will be used as console you run +rails console+. It's best to run it in +console+ block: - - -console do - # this block is called only when running console, - # so we can safely require pry here - require "pry" - config.console = Pry -end - - 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. -- cgit v1.2.3 From 544a10e428cda02e7baa38586ef266daaef20d89 Mon Sep 17 00:00:00 2001 From: Mike Manewitz Date: Fri, 4 May 2012 10:24:56 -0500 Subject: Editing log levels to reflect this doc: http://api.rubyonrails.org/classes/ActiveSupport/BufferedLogger/Severity.html --- guides/source/debugging_rails_applications.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/debugging_rails_applications.textile b/guides/source/debugging_rails_applications.textile index 903ed59e7b..45fa4ada78 100644 --- a/guides/source/debugging_rails_applications.textile +++ b/guides/source/debugging_rails_applications.textile @@ -124,7 +124,7 @@ h4. Log Levels When something is logged it's printed into the corresponding log if the log level of the message is equal or higher than the configured log level. If you want to know the current log level you can call the +Rails.logger.level+ method. -The available log levels are: +:debug+, +:info+, +:warn+, +:error+, and +:fatal+, corresponding to the log level numbers from 0 up to 4 respectively. To change the default log level, use +The available log levels are: +:debug+, +:info+, +:warn+, +:error+, +:fatal+, and +:unknown+, corresponding to the log level numbers from 0 up to 5 respectively. To change the default log level, use config.log_level = :warn # In any environment initializer, or -- cgit v1.2.3 From 7f536f9158588b66c0e5a6aa8772b919812f9cb9 Mon Sep 17 00:00:00 2001 From: Kristian Freeman Date: Fri, 4 May 2012 09:56:07 -0700 Subject: Play nice with some lint patterns --- guides/assets/stylesheets/main.css | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'guides') diff --git a/guides/assets/stylesheets/main.css b/guides/assets/stylesheets/main.css index 42b85fefa3..60859a6930 100644 --- a/guides/assets/stylesheets/main.css +++ b/guides/assets/stylesheets/main.css @@ -196,11 +196,12 @@ a, a:link, a:visited { width: 27em; display: block; background: #980905; - border-radius: 1em; -webkit-border-radius: 1em; -moz-border-radius: 1em; + border-radius: 1em; -webkit-box-shadow: 0.25em 0.25em 1em rgba(0,0,0,0.25); -moz-box-shadow: rgba(0,0,0,0.25) 0.25em 0.25em 1em; + box-shadow: 0.25em 0.25em 1em rgba(0,0,0,0.25); color: #f1938c; padding: 1.5em 2em; position: absolute; @@ -447,8 +448,8 @@ div.important p, div.caution p, div.warning p, div.note p, div.info p { #edge-badge { position: fixed; - right: 0px; - top: 0px; + right: 0; + top: 0; z-index: 100; border: none; } -- cgit v1.2.3 From 9d906d04ef09c585f215c0dcae6af05e0316831e Mon Sep 17 00:00:00 2001 From: Marcelo Silveira Date: Sat, 5 May 2012 13:15:09 -0300 Subject: Update `first`, `last` and `take` in guides --- guides/source/active_record_querying.textile | 50 +++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 8 deletions(-) (limited to 'guides') diff --git a/guides/source/active_record_querying.textile b/guides/source/active_record_querying.textile index f9dbaa1125..d16cdd66ee 100644 --- a/guides/source/active_record_querying.textile +++ b/guides/source/active_record_querying.textile @@ -99,9 +99,26 @@ SELECT * FROM clients WHERE (clients.id = 10) LIMIT 1 Model.find(primary_key) will raise an +ActiveRecord::RecordNotFound+ exception if no matching record is found. +h5. +take+ + +Model.take retrieves a record without any implicit ordering. The retrieved record may vary depending on the database engine. For example: + + +client = Client.take +# => # + + +The SQL equivalent of the above is: + + +SELECT * FROM clients LIMIT 1 + + +Model.take returns +nil+ if no record is found. No exception will be raised. + h5. +first+ -Model.first finds the first record matched by the supplied options, if any. For example: +Model.first finds the first record. If no order is chained it will order by primary key. For example: client = Client.first @@ -111,14 +128,14 @@ client = Client.first The SQL equivalent of the above is: -SELECT * FROM clients LIMIT 1 +SELECT * FROM clients ORDER BY clients.id ASC LIMIT 1 Model.first returns +nil+ if no matching record is found. No exception will be raised. h5. +last+ -Model.last finds the last record matched by the supplied options. For example: +Model.last finds the last record. If no order is chained it will order by primary key. For example: client = Client.last @@ -148,12 +165,29 @@ Client.find_by first_name: 'Jon' It is equivalent to writing: -Client.where(first_name: 'Lifo').first +Client.where(first_name: 'Lifo').take +h5(#take_1). +take!+ + +Model.take! retrieves a record without any implicit ordering. For example: + + +client = Client.take! +# => # + + +The SQL equivalent of the above is: + + +SELECT * FROM clients LIMIT 1 + + +Model.take! raises +RecordNotFound+ if no matching record is found. + h5(#first_1). +first!+ -Model.first! finds the first record. For example: +Model.first! finds the first record. If no order is chained it will order by primary key. For example: client = Client.first! @@ -163,14 +197,14 @@ client = Client.first! The SQL equivalent of the above is: -SELECT * FROM clients LIMIT 1 +SELECT * FROM clients ORDER BY clients.id ASC LIMIT 1 Model.first! raises +RecordNotFound+ if no matching record is found. h5(#last_1). +last!+ -Model.last! finds the last record. For example: +Model.last! finds the last record. If no order is chained it will order by primary key. For example: client = Client.last! @@ -200,7 +234,7 @@ Client.find_by! first_name: 'Jon' It is equivalent to writing: -Client.where(first_name: 'Lifo').first! +Client.where(first_name: 'Lifo').take! h4. Retrieving Multiple Objects -- cgit v1.2.3 From a9668680fd5eda2797f003a710eaf220768d95da Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sat, 5 May 2012 23:54:16 +0530 Subject: some corrections in the AR query guide [ci skip] --- guides/source/active_record_querying.textile | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'guides') diff --git a/guides/source/active_record_querying.textile b/guides/source/active_record_querying.textile index d16cdd66ee..a9cb424eaa 100644 --- a/guides/source/active_record_querying.textile +++ b/guides/source/active_record_querying.textile @@ -101,7 +101,7 @@ SELECT * FROM clients WHERE (clients.id = 10) LIMIT 1 h5. +take+ -Model.take retrieves a record without any implicit ordering. The retrieved record may vary depending on the database engine. For example: +Model.take retrieves a record without any implicit ordering. For example: client = Client.take @@ -114,11 +114,13 @@ The SQL equivalent of the above is: SELECT * FROM clients LIMIT 1 -Model.take returns +nil+ if no record is found. No exception will be raised. +Model.take returns +nil+ if no record is found and no exception will be raised. + +TIP: The retrieved record may vary depending on the database engine. h5. +first+ -Model.first finds the first record. If no order is chained it will order by primary key. For example: +Model.first finds the first record ordered by the primary key. For example: client = Client.first @@ -131,11 +133,11 @@ The SQL equivalent of the above is: SELECT * FROM clients ORDER BY clients.id ASC LIMIT 1 -Model.first returns +nil+ if no matching record is found. No exception will be raised. +Model.first returns +nil+ if no matching record is found and no exception will be raised. h5. +last+ -Model.last finds the last record. If no order is chained it will order by primary key. For example: +Model.last finds the last record ordered by the primary key. For example: client = Client.last @@ -148,7 +150,7 @@ The SQL equivalent of the above is: SELECT * FROM clients ORDER BY clients.id DESC LIMIT 1 -Model.last returns +nil+ if no matching record is found. No exception will be raised. +Model.last returns +nil+ if no matching record is found and no exception will be raised. h5. +find_by+ @@ -183,11 +185,11 @@ The SQL equivalent of the above is: SELECT * FROM clients LIMIT 1 -Model.take! raises +RecordNotFound+ if no matching record is found. +Model.take! raises +ActiveRecord::RecordNotFound+ if no matching record is found. h5(#first_1). +first!+ -Model.first! finds the first record. If no order is chained it will order by primary key. For example: +Model.first! finds the first record ordered by the primary key. For example: client = Client.first! @@ -200,11 +202,11 @@ The SQL equivalent of the above is: SELECT * FROM clients ORDER BY clients.id ASC LIMIT 1 -Model.first! raises +RecordNotFound+ if no matching record is found. +Model.first! raises +ActiveRecord::RecordNotFound+ if no matching record is found. h5(#last_1). +last!+ -Model.last! finds the last record. If no order is chained it will order by primary key. For example: +Model.last! finds the last record ordered by the primary key. For example: client = Client.last! @@ -217,18 +219,18 @@ The SQL equivalent of the above is: SELECT * FROM clients ORDER BY clients.id DESC LIMIT 1 -Model.last! raises +RecordNotFound+ if no matching record is found. +Model.last! raises +ActiveRecord::RecordNotFound+ if no matching record is found. h5(#find_by_1). +find_by!+ -Model.find_by! finds the first record matching some conditions. It raises +RecordNotFound+ if no matching record is found. For example: +Model.find_by! finds the first record matching some conditions. It raises +ActiveRecord::RecordNotFound+ if no matching record is found. For example: Client.find_by! first_name: 'Lifo' # => # Client.find_by! first_name: 'Jon' -# => RecordNotFound +# => ActiveRecord::RecordNotFound It is equivalent to writing: -- cgit v1.2.3 From b7e3f3c7c40e31572d941cb29fe03fd8d95e3985 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sun, 6 May 2012 00:46:16 +0530 Subject: Revert "Play nice with some lint patterns" This reverts commit 7f536f9158588b66c0e5a6aa8772b919812f9cb9. Reason: If at all this is done, this should be done in rails master. --- guides/assets/stylesheets/main.css | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'guides') diff --git a/guides/assets/stylesheets/main.css b/guides/assets/stylesheets/main.css index 60859a6930..42b85fefa3 100644 --- a/guides/assets/stylesheets/main.css +++ b/guides/assets/stylesheets/main.css @@ -196,12 +196,11 @@ a, a:link, a:visited { width: 27em; display: block; background: #980905; + border-radius: 1em; -webkit-border-radius: 1em; -moz-border-radius: 1em; - border-radius: 1em; -webkit-box-shadow: 0.25em 0.25em 1em rgba(0,0,0,0.25); -moz-box-shadow: rgba(0,0,0,0.25) 0.25em 0.25em 1em; - box-shadow: 0.25em 0.25em 1em rgba(0,0,0,0.25); color: #f1938c; padding: 1.5em 2em; position: absolute; @@ -448,8 +447,8 @@ div.important p, div.caution p, div.warning p, div.note p, div.info p { #edge-badge { position: fixed; - right: 0; - top: 0; + right: 0px; + top: 0px; z-index: 100; border: none; } -- cgit v1.2.3 From 58a49875df63729f07a9a81d1ee349087d258df5 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sun, 6 May 2012 01:05:43 +0530 Subject: Make RedCloth not convert double hyphens to emdashes. Closes #5292 As mentioned in http://redcloth.org/textile/writing-paragraph-text/#dashes RedCloth converts double hyphens to emdashes. This causes problems in the guides where options like --database, --full are rendered incorrectly. This commit fixes it by customizing the emdash method in the RedCloth::Formatters::HTML module to just return '--'. See their FAQ http://redcloth.org/faq in the section 'How do I customize RedCloth?' --- guides/rails_guides/textile_extensions.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'guides') diff --git a/guides/rails_guides/textile_extensions.rb b/guides/rails_guides/textile_extensions.rb index 4677fae504..0a002a785f 100644 --- a/guides/rails_guides/textile_extensions.rb +++ b/guides/rails_guides/textile_extensions.rb @@ -1,5 +1,11 @@ require 'active_support/core_ext/object/inclusion' +module RedCloth::Formatters::HTML + def emdash(opts) + "--" + end +end + module RailsGuides module TextileExtensions def notestuff(body) -- cgit v1.2.3 From aa5dd1439b49ae0e4a0574238ade338f9d05080b Mon Sep 17 00:00:00 2001 From: Alexey Gaziev Date: Tue, 24 Apr 2012 14:05:38 +0400 Subject: Guides for deep_dup --- .../source/active_support_core_extensions.textile | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'guides') diff --git a/guides/source/active_support_core_extensions.textile b/guides/source/active_support_core_extensions.textile index e4a6e145b9..98f9a67ca7 100644 --- a/guides/source/active_support_core_extensions.textile +++ b/guides/source/active_support_core_extensions.textile @@ -154,6 +154,40 @@ WARNING. Any class can disallow duplication removing +dup+ and +clone+ or raisin NOTE: Defined in +active_support/core_ext/object/duplicable.rb+. +h4. +deep_dup+ + +When data is very big and have many layers we need some recursive method to duplicate it right. For example, if we want to duplicate Array with some string inside and then work with this string as with part of duplicated object. + + +array = ['string'] +dup = array.dup +dup[0] << '?' +array.object_id == dup.object_id # => false +array[0] == dup[0] # => true + + +Active Support provides +deep_dup+ to dup all objects recursively inside deep dupilicated Array or Hash: + +If object can be duplicable - then it is just an alias for dup. + + +string = 'abc' +dup = string.deep_dup +string.object_id == dup.object_id # => false + + +If not - this method will return original object. + + +number = 1 +dup = number.deep_dup +number.object_id == dup.object_id # => true + + +WARNING. The same as in +duplicable?+ because +deep_dup+ uses that method. + +NOTE: Defined in +active_support/core_ext/object/deep_dup.rb+. + h4. +try+ Sometimes you want to call a method provided the receiver object is not +nil+, which is something you usually check first. +try+ is like +Object#send+ except that it returns +nil+ if sent to +nil+. @@ -2217,6 +2251,19 @@ Thus, in this case the behavior is different for +nil+, and the differences with NOTE: Defined in +active_support/core_ext/array/wrap.rb+. +h4. Duplicating + +The method +Array.deep_dup+ duplicates itself and all objects inside recursively with ActiveSupport method +Object#deep_dup+. It works like +Array#map+ with sending +deep_dup+ method to each object inside. + + +array = [1, [2, 3]] +dup = array.deep_dup +dup[1][2] = 4 +array[1][2] == nil # => true + + +NOTE: Defined in +active_support/core_ext/array/deep_dup.rb+. + h4. Grouping h5. +in_groups_of(number, fill_with = nil)+ @@ -2423,6 +2470,23 @@ The method +deep_merge!+ performs a deep merge in place. NOTE: Defined in +active_support/core_ext/hash/deep_merge.rb+. +h4. Deep duplicating + +The method +Hash.deep_dup+ duplicates itself and all keys and values inside recursively with ActiveSupport method +Object#deep_dup+. It works like +Enumerator#each_with_object+ with sending +deep_dup+ method to each pair inside. + + +hash = { :a => 1, :b => { :c => 2, :d => [3, 4] } } + +dup = hash.deep_dup +dup[:b][:e] = 5 +dup[:b][:d] << 5 + +hash[:b][:e] == nil # => true +hash[:b][:d] == [3, 4] # => true + + +NOTE: Defined in +active_support/core_ext/hash/deep_dup.rb+. + h4. Diffing The method +diff+ returns a hash that represents a diff of the receiver and the argument with the following logic: -- cgit v1.2.3 From 352d033ab9d9a03f3222aedefbc11e29a1fb5ffa Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Sun, 6 May 2012 10:53:27 -0700 Subject: Reword guide entry for `deep_dup` method. --- .../source/active_support_core_extensions.textile | 37 ++++++++++++++-------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'guides') diff --git a/guides/source/active_support_core_extensions.textile b/guides/source/active_support_core_extensions.textile index 98f9a67ca7..ab5ceaf2b3 100644 --- a/guides/source/active_support_core_extensions.textile +++ b/guides/source/active_support_core_extensions.textile @@ -156,27 +156,38 @@ NOTE: Defined in +active_support/core_ext/object/duplicable.rb+. h4. +deep_dup+ -When data is very big and have many layers we need some recursive method to duplicate it right. For example, if we want to duplicate Array with some string inside and then work with this string as with part of duplicated object. +The +deep_dup+ method returns deep copy of given object. Normally, when you +dup+ an object that contains other objects, ruby does not +dup+ them. If you have array with a string, for example, it will look like this: -array = ['string'] -dup = array.dup -dup[0] << '?' -array.object_id == dup.object_id # => false -array[0] == dup[0] # => true +array = ['string'] +duplicate = array.dup + +duplicate.push 'another-string' + +array #=> ['string'] +duplicate #=> ['string', 'another-string'] + +duplicate.first.gsub!('string', 'foo') + +array #=> ['foo'] +duplicate #=> ['foo', 'another-string'] -Active Support provides +deep_dup+ to dup all objects recursively inside deep dupilicated Array or Hash: +As you can see, after duplicating +Array+ instance, we got another object, therefore we can modify it and the original object will stay unchanged. This is not true for array's elements, however. Since +dup+ does not make deep copy, the string inside array is still the same object. -If object can be duplicable - then it is just an alias for dup. +If you need a deep copy of an object, you should use +deep_dup+ in such situation: -string = 'abc' -dup = string.deep_dup -string.object_id == dup.object_id # => false +array = ['string'] +duplicate = array.dup + +duplicate.first.gsub!('string', 'foo') + +array #=> ['string'] +duplicate #=> ['foo'] -If not - this method will return original object. +If object is not duplicable +deep_dup+ will just return this object: number = 1 @@ -184,8 +195,6 @@ dup = number.deep_dup number.object_id == dup.object_id # => true -WARNING. The same as in +duplicable?+ because +deep_dup+ uses that method. - NOTE: Defined in +active_support/core_ext/object/deep_dup.rb+. h4. +try+ -- cgit v1.2.3 From 3ac93d662933ee032227da0bcce57807c7d57889 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Sun, 6 May 2012 19:06:49 -0700 Subject: [guides] Add comments to deep_dup example, fix second example [ci skip] --- guides/source/active_support_core_extensions.textile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/active_support_core_extensions.textile b/guides/source/active_support_core_extensions.textile index ab5ceaf2b3..c56cb0b9e5 100644 --- a/guides/source/active_support_core_extensions.textile +++ b/guides/source/active_support_core_extensions.textile @@ -164,11 +164,13 @@ duplicate = array.dup duplicate.push 'another-string' +# object was duplicated, element added only to duplicate array #=> ['string'] duplicate #=> ['string', 'another-string'] duplicate.first.gsub!('string', 'foo') +# first element was not duplicated, it will be changed for both arrays array #=> ['foo'] duplicate #=> ['foo', 'another-string'] @@ -179,7 +181,7 @@ If you need a deep copy of an object, you should use +deep_dup+ in such situatio array = ['string'] -duplicate = array.dup +duplicate = array.deep_dup duplicate.first.gsub!('string', 'foo') -- cgit v1.2.3 From 552f535796b92df57ae7e7ea339307c45683c71b Mon Sep 17 00:00:00 2001 From: Mark Rushakoff Date: Sun, 6 May 2012 20:40:48 -0700 Subject: are ran -> are run The former is grammatically incorrect. --- guides/source/configuring.textile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'guides') diff --git a/guides/source/configuring.textile b/guides/source/configuring.textile index 59f12e98ab..5bfb45f778 100644 --- a/guides/source/configuring.textile +++ b/guides/source/configuring.textile @@ -182,13 +182,13 @@ The full set of methods that can be used in this block are as follows: * +force_plural+ allows pluralized model names. Defaults to +false+. * +helper+ defines whether or not to generate helpers. Defaults to +true+. * +integration_tool+ defines which integration tool to use. Defaults to +nil+. -* +javascripts+ turns on the hook for javascripts in generators. Used in Rails for when the +scaffold+ generator is ran. Defaults to +true+. +* +javascripts+ turns on the hook for javascripts in generators. Used in Rails for when the +scaffold+ generator is run. Defaults to +true+. * +javascript_engine+ configures the engine to be used (for eg. coffee) when generating assets. Defaults to +nil+. * +orm+ defines which orm to use. Defaults to +false+ and will use Active Record by default. * +performance_tool+ defines which performance tool to use. Defaults to +nil+. * +resource_controller+ defines which generator to use for generating a controller when using +rails generate resource+. Defaults to +:controller+. * +scaffold_controller+ different from +resource_controller+, defines which generator to use for generating a _scaffolded_ controller when using +rails generate scaffold+. Defaults to +:scaffold_controller+. -* +stylesheets+ turns on the hook for stylesheets in generators. Used in Rails for when the +scaffold+ generator is ran, but this hook can be used in other generates as well. Defaults to +true+. +* +stylesheets+ turns on the hook for stylesheets in generators. Used in Rails for when the +scaffold+ generator is run, but this hook can be used in other generates as well. Defaults to +true+. * +stylesheet_engine+ configures the stylesheet engine (for eg. sass) to be used when generating assets. Defaults to +:css+. * +test_framework+ defines which test framework to use. Defaults to +false+ and will use Test::Unit by default. * +template_engine+ defines which template engine to use, such as ERB or Haml. Defaults to +:erb+. @@ -585,13 +585,13 @@ TIP: If you have any ordering dependency in your initializers, you can control t h3. Initialization events -Rails has 5 initialization events which can be hooked into (listed in the order that they are ran): +Rails has 5 initialization events which can be hooked into (listed in the order that they are run): * +before_configuration+: This is run as soon as the application constant inherits from +Rails::Application+. The +config+ calls are evaluated before this happens. * +before_initialize+: This is run directly before the initialization process of the application occurs with the +:bootstrap_hook+ initializer near the beginning of the Rails initialization process. -* +to_prepare+: Run after the initializers are ran for all Railties (including the application itself), but before eager loading and the middleware stack is built. More importantly, will run upon every request in +development+, but only once (during boot-up) in +production+ and +test+. +* +to_prepare+: Run after the initializers are run for all Railties (including the application itself), but before eager loading and the middleware stack is built. More importantly, will run upon every request in +development+, but only once (during boot-up) in +production+ and +test+. * +before_eager_load+: This is run directly before eager loading occurs, which is the default behaviour for the _production_ environment and not for the +development+ environment. @@ -732,7 +732,7 @@ The error occurred while evaluating nil.each *+load_config_initializers+* Loads all Ruby files from +config/initializers+ in the application, railties and engines. The files in this directory can be used to hold configuration settings that should be made after all of the frameworks are loaded. -*+engines_blank_point+* Provides a point-in-initialization to hook into if you wish to do anything before engines are loaded. After this point, all railtie and engine initializers are ran. +*+engines_blank_point+* Provides a point-in-initialization to hook into if you wish to do anything before engines are loaded. After this point, all railtie and engine initializers are run. *+add_generator_templates+* Finds templates for generators at +lib/templates+ for the application, railities and engines and adds these to the +config.generators.templates+ setting, which will make the templates available for all generators to reference. -- cgit v1.2.3 From cf243be4d5c50d0df28b7a51f403584184a17fb2 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Mon, 7 May 2012 12:18:51 +0530 Subject: note that WIP guides are not in the index menu [ci skip] --- guides/source/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/index.html.erb b/guides/source/index.html.erb index 5439459b42..74805b2754 100644 --- a/guides/source/index.html.erb +++ b/guides/source/index.html.erb @@ -13,7 +13,7 @@ Ruby on Rails Guides and <%= link_to 'Free Kindle Reading Apps', 'http://www.amazon.com/gp/kindle/kcp' %> for the iPad, iPhone, Mac, Android, etc. Download them from <%= link_to 'here', @mobi %>. -
Guides marked with this icon are currently being worked on. While they might still be useful to you, they may contain incomplete information and even errors. You can help by reviewing them and posting your comments and corrections to the author.
+
Guides marked with this icon are currently being worked on and will not be available in the Guides Index menu. While still useful, they may contain incomplete information and even errors. You can help by reviewing them and posting your comments and corrections.
<% end %> -- cgit v1.2.3 From 8c4777f446d9e14deb077f44d31579a5a96e68ae Mon Sep 17 00:00:00 2001 From: "Mark J. Titorenko" Date: Mon, 7 May 2012 12:04:51 +0100 Subject: Added documentation for +beginning_of_hour+ and +end_of_hour+ to Active Support Core Extensions guide. --- .../source/active_support_core_extensions.textile | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'guides') diff --git a/guides/source/active_support_core_extensions.textile b/guides/source/active_support_core_extensions.textile index e4a6e145b9..a238a84e8c 100644 --- a/guides/source/active_support_core_extensions.textile +++ b/guides/source/active_support_core_extensions.textile @@ -3064,6 +3064,28 @@ date.end_of_day # => Sun Jun 06 23:59:59 +0200 2010 +beginning_of_day+ is aliased to +at_beginning_of_day+, +midnight+, +at_midnight+. +h6. +beginning_of_hour+, +end_of_hour+ + +The method +beginning_of_hour+ returns a timestamp at the beginning of the hour (hh:00:00): + + +date = DateTime.new(2010, 6, 7, 19, 55, 25) +date.beginning_of_hour # => Mon Jun 07 19:00:00 +0200 2010 + + +The method +end_of_hour+ returns a timestamp at the end of the hour (hh:59:59): + + +date = DateTime.new(2010, 6, 7, 19, 55, 25) +date.end_of_hour # => Mon Jun 07 19:59:59 +0200 2010 + + ++beginning_of_hour+ is aliased to +at_beginning_of_hour+. + +INFO: +beginning_of_hour+ and +end_of_hour+ are implemented for +Time+ and +DateTime+ but *not* +Date+ as it does not make sense to request the beginning or end of an hour on a +Date+ instance. + +NOTE: All the following methods are defined in +active_support/core_ext/date/calculations.rb+. + h6. +ago+, +since+ The method +ago+ receives a number of seconds as argument and returns a timestamp those many seconds ago from midnight: @@ -3131,6 +3153,13 @@ since (in) On the other hand, +advance+ and +change+ are also defined and support more options, they are documented below. +The following methods are only implemented in +active_support/core_ext/date_time/calculations.rb+ as they only make sense when used with a +DateTime+ instance: + + +beginning_of_hour (at_beginning_of_hour) +end_of_hour + + h5. Named Datetimes h6. +DateTime.current+ @@ -3273,6 +3302,8 @@ ago since (in) beginning_of_day (midnight, at_midnight, at_beginning_of_day) end_of_day +beginning_of_hour (at_beginning_of_hour) +end_of_hour beginning_of_week (at_beginning_of_week) end_of_week (at_end_of_week) monday -- cgit v1.2.3 From f174e8dcef66446cb7483c48dc746887b29078b6 Mon Sep 17 00:00:00 2001 From: "Mark J. Titorenko" Date: Mon, 7 May 2012 12:07:35 +0100 Subject: Corrections to +beginning_of_day+ and +end_of_day+ example dates. --- guides/source/active_support_core_extensions.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'guides') diff --git a/guides/source/active_support_core_extensions.textile b/guides/source/active_support_core_extensions.textile index a238a84e8c..c9e9a13c09 100644 --- a/guides/source/active_support_core_extensions.textile +++ b/guides/source/active_support_core_extensions.textile @@ -3052,14 +3052,14 @@ The method +beginning_of_day+ returns a timestamp at the beginning of the day (0 date = Date.new(2010, 6, 7) -date.beginning_of_day # => Sun Jun 07 00:00:00 +0200 2010 +date.beginning_of_day # => Mon Jun 07 00:00:00 +0200 2010 The method +end_of_day+ returns a timestamp at the end of the day (23:59:59): date = Date.new(2010, 6, 7) -date.end_of_day # => Sun Jun 06 23:59:59 +0200 2010 +date.end_of_day # => Mon Jun 07 23:59:59 +0200 2010 +beginning_of_day+ is aliased to +at_beginning_of_day+, +midnight+, +at_midnight+. -- cgit v1.2.3 From 61587b18d2b4b03041cc7e54da00cff6344abeec Mon Sep 17 00:00:00 2001 From: "Mark J. Titorenko" Date: Mon, 7 May 2012 12:24:40 +0100 Subject: Remove accidentally pasted NOTE section during introduction of +beginning_of_hour+ and +end_of_hour+ documentation. --- guides/source/active_support_core_extensions.textile | 2 -- 1 file changed, 2 deletions(-) (limited to 'guides') diff --git a/guides/source/active_support_core_extensions.textile b/guides/source/active_support_core_extensions.textile index c9e9a13c09..43dc0c12cf 100644 --- a/guides/source/active_support_core_extensions.textile +++ b/guides/source/active_support_core_extensions.textile @@ -3084,8 +3084,6 @@ date.end_of_hour # => Mon Jun 07 19:59:59 +0200 2010 INFO: +beginning_of_hour+ and +end_of_hour+ are implemented for +Time+ and +DateTime+ but *not* +Date+ as it does not make sense to request the beginning or end of an hour on a +Date+ instance. -NOTE: All the following methods are defined in +active_support/core_ext/date/calculations.rb+. - h6. +ago+, +since+ The method +ago+ receives a number of seconds as argument and returns a timestamp those many seconds ago from midnight: -- cgit v1.2.3 From bc06e8d706fd8818d434c66f46d2e889ca24bd2d Mon Sep 17 00:00:00 2001 From: Ayrton De Craene Date: Mon, 7 May 2012 15:40:08 +0200 Subject: Compressed all images from the guide through ImageOptim which saves sometimes up to 74.6% in size [ci skip] --- guides/assets/images/belongs_to.png | Bin 34017 -> 26076 bytes guides/assets/images/book_icon.gif | Bin 337 -> 329 bytes guides/assets/images/challenge.png | Bin 54134 -> 33373 bytes guides/assets/images/chapters_icon.gif | Bin 628 -> 620 bytes guides/assets/images/check_bullet.gif | Bin 384 -> 376 bytes guides/assets/images/credits_pic_blank.gif | Bin 613 -> 597 bytes guides/assets/images/csrf.png | Bin 41996 -> 32179 bytes guides/assets/images/customized_error_messages.png | Bin 5055 -> 2561 bytes guides/assets/images/edge_badge.png | Bin 7945 -> 5964 bytes guides/assets/images/error_messages.png | Bin 14645 -> 10964 bytes guides/assets/images/feature_tile.gif | Bin 43 -> 35 bytes guides/assets/images/footer_tile.gif | Bin 44 -> 36 bytes guides/assets/images/fxn.png | Bin 20664 -> 15434 bytes .../images/getting_started/confirm_dialog.png | Bin 36070 -> 29542 bytes .../images/getting_started/form_with_errors.png | Bin 20820 -> 14031 bytes .../index_action_with_edit_link.png | Bin 15547 -> 9772 bytes guides/assets/images/getting_started/new_post.png | Bin 14334 -> 5888 bytes .../images/getting_started/post_with_comments.png | Bin 31630 -> 18496 bytes .../routing_error_no_controller.png | Bin 15744 -> 6268 bytes .../routing_error_no_route_matches.png | Bin 16065 -> 6508 bytes .../getting_started/show_action_for_posts.png | Bin 6885 -> 2991 bytes .../template_is_missing_posts_new.png | Bin 15168 -> 5851 bytes .../getting_started/undefined_method_post_path.png | Bin 15254 -> 9217 bytes .../unknown_action_create_for_posts.png | Bin 12652 -> 4146 bytes .../unknown_action_new_for_posts.png | Bin 12756 -> 4208 bytes guides/assets/images/grey_bullet.gif | Bin 45 -> 37 bytes guides/assets/images/habtm.png | Bin 63801 -> 49325 bytes guides/assets/images/has_many.png | Bin 38582 -> 28988 bytes guides/assets/images/has_many_through.png | Bin 100220 -> 79428 bytes guides/assets/images/has_one.png | Bin 39022 -> 29072 bytes guides/assets/images/has_one_through.png | Bin 92594 -> 72434 bytes guides/assets/images/header_backdrop.png | Bin 882 -> 224 bytes guides/assets/images/header_tile.gif | Bin 44 -> 36 bytes guides/assets/images/i18n/demo_html_safe.png | Bin 11946 -> 10073 bytes .../assets/images/i18n/demo_localized_pirate.png | Bin 15027 -> 11485 bytes guides/assets/images/i18n/demo_translated_en.png | Bin 12057 -> 9325 bytes .../assets/images/i18n/demo_translated_pirate.png | Bin 13392 -> 10202 bytes .../images/i18n/demo_translation_missing.png | Bin 13143 -> 10260 bytes guides/assets/images/i18n/demo_untranslated.png | Bin 11925 -> 9224 bytes guides/assets/images/icons/callouts/1.png | Bin 329 -> 147 bytes guides/assets/images/icons/callouts/10.png | Bin 361 -> 183 bytes guides/assets/images/icons/callouts/11.png | Bin 565 -> 290 bytes guides/assets/images/icons/callouts/12.png | Bin 617 -> 322 bytes guides/assets/images/icons/callouts/13.png | Bin 623 -> 328 bytes guides/assets/images/icons/callouts/14.png | Bin 411 -> 246 bytes guides/assets/images/icons/callouts/15.png | Bin 640 -> 340 bytes guides/assets/images/icons/callouts/2.png | Bin 353 -> 168 bytes guides/assets/images/icons/callouts/3.png | Bin 350 -> 170 bytes guides/assets/images/icons/callouts/4.png | Bin 345 -> 165 bytes guides/assets/images/icons/callouts/5.png | Bin 348 -> 169 bytes guides/assets/images/icons/callouts/6.png | Bin 355 -> 176 bytes guides/assets/images/icons/callouts/7.png | Bin 344 -> 160 bytes guides/assets/images/icons/callouts/8.png | Bin 357 -> 176 bytes guides/assets/images/icons/callouts/9.png | Bin 357 -> 177 bytes guides/assets/images/icons/caution.png | Bin 2554 -> 2300 bytes guides/assets/images/icons/example.png | Bin 2354 -> 2079 bytes guides/assets/images/icons/home.png | Bin 1340 -> 1163 bytes guides/assets/images/icons/important.png | Bin 2657 -> 2451 bytes guides/assets/images/icons/next.png | Bin 1302 -> 1146 bytes guides/assets/images/icons/note.png | Bin 2730 -> 2155 bytes guides/assets/images/icons/prev.png | Bin 1348 -> 1126 bytes guides/assets/images/icons/tip.png | Bin 2602 -> 2248 bytes guides/assets/images/icons/up.png | Bin 1320 -> 1133 bytes guides/assets/images/icons/warning.png | Bin 2828 -> 2616 bytes guides/assets/images/jaimeiniesta.jpg | Bin 11913 -> 7617 bytes guides/assets/images/nav_arrow.gif | Bin 427 -> 419 bytes guides/assets/images/polymorphic.png | Bin 85248 -> 66415 bytes guides/assets/images/radar.png | Bin 19521 -> 17101 bytes guides/assets/images/rails_guides_kindle_cover.jpg | Bin 31785 -> 20955 bytes guides/assets/images/rails_guides_logo.gif | Bin 5114 -> 5106 bytes guides/assets/images/rails_welcome.png | Bin 121314 -> 71979 bytes guides/assets/images/session_fixation.png | Bin 47860 -> 38451 bytes guides/assets/images/tab_grey.gif | Bin 4924 -> 4684 bytes guides/assets/images/tab_info.gif | Bin 4762 -> 4522 bytes guides/assets/images/tab_note.gif | Bin 4807 -> 4566 bytes guides/assets/images/tab_red.gif | Bin 4753 -> 4507 bytes guides/assets/images/tab_yellow.gif | Bin 4759 -> 4519 bytes guides/assets/images/tab_yellow.png | Bin 1611 -> 1441 bytes guides/assets/images/validation_error_messages.png | Bin 1107 -> 583 bytes guides/assets/images/vijaydev.jpg | Bin 4610 -> 2897 bytes 80 files changed, 0 insertions(+), 0 deletions(-) (limited to 'guides') diff --git a/guides/assets/images/belongs_to.png b/guides/assets/images/belongs_to.png index 44243edbca..43c963ffa8 100644 Binary files a/guides/assets/images/belongs_to.png and b/guides/assets/images/belongs_to.png differ diff --git a/guides/assets/images/book_icon.gif b/guides/assets/images/book_icon.gif index c81d5db520..efc5e06880 100644 Binary files a/guides/assets/images/book_icon.gif and b/guides/assets/images/book_icon.gif differ diff --git a/guides/assets/images/challenge.png b/guides/assets/images/challenge.png index d163748640..30be3d7028 100644 Binary files a/guides/assets/images/challenge.png and b/guides/assets/images/challenge.png differ diff --git a/guides/assets/images/chapters_icon.gif b/guides/assets/images/chapters_icon.gif index 06fb415f4a..a61c28c02d 100644 Binary files a/guides/assets/images/chapters_icon.gif and b/guides/assets/images/chapters_icon.gif differ diff --git a/guides/assets/images/check_bullet.gif b/guides/assets/images/check_bullet.gif index 1fcfeba250..bd54ef64c9 100644 Binary files a/guides/assets/images/check_bullet.gif and b/guides/assets/images/check_bullet.gif differ diff --git a/guides/assets/images/credits_pic_blank.gif b/guides/assets/images/credits_pic_blank.gif index f6f654fc65..a6b335d0c9 100644 Binary files a/guides/assets/images/credits_pic_blank.gif and b/guides/assets/images/credits_pic_blank.gif differ diff --git a/guides/assets/images/csrf.png b/guides/assets/images/csrf.png index ab73baafe8..a8123d47c3 100644 Binary files a/guides/assets/images/csrf.png and b/guides/assets/images/csrf.png differ diff --git a/guides/assets/images/customized_error_messages.png b/guides/assets/images/customized_error_messages.png index fa676991e3..fcf47b4be0 100644 Binary files a/guides/assets/images/customized_error_messages.png and b/guides/assets/images/customized_error_messages.png differ diff --git a/guides/assets/images/edge_badge.png b/guides/assets/images/edge_badge.png index cddd46c4b8..a35dc9f8ee 100644 Binary files a/guides/assets/images/edge_badge.png and b/guides/assets/images/edge_badge.png differ diff --git a/guides/assets/images/error_messages.png b/guides/assets/images/error_messages.png index 428892194a..1189e486d4 100644 Binary files a/guides/assets/images/error_messages.png and b/guides/assets/images/error_messages.png differ diff --git a/guides/assets/images/feature_tile.gif b/guides/assets/images/feature_tile.gif index 75469361db..ba0171b761 100644 Binary files a/guides/assets/images/feature_tile.gif and b/guides/assets/images/feature_tile.gif differ diff --git a/guides/assets/images/footer_tile.gif b/guides/assets/images/footer_tile.gif index bb33fc1ff0..09dbfd2973 100644 Binary files a/guides/assets/images/footer_tile.gif and b/guides/assets/images/footer_tile.gif differ diff --git a/guides/assets/images/fxn.png b/guides/assets/images/fxn.png index 9b531ee584..6800fc9bc3 100644 Binary files a/guides/assets/images/fxn.png and b/guides/assets/images/fxn.png differ diff --git a/guides/assets/images/getting_started/confirm_dialog.png b/guides/assets/images/getting_started/confirm_dialog.png index a26c09ef2d..1a13eddd91 100644 Binary files a/guides/assets/images/getting_started/confirm_dialog.png and b/guides/assets/images/getting_started/confirm_dialog.png differ diff --git a/guides/assets/images/getting_started/form_with_errors.png b/guides/assets/images/getting_started/form_with_errors.png index badefe6ea6..6910e1647e 100644 Binary files a/guides/assets/images/getting_started/form_with_errors.png and b/guides/assets/images/getting_started/form_with_errors.png differ diff --git a/guides/assets/images/getting_started/index_action_with_edit_link.png b/guides/assets/images/getting_started/index_action_with_edit_link.png index 6e58a13756..bf23cba231 100644 Binary files a/guides/assets/images/getting_started/index_action_with_edit_link.png and b/guides/assets/images/getting_started/index_action_with_edit_link.png differ diff --git a/guides/assets/images/getting_started/new_post.png b/guides/assets/images/getting_started/new_post.png index dc9459032a..b573cb164c 100644 Binary files a/guides/assets/images/getting_started/new_post.png and b/guides/assets/images/getting_started/new_post.png differ diff --git a/guides/assets/images/getting_started/post_with_comments.png b/guides/assets/images/getting_started/post_with_comments.png index bd9b2e10f5..e13095ff8f 100644 Binary files a/guides/assets/images/getting_started/post_with_comments.png and b/guides/assets/images/getting_started/post_with_comments.png differ diff --git a/guides/assets/images/getting_started/routing_error_no_controller.png b/guides/assets/images/getting_started/routing_error_no_controller.png index 92a39efd78..407ea2ea06 100644 Binary files a/guides/assets/images/getting_started/routing_error_no_controller.png and b/guides/assets/images/getting_started/routing_error_no_controller.png differ diff --git a/guides/assets/images/getting_started/routing_error_no_route_matches.png b/guides/assets/images/getting_started/routing_error_no_route_matches.png index bc768a94a2..d461807c5d 100644 Binary files a/guides/assets/images/getting_started/routing_error_no_route_matches.png and b/guides/assets/images/getting_started/routing_error_no_route_matches.png differ diff --git a/guides/assets/images/getting_started/show_action_for_posts.png b/guides/assets/images/getting_started/show_action_for_posts.png index 5c8c4d8e5e..9467df6a07 100644 Binary files a/guides/assets/images/getting_started/show_action_for_posts.png and b/guides/assets/images/getting_started/show_action_for_posts.png differ diff --git a/guides/assets/images/getting_started/template_is_missing_posts_new.png b/guides/assets/images/getting_started/template_is_missing_posts_new.png index 9f070d59db..6860aaeca7 100644 Binary files a/guides/assets/images/getting_started/template_is_missing_posts_new.png and b/guides/assets/images/getting_started/template_is_missing_posts_new.png differ diff --git a/guides/assets/images/getting_started/undefined_method_post_path.png b/guides/assets/images/getting_started/undefined_method_post_path.png index f568bf315c..c29cb2f54f 100644 Binary files a/guides/assets/images/getting_started/undefined_method_post_path.png and b/guides/assets/images/getting_started/undefined_method_post_path.png differ diff --git a/guides/assets/images/getting_started/unknown_action_create_for_posts.png b/guides/assets/images/getting_started/unknown_action_create_for_posts.png index 03d92dfb7d..1eca14b988 100644 Binary files a/guides/assets/images/getting_started/unknown_action_create_for_posts.png and b/guides/assets/images/getting_started/unknown_action_create_for_posts.png differ diff --git a/guides/assets/images/getting_started/unknown_action_new_for_posts.png b/guides/assets/images/getting_started/unknown_action_new_for_posts.png index b63883d922..fd72586573 100644 Binary files a/guides/assets/images/getting_started/unknown_action_new_for_posts.png and b/guides/assets/images/getting_started/unknown_action_new_for_posts.png differ diff --git a/guides/assets/images/grey_bullet.gif b/guides/assets/images/grey_bullet.gif index e75e8e93a1..3c08b1571c 100644 Binary files a/guides/assets/images/grey_bullet.gif and b/guides/assets/images/grey_bullet.gif differ diff --git a/guides/assets/images/habtm.png b/guides/assets/images/habtm.png index fea78b0b5c..326b91903a 100644 Binary files a/guides/assets/images/habtm.png and b/guides/assets/images/habtm.png differ diff --git a/guides/assets/images/has_many.png b/guides/assets/images/has_many.png index 6cff58460d..e7589e3b75 100644 Binary files a/guides/assets/images/has_many.png and b/guides/assets/images/has_many.png differ diff --git a/guides/assets/images/has_many_through.png b/guides/assets/images/has_many_through.png index 85d7599925..858c898dc1 100644 Binary files a/guides/assets/images/has_many_through.png and b/guides/assets/images/has_many_through.png differ diff --git a/guides/assets/images/has_one.png b/guides/assets/images/has_one.png index a70ddaaa86..93faa05b07 100644 Binary files a/guides/assets/images/has_one.png and b/guides/assets/images/has_one.png differ diff --git a/guides/assets/images/has_one_through.png b/guides/assets/images/has_one_through.png index 89a7617a30..07dac1a27d 100644 Binary files a/guides/assets/images/has_one_through.png and b/guides/assets/images/has_one_through.png differ diff --git a/guides/assets/images/header_backdrop.png b/guides/assets/images/header_backdrop.png index ff2982175e..72b030478f 100644 Binary files a/guides/assets/images/header_backdrop.png and b/guides/assets/images/header_backdrop.png differ diff --git a/guides/assets/images/header_tile.gif b/guides/assets/images/header_tile.gif index e2c878d492..476b5dbd57 100644 Binary files a/guides/assets/images/header_tile.gif and b/guides/assets/images/header_tile.gif differ diff --git a/guides/assets/images/i18n/demo_html_safe.png b/guides/assets/images/i18n/demo_html_safe.png index f881f60dac..9afa8ebec1 100644 Binary files a/guides/assets/images/i18n/demo_html_safe.png and b/guides/assets/images/i18n/demo_html_safe.png differ diff --git a/guides/assets/images/i18n/demo_localized_pirate.png b/guides/assets/images/i18n/demo_localized_pirate.png index 9134709573..bf8d0b558c 100644 Binary files a/guides/assets/images/i18n/demo_localized_pirate.png and b/guides/assets/images/i18n/demo_localized_pirate.png differ diff --git a/guides/assets/images/i18n/demo_translated_en.png b/guides/assets/images/i18n/demo_translated_en.png index ecdd878d38..e887bfa306 100644 Binary files a/guides/assets/images/i18n/demo_translated_en.png and b/guides/assets/images/i18n/demo_translated_en.png differ diff --git a/guides/assets/images/i18n/demo_translated_pirate.png b/guides/assets/images/i18n/demo_translated_pirate.png index 41c580923a..aa5618a865 100644 Binary files a/guides/assets/images/i18n/demo_translated_pirate.png and b/guides/assets/images/i18n/demo_translated_pirate.png differ diff --git a/guides/assets/images/i18n/demo_translation_missing.png b/guides/assets/images/i18n/demo_translation_missing.png index af9e2d0427..867aa7c42d 100644 Binary files a/guides/assets/images/i18n/demo_translation_missing.png and b/guides/assets/images/i18n/demo_translation_missing.png differ diff --git a/guides/assets/images/i18n/demo_untranslated.png b/guides/assets/images/i18n/demo_untranslated.png index 3603f43463..2ea6404822 100644 Binary files a/guides/assets/images/i18n/demo_untranslated.png and b/guides/assets/images/i18n/demo_untranslated.png differ diff --git a/guides/assets/images/icons/callouts/1.png b/guides/assets/images/icons/callouts/1.png index 7d473430b7..c5d02adcf4 100644 Binary files a/guides/assets/images/icons/callouts/1.png and b/guides/assets/images/icons/callouts/1.png differ diff --git a/guides/assets/images/icons/callouts/10.png b/guides/assets/images/icons/callouts/10.png index 997bbc8246..fe89f9ef83 100644 Binary files a/guides/assets/images/icons/callouts/10.png and b/guides/assets/images/icons/callouts/10.png differ diff --git a/guides/assets/images/icons/callouts/11.png b/guides/assets/images/icons/callouts/11.png index ce47dac3f5..9244a1ac4b 100644 Binary files a/guides/assets/images/icons/callouts/11.png and b/guides/assets/images/icons/callouts/11.png differ diff --git a/guides/assets/images/icons/callouts/12.png b/guides/assets/images/icons/callouts/12.png index 31daf4e2f2..ae56459f4c 100644 Binary files a/guides/assets/images/icons/callouts/12.png and b/guides/assets/images/icons/callouts/12.png differ diff --git a/guides/assets/images/icons/callouts/13.png b/guides/assets/images/icons/callouts/13.png index 14021a89c2..1181f9f892 100644 Binary files a/guides/assets/images/icons/callouts/13.png and b/guides/assets/images/icons/callouts/13.png differ diff --git a/guides/assets/images/icons/callouts/14.png b/guides/assets/images/icons/callouts/14.png index 64014b75fe..4274e6580a 100644 Binary files a/guides/assets/images/icons/callouts/14.png and b/guides/assets/images/icons/callouts/14.png differ diff --git a/guides/assets/images/icons/callouts/15.png b/guides/assets/images/icons/callouts/15.png index 0d65765fcf..39304de94f 100644 Binary files a/guides/assets/images/icons/callouts/15.png and b/guides/assets/images/icons/callouts/15.png differ diff --git a/guides/assets/images/icons/callouts/2.png b/guides/assets/images/icons/callouts/2.png index 5d09341b2f..8c57970ba9 100644 Binary files a/guides/assets/images/icons/callouts/2.png and b/guides/assets/images/icons/callouts/2.png differ diff --git a/guides/assets/images/icons/callouts/3.png b/guides/assets/images/icons/callouts/3.png index ef7b700471..57a33d15b4 100644 Binary files a/guides/assets/images/icons/callouts/3.png and b/guides/assets/images/icons/callouts/3.png differ diff --git a/guides/assets/images/icons/callouts/4.png b/guides/assets/images/icons/callouts/4.png index adb8364eb5..f061ab02b8 100644 Binary files a/guides/assets/images/icons/callouts/4.png and b/guides/assets/images/icons/callouts/4.png differ diff --git a/guides/assets/images/icons/callouts/5.png b/guides/assets/images/icons/callouts/5.png index 4d7eb46002..b4de02da11 100644 Binary files a/guides/assets/images/icons/callouts/5.png and b/guides/assets/images/icons/callouts/5.png differ diff --git a/guides/assets/images/icons/callouts/6.png b/guides/assets/images/icons/callouts/6.png index 0ba694af6c..0e055eec1e 100644 Binary files a/guides/assets/images/icons/callouts/6.png and b/guides/assets/images/icons/callouts/6.png differ diff --git a/guides/assets/images/icons/callouts/7.png b/guides/assets/images/icons/callouts/7.png index 472e96f8ac..5ead87d040 100644 Binary files a/guides/assets/images/icons/callouts/7.png and b/guides/assets/images/icons/callouts/7.png differ diff --git a/guides/assets/images/icons/callouts/8.png b/guides/assets/images/icons/callouts/8.png index 5e60973c21..cb99545eb6 100644 Binary files a/guides/assets/images/icons/callouts/8.png and b/guides/assets/images/icons/callouts/8.png differ diff --git a/guides/assets/images/icons/callouts/9.png b/guides/assets/images/icons/callouts/9.png index a0676d26cc..0ac03602f6 100644 Binary files a/guides/assets/images/icons/callouts/9.png and b/guides/assets/images/icons/callouts/9.png differ diff --git a/guides/assets/images/icons/caution.png b/guides/assets/images/icons/caution.png index cb9d5ea0df..031e19c776 100644 Binary files a/guides/assets/images/icons/caution.png and b/guides/assets/images/icons/caution.png differ diff --git a/guides/assets/images/icons/example.png b/guides/assets/images/icons/example.png index bba1c0010d..1b0e482059 100644 Binary files a/guides/assets/images/icons/example.png and b/guides/assets/images/icons/example.png differ diff --git a/guides/assets/images/icons/home.png b/guides/assets/images/icons/home.png index 37a5231bac..24149d6e78 100644 Binary files a/guides/assets/images/icons/home.png and b/guides/assets/images/icons/home.png differ diff --git a/guides/assets/images/icons/important.png b/guides/assets/images/icons/important.png index 1096c23295..dafcf0f59e 100644 Binary files a/guides/assets/images/icons/important.png and b/guides/assets/images/icons/important.png differ diff --git a/guides/assets/images/icons/next.png b/guides/assets/images/icons/next.png index 64e126bdda..355b329f5a 100644 Binary files a/guides/assets/images/icons/next.png and b/guides/assets/images/icons/next.png differ diff --git a/guides/assets/images/icons/note.png b/guides/assets/images/icons/note.png index 841820f7c4..08d35a6f5c 100644 Binary files a/guides/assets/images/icons/note.png and b/guides/assets/images/icons/note.png differ diff --git a/guides/assets/images/icons/prev.png b/guides/assets/images/icons/prev.png index 3e8f12fe24..ea564c865e 100644 Binary files a/guides/assets/images/icons/prev.png and b/guides/assets/images/icons/prev.png differ diff --git a/guides/assets/images/icons/tip.png b/guides/assets/images/icons/tip.png index a3a029d898..d834e6d1bb 100644 Binary files a/guides/assets/images/icons/tip.png and b/guides/assets/images/icons/tip.png differ diff --git a/guides/assets/images/icons/up.png b/guides/assets/images/icons/up.png index 2db1ce62fa..379f0045af 100644 Binary files a/guides/assets/images/icons/up.png and b/guides/assets/images/icons/up.png differ diff --git a/guides/assets/images/icons/warning.png b/guides/assets/images/icons/warning.png index 0b0c419df2..72a8a5d873 100644 Binary files a/guides/assets/images/icons/warning.png and b/guides/assets/images/icons/warning.png differ diff --git a/guides/assets/images/jaimeiniesta.jpg b/guides/assets/images/jaimeiniesta.jpg index 445f048d92..aef95222a9 100644 Binary files a/guides/assets/images/jaimeiniesta.jpg and b/guides/assets/images/jaimeiniesta.jpg differ diff --git a/guides/assets/images/nav_arrow.gif b/guides/assets/images/nav_arrow.gif index c4f57658d7..ff081819ad 100644 Binary files a/guides/assets/images/nav_arrow.gif and b/guides/assets/images/nav_arrow.gif differ diff --git a/guides/assets/images/polymorphic.png b/guides/assets/images/polymorphic.png index ff2fd9f76d..a3cbc4502a 100644 Binary files a/guides/assets/images/polymorphic.png and b/guides/assets/images/polymorphic.png differ diff --git a/guides/assets/images/radar.png b/guides/assets/images/radar.png index f61e08763f..caa5b7655b 100644 Binary files a/guides/assets/images/radar.png and b/guides/assets/images/radar.png differ diff --git a/guides/assets/images/rails_guides_kindle_cover.jpg b/guides/assets/images/rails_guides_kindle_cover.jpg index 9eb16720a9..f068bd9a04 100644 Binary files a/guides/assets/images/rails_guides_kindle_cover.jpg and b/guides/assets/images/rails_guides_kindle_cover.jpg differ diff --git a/guides/assets/images/rails_guides_logo.gif b/guides/assets/images/rails_guides_logo.gif index a24683a34e..9b0ad5af28 100644 Binary files a/guides/assets/images/rails_guides_logo.gif and b/guides/assets/images/rails_guides_logo.gif differ diff --git a/guides/assets/images/rails_welcome.png b/guides/assets/images/rails_welcome.png index f2aa210d19..8ad2d351de 100644 Binary files a/guides/assets/images/rails_welcome.png and b/guides/assets/images/rails_welcome.png differ diff --git a/guides/assets/images/session_fixation.png b/guides/assets/images/session_fixation.png index 6b084508db..ac3ab01614 100644 Binary files a/guides/assets/images/session_fixation.png and b/guides/assets/images/session_fixation.png differ diff --git a/guides/assets/images/tab_grey.gif b/guides/assets/images/tab_grey.gif index e9680b7136..995adb76cf 100644 Binary files a/guides/assets/images/tab_grey.gif and b/guides/assets/images/tab_grey.gif differ diff --git a/guides/assets/images/tab_info.gif b/guides/assets/images/tab_info.gif index 458fea9a61..e9dd164f18 100644 Binary files a/guides/assets/images/tab_info.gif and b/guides/assets/images/tab_info.gif differ diff --git a/guides/assets/images/tab_note.gif b/guides/assets/images/tab_note.gif index 1d5c171ed6..f9b546c6f8 100644 Binary files a/guides/assets/images/tab_note.gif and b/guides/assets/images/tab_note.gif differ diff --git a/guides/assets/images/tab_red.gif b/guides/assets/images/tab_red.gif index daf140b5a8..0613093ddc 100644 Binary files a/guides/assets/images/tab_red.gif and b/guides/assets/images/tab_red.gif differ diff --git a/guides/assets/images/tab_yellow.gif b/guides/assets/images/tab_yellow.gif index dc961c99dd..39a3c2dc6a 100644 Binary files a/guides/assets/images/tab_yellow.gif and b/guides/assets/images/tab_yellow.gif differ diff --git a/guides/assets/images/tab_yellow.png b/guides/assets/images/tab_yellow.png index cceea6581f..3ab1c56c4d 100644 Binary files a/guides/assets/images/tab_yellow.png and b/guides/assets/images/tab_yellow.png differ diff --git a/guides/assets/images/validation_error_messages.png b/guides/assets/images/validation_error_messages.png index 622d35da5d..30e4ca4a3d 100644 Binary files a/guides/assets/images/validation_error_messages.png and b/guides/assets/images/validation_error_messages.png differ diff --git a/guides/assets/images/vijaydev.jpg b/guides/assets/images/vijaydev.jpg index e21d3cabfc..fe5e4f1cb4 100644 Binary files a/guides/assets/images/vijaydev.jpg and b/guides/assets/images/vijaydev.jpg differ -- cgit v1.2.3 From 40b5d2823722fec2c2e02f3ed46f7f47f2205b73 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 7 May 2012 17:04:10 +0200 Subject: Revert "Compressed all images from the guide through ImageOptim which saves sometimes up to 74.6% in size [ci skip]" Reason: this change can't really be done in docrails, see http://weblog.rubyonrails.org/2012/3/7/what-is-docrails/ This reverts commit bc06e8d706fd8818d434c66f46d2e889ca24bd2d. --- guides/assets/images/belongs_to.png | Bin 26076 -> 34017 bytes guides/assets/images/book_icon.gif | Bin 329 -> 337 bytes guides/assets/images/challenge.png | Bin 33373 -> 54134 bytes guides/assets/images/chapters_icon.gif | Bin 620 -> 628 bytes guides/assets/images/check_bullet.gif | Bin 376 -> 384 bytes guides/assets/images/credits_pic_blank.gif | Bin 597 -> 613 bytes guides/assets/images/csrf.png | Bin 32179 -> 41996 bytes guides/assets/images/customized_error_messages.png | Bin 2561 -> 5055 bytes guides/assets/images/edge_badge.png | Bin 5964 -> 7945 bytes guides/assets/images/error_messages.png | Bin 10964 -> 14645 bytes guides/assets/images/feature_tile.gif | Bin 35 -> 43 bytes guides/assets/images/footer_tile.gif | Bin 36 -> 44 bytes guides/assets/images/fxn.png | Bin 15434 -> 20664 bytes .../images/getting_started/confirm_dialog.png | Bin 29542 -> 36070 bytes .../images/getting_started/form_with_errors.png | Bin 14031 -> 20820 bytes .../index_action_with_edit_link.png | Bin 9772 -> 15547 bytes guides/assets/images/getting_started/new_post.png | Bin 5888 -> 14334 bytes .../images/getting_started/post_with_comments.png | Bin 18496 -> 31630 bytes .../routing_error_no_controller.png | Bin 6268 -> 15744 bytes .../routing_error_no_route_matches.png | Bin 6508 -> 16065 bytes .../getting_started/show_action_for_posts.png | Bin 2991 -> 6885 bytes .../template_is_missing_posts_new.png | Bin 5851 -> 15168 bytes .../getting_started/undefined_method_post_path.png | Bin 9217 -> 15254 bytes .../unknown_action_create_for_posts.png | Bin 4146 -> 12652 bytes .../unknown_action_new_for_posts.png | Bin 4208 -> 12756 bytes guides/assets/images/grey_bullet.gif | Bin 37 -> 45 bytes guides/assets/images/habtm.png | Bin 49325 -> 63801 bytes guides/assets/images/has_many.png | Bin 28988 -> 38582 bytes guides/assets/images/has_many_through.png | Bin 79428 -> 100220 bytes guides/assets/images/has_one.png | Bin 29072 -> 39022 bytes guides/assets/images/has_one_through.png | Bin 72434 -> 92594 bytes guides/assets/images/header_backdrop.png | Bin 224 -> 882 bytes guides/assets/images/header_tile.gif | Bin 36 -> 44 bytes guides/assets/images/i18n/demo_html_safe.png | Bin 10073 -> 11946 bytes .../assets/images/i18n/demo_localized_pirate.png | Bin 11485 -> 15027 bytes guides/assets/images/i18n/demo_translated_en.png | Bin 9325 -> 12057 bytes .../assets/images/i18n/demo_translated_pirate.png | Bin 10202 -> 13392 bytes .../images/i18n/demo_translation_missing.png | Bin 10260 -> 13143 bytes guides/assets/images/i18n/demo_untranslated.png | Bin 9224 -> 11925 bytes guides/assets/images/icons/callouts/1.png | Bin 147 -> 329 bytes guides/assets/images/icons/callouts/10.png | Bin 183 -> 361 bytes guides/assets/images/icons/callouts/11.png | Bin 290 -> 565 bytes guides/assets/images/icons/callouts/12.png | Bin 322 -> 617 bytes guides/assets/images/icons/callouts/13.png | Bin 328 -> 623 bytes guides/assets/images/icons/callouts/14.png | Bin 246 -> 411 bytes guides/assets/images/icons/callouts/15.png | Bin 340 -> 640 bytes guides/assets/images/icons/callouts/2.png | Bin 168 -> 353 bytes guides/assets/images/icons/callouts/3.png | Bin 170 -> 350 bytes guides/assets/images/icons/callouts/4.png | Bin 165 -> 345 bytes guides/assets/images/icons/callouts/5.png | Bin 169 -> 348 bytes guides/assets/images/icons/callouts/6.png | Bin 176 -> 355 bytes guides/assets/images/icons/callouts/7.png | Bin 160 -> 344 bytes guides/assets/images/icons/callouts/8.png | Bin 176 -> 357 bytes guides/assets/images/icons/callouts/9.png | Bin 177 -> 357 bytes guides/assets/images/icons/caution.png | Bin 2300 -> 2554 bytes guides/assets/images/icons/example.png | Bin 2079 -> 2354 bytes guides/assets/images/icons/home.png | Bin 1163 -> 1340 bytes guides/assets/images/icons/important.png | Bin 2451 -> 2657 bytes guides/assets/images/icons/next.png | Bin 1146 -> 1302 bytes guides/assets/images/icons/note.png | Bin 2155 -> 2730 bytes guides/assets/images/icons/prev.png | Bin 1126 -> 1348 bytes guides/assets/images/icons/tip.png | Bin 2248 -> 2602 bytes guides/assets/images/icons/up.png | Bin 1133 -> 1320 bytes guides/assets/images/icons/warning.png | Bin 2616 -> 2828 bytes guides/assets/images/jaimeiniesta.jpg | Bin 7617 -> 11913 bytes guides/assets/images/nav_arrow.gif | Bin 419 -> 427 bytes guides/assets/images/polymorphic.png | Bin 66415 -> 85248 bytes guides/assets/images/radar.png | Bin 17101 -> 19521 bytes guides/assets/images/rails_guides_kindle_cover.jpg | Bin 20955 -> 31785 bytes guides/assets/images/rails_guides_logo.gif | Bin 5106 -> 5114 bytes guides/assets/images/rails_welcome.png | Bin 71979 -> 121314 bytes guides/assets/images/session_fixation.png | Bin 38451 -> 47860 bytes guides/assets/images/tab_grey.gif | Bin 4684 -> 4924 bytes guides/assets/images/tab_info.gif | Bin 4522 -> 4762 bytes guides/assets/images/tab_note.gif | Bin 4566 -> 4807 bytes guides/assets/images/tab_red.gif | Bin 4507 -> 4753 bytes guides/assets/images/tab_yellow.gif | Bin 4519 -> 4759 bytes guides/assets/images/tab_yellow.png | Bin 1441 -> 1611 bytes guides/assets/images/validation_error_messages.png | Bin 583 -> 1107 bytes guides/assets/images/vijaydev.jpg | Bin 2897 -> 4610 bytes 80 files changed, 0 insertions(+), 0 deletions(-) (limited to 'guides') diff --git a/guides/assets/images/belongs_to.png b/guides/assets/images/belongs_to.png index 43c963ffa8..44243edbca 100644 Binary files a/guides/assets/images/belongs_to.png and b/guides/assets/images/belongs_to.png differ diff --git a/guides/assets/images/book_icon.gif b/guides/assets/images/book_icon.gif index efc5e06880..c81d5db520 100644 Binary files a/guides/assets/images/book_icon.gif and b/guides/assets/images/book_icon.gif differ diff --git a/guides/assets/images/challenge.png b/guides/assets/images/challenge.png index 30be3d7028..d163748640 100644 Binary files a/guides/assets/images/challenge.png and b/guides/assets/images/challenge.png differ diff --git a/guides/assets/images/chapters_icon.gif b/guides/assets/images/chapters_icon.gif index a61c28c02d..06fb415f4a 100644 Binary files a/guides/assets/images/chapters_icon.gif and b/guides/assets/images/chapters_icon.gif differ diff --git a/guides/assets/images/check_bullet.gif b/guides/assets/images/check_bullet.gif index bd54ef64c9..1fcfeba250 100644 Binary files a/guides/assets/images/check_bullet.gif and b/guides/assets/images/check_bullet.gif differ diff --git a/guides/assets/images/credits_pic_blank.gif b/guides/assets/images/credits_pic_blank.gif index a6b335d0c9..f6f654fc65 100644 Binary files a/guides/assets/images/credits_pic_blank.gif and b/guides/assets/images/credits_pic_blank.gif differ diff --git a/guides/assets/images/csrf.png b/guides/assets/images/csrf.png index a8123d47c3..ab73baafe8 100644 Binary files a/guides/assets/images/csrf.png and b/guides/assets/images/csrf.png differ diff --git a/guides/assets/images/customized_error_messages.png b/guides/assets/images/customized_error_messages.png index fcf47b4be0..fa676991e3 100644 Binary files a/guides/assets/images/customized_error_messages.png and b/guides/assets/images/customized_error_messages.png differ diff --git a/guides/assets/images/edge_badge.png b/guides/assets/images/edge_badge.png index a35dc9f8ee..cddd46c4b8 100644 Binary files a/guides/assets/images/edge_badge.png and b/guides/assets/images/edge_badge.png differ diff --git a/guides/assets/images/error_messages.png b/guides/assets/images/error_messages.png index 1189e486d4..428892194a 100644 Binary files a/guides/assets/images/error_messages.png and b/guides/assets/images/error_messages.png differ diff --git a/guides/assets/images/feature_tile.gif b/guides/assets/images/feature_tile.gif index ba0171b761..75469361db 100644 Binary files a/guides/assets/images/feature_tile.gif and b/guides/assets/images/feature_tile.gif differ diff --git a/guides/assets/images/footer_tile.gif b/guides/assets/images/footer_tile.gif index 09dbfd2973..bb33fc1ff0 100644 Binary files a/guides/assets/images/footer_tile.gif and b/guides/assets/images/footer_tile.gif differ diff --git a/guides/assets/images/fxn.png b/guides/assets/images/fxn.png index 6800fc9bc3..9b531ee584 100644 Binary files a/guides/assets/images/fxn.png and b/guides/assets/images/fxn.png differ diff --git a/guides/assets/images/getting_started/confirm_dialog.png b/guides/assets/images/getting_started/confirm_dialog.png index 1a13eddd91..a26c09ef2d 100644 Binary files a/guides/assets/images/getting_started/confirm_dialog.png and b/guides/assets/images/getting_started/confirm_dialog.png differ diff --git a/guides/assets/images/getting_started/form_with_errors.png b/guides/assets/images/getting_started/form_with_errors.png index 6910e1647e..badefe6ea6 100644 Binary files a/guides/assets/images/getting_started/form_with_errors.png and b/guides/assets/images/getting_started/form_with_errors.png differ diff --git a/guides/assets/images/getting_started/index_action_with_edit_link.png b/guides/assets/images/getting_started/index_action_with_edit_link.png index bf23cba231..6e58a13756 100644 Binary files a/guides/assets/images/getting_started/index_action_with_edit_link.png and b/guides/assets/images/getting_started/index_action_with_edit_link.png differ diff --git a/guides/assets/images/getting_started/new_post.png b/guides/assets/images/getting_started/new_post.png index b573cb164c..dc9459032a 100644 Binary files a/guides/assets/images/getting_started/new_post.png and b/guides/assets/images/getting_started/new_post.png differ diff --git a/guides/assets/images/getting_started/post_with_comments.png b/guides/assets/images/getting_started/post_with_comments.png index e13095ff8f..bd9b2e10f5 100644 Binary files a/guides/assets/images/getting_started/post_with_comments.png and b/guides/assets/images/getting_started/post_with_comments.png differ diff --git a/guides/assets/images/getting_started/routing_error_no_controller.png b/guides/assets/images/getting_started/routing_error_no_controller.png index 407ea2ea06..92a39efd78 100644 Binary files a/guides/assets/images/getting_started/routing_error_no_controller.png and b/guides/assets/images/getting_started/routing_error_no_controller.png differ diff --git a/guides/assets/images/getting_started/routing_error_no_route_matches.png b/guides/assets/images/getting_started/routing_error_no_route_matches.png index d461807c5d..bc768a94a2 100644 Binary files a/guides/assets/images/getting_started/routing_error_no_route_matches.png and b/guides/assets/images/getting_started/routing_error_no_route_matches.png differ diff --git a/guides/assets/images/getting_started/show_action_for_posts.png b/guides/assets/images/getting_started/show_action_for_posts.png index 9467df6a07..5c8c4d8e5e 100644 Binary files a/guides/assets/images/getting_started/show_action_for_posts.png and b/guides/assets/images/getting_started/show_action_for_posts.png differ diff --git a/guides/assets/images/getting_started/template_is_missing_posts_new.png b/guides/assets/images/getting_started/template_is_missing_posts_new.png index 6860aaeca7..9f070d59db 100644 Binary files a/guides/assets/images/getting_started/template_is_missing_posts_new.png and b/guides/assets/images/getting_started/template_is_missing_posts_new.png differ diff --git a/guides/assets/images/getting_started/undefined_method_post_path.png b/guides/assets/images/getting_started/undefined_method_post_path.png index c29cb2f54f..f568bf315c 100644 Binary files a/guides/assets/images/getting_started/undefined_method_post_path.png and b/guides/assets/images/getting_started/undefined_method_post_path.png differ diff --git a/guides/assets/images/getting_started/unknown_action_create_for_posts.png b/guides/assets/images/getting_started/unknown_action_create_for_posts.png index 1eca14b988..03d92dfb7d 100644 Binary files a/guides/assets/images/getting_started/unknown_action_create_for_posts.png and b/guides/assets/images/getting_started/unknown_action_create_for_posts.png differ diff --git a/guides/assets/images/getting_started/unknown_action_new_for_posts.png b/guides/assets/images/getting_started/unknown_action_new_for_posts.png index fd72586573..b63883d922 100644 Binary files a/guides/assets/images/getting_started/unknown_action_new_for_posts.png and b/guides/assets/images/getting_started/unknown_action_new_for_posts.png differ diff --git a/guides/assets/images/grey_bullet.gif b/guides/assets/images/grey_bullet.gif index 3c08b1571c..e75e8e93a1 100644 Binary files a/guides/assets/images/grey_bullet.gif and b/guides/assets/images/grey_bullet.gif differ diff --git a/guides/assets/images/habtm.png b/guides/assets/images/habtm.png index 326b91903a..fea78b0b5c 100644 Binary files a/guides/assets/images/habtm.png and b/guides/assets/images/habtm.png differ diff --git a/guides/assets/images/has_many.png b/guides/assets/images/has_many.png index e7589e3b75..6cff58460d 100644 Binary files a/guides/assets/images/has_many.png and b/guides/assets/images/has_many.png differ diff --git a/guides/assets/images/has_many_through.png b/guides/assets/images/has_many_through.png index 858c898dc1..85d7599925 100644 Binary files a/guides/assets/images/has_many_through.png and b/guides/assets/images/has_many_through.png differ diff --git a/guides/assets/images/has_one.png b/guides/assets/images/has_one.png index 93faa05b07..a70ddaaa86 100644 Binary files a/guides/assets/images/has_one.png and b/guides/assets/images/has_one.png differ diff --git a/guides/assets/images/has_one_through.png b/guides/assets/images/has_one_through.png index 07dac1a27d..89a7617a30 100644 Binary files a/guides/assets/images/has_one_through.png and b/guides/assets/images/has_one_through.png differ diff --git a/guides/assets/images/header_backdrop.png b/guides/assets/images/header_backdrop.png index 72b030478f..ff2982175e 100644 Binary files a/guides/assets/images/header_backdrop.png and b/guides/assets/images/header_backdrop.png differ diff --git a/guides/assets/images/header_tile.gif b/guides/assets/images/header_tile.gif index 476b5dbd57..e2c878d492 100644 Binary files a/guides/assets/images/header_tile.gif and b/guides/assets/images/header_tile.gif differ diff --git a/guides/assets/images/i18n/demo_html_safe.png b/guides/assets/images/i18n/demo_html_safe.png index 9afa8ebec1..f881f60dac 100644 Binary files a/guides/assets/images/i18n/demo_html_safe.png and b/guides/assets/images/i18n/demo_html_safe.png differ diff --git a/guides/assets/images/i18n/demo_localized_pirate.png b/guides/assets/images/i18n/demo_localized_pirate.png index bf8d0b558c..9134709573 100644 Binary files a/guides/assets/images/i18n/demo_localized_pirate.png and b/guides/assets/images/i18n/demo_localized_pirate.png differ diff --git a/guides/assets/images/i18n/demo_translated_en.png b/guides/assets/images/i18n/demo_translated_en.png index e887bfa306..ecdd878d38 100644 Binary files a/guides/assets/images/i18n/demo_translated_en.png and b/guides/assets/images/i18n/demo_translated_en.png differ diff --git a/guides/assets/images/i18n/demo_translated_pirate.png b/guides/assets/images/i18n/demo_translated_pirate.png index aa5618a865..41c580923a 100644 Binary files a/guides/assets/images/i18n/demo_translated_pirate.png and b/guides/assets/images/i18n/demo_translated_pirate.png differ diff --git a/guides/assets/images/i18n/demo_translation_missing.png b/guides/assets/images/i18n/demo_translation_missing.png index 867aa7c42d..af9e2d0427 100644 Binary files a/guides/assets/images/i18n/demo_translation_missing.png and b/guides/assets/images/i18n/demo_translation_missing.png differ diff --git a/guides/assets/images/i18n/demo_untranslated.png b/guides/assets/images/i18n/demo_untranslated.png index 2ea6404822..3603f43463 100644 Binary files a/guides/assets/images/i18n/demo_untranslated.png and b/guides/assets/images/i18n/demo_untranslated.png differ diff --git a/guides/assets/images/icons/callouts/1.png b/guides/assets/images/icons/callouts/1.png index c5d02adcf4..7d473430b7 100644 Binary files a/guides/assets/images/icons/callouts/1.png and b/guides/assets/images/icons/callouts/1.png differ diff --git a/guides/assets/images/icons/callouts/10.png b/guides/assets/images/icons/callouts/10.png index fe89f9ef83..997bbc8246 100644 Binary files a/guides/assets/images/icons/callouts/10.png and b/guides/assets/images/icons/callouts/10.png differ diff --git a/guides/assets/images/icons/callouts/11.png b/guides/assets/images/icons/callouts/11.png index 9244a1ac4b..ce47dac3f5 100644 Binary files a/guides/assets/images/icons/callouts/11.png and b/guides/assets/images/icons/callouts/11.png differ diff --git a/guides/assets/images/icons/callouts/12.png b/guides/assets/images/icons/callouts/12.png index ae56459f4c..31daf4e2f2 100644 Binary files a/guides/assets/images/icons/callouts/12.png and b/guides/assets/images/icons/callouts/12.png differ diff --git a/guides/assets/images/icons/callouts/13.png b/guides/assets/images/icons/callouts/13.png index 1181f9f892..14021a89c2 100644 Binary files a/guides/assets/images/icons/callouts/13.png and b/guides/assets/images/icons/callouts/13.png differ diff --git a/guides/assets/images/icons/callouts/14.png b/guides/assets/images/icons/callouts/14.png index 4274e6580a..64014b75fe 100644 Binary files a/guides/assets/images/icons/callouts/14.png and b/guides/assets/images/icons/callouts/14.png differ diff --git a/guides/assets/images/icons/callouts/15.png b/guides/assets/images/icons/callouts/15.png index 39304de94f..0d65765fcf 100644 Binary files a/guides/assets/images/icons/callouts/15.png and b/guides/assets/images/icons/callouts/15.png differ diff --git a/guides/assets/images/icons/callouts/2.png b/guides/assets/images/icons/callouts/2.png index 8c57970ba9..5d09341b2f 100644 Binary files a/guides/assets/images/icons/callouts/2.png and b/guides/assets/images/icons/callouts/2.png differ diff --git a/guides/assets/images/icons/callouts/3.png b/guides/assets/images/icons/callouts/3.png index 57a33d15b4..ef7b700471 100644 Binary files a/guides/assets/images/icons/callouts/3.png and b/guides/assets/images/icons/callouts/3.png differ diff --git a/guides/assets/images/icons/callouts/4.png b/guides/assets/images/icons/callouts/4.png index f061ab02b8..adb8364eb5 100644 Binary files a/guides/assets/images/icons/callouts/4.png and b/guides/assets/images/icons/callouts/4.png differ diff --git a/guides/assets/images/icons/callouts/5.png b/guides/assets/images/icons/callouts/5.png index b4de02da11..4d7eb46002 100644 Binary files a/guides/assets/images/icons/callouts/5.png and b/guides/assets/images/icons/callouts/5.png differ diff --git a/guides/assets/images/icons/callouts/6.png b/guides/assets/images/icons/callouts/6.png index 0e055eec1e..0ba694af6c 100644 Binary files a/guides/assets/images/icons/callouts/6.png and b/guides/assets/images/icons/callouts/6.png differ diff --git a/guides/assets/images/icons/callouts/7.png b/guides/assets/images/icons/callouts/7.png index 5ead87d040..472e96f8ac 100644 Binary files a/guides/assets/images/icons/callouts/7.png and b/guides/assets/images/icons/callouts/7.png differ diff --git a/guides/assets/images/icons/callouts/8.png b/guides/assets/images/icons/callouts/8.png index cb99545eb6..5e60973c21 100644 Binary files a/guides/assets/images/icons/callouts/8.png and b/guides/assets/images/icons/callouts/8.png differ diff --git a/guides/assets/images/icons/callouts/9.png b/guides/assets/images/icons/callouts/9.png index 0ac03602f6..a0676d26cc 100644 Binary files a/guides/assets/images/icons/callouts/9.png and b/guides/assets/images/icons/callouts/9.png differ diff --git a/guides/assets/images/icons/caution.png b/guides/assets/images/icons/caution.png index 031e19c776..cb9d5ea0df 100644 Binary files a/guides/assets/images/icons/caution.png and b/guides/assets/images/icons/caution.png differ diff --git a/guides/assets/images/icons/example.png b/guides/assets/images/icons/example.png index 1b0e482059..bba1c0010d 100644 Binary files a/guides/assets/images/icons/example.png and b/guides/assets/images/icons/example.png differ diff --git a/guides/assets/images/icons/home.png b/guides/assets/images/icons/home.png index 24149d6e78..37a5231bac 100644 Binary files a/guides/assets/images/icons/home.png and b/guides/assets/images/icons/home.png differ diff --git a/guides/assets/images/icons/important.png b/guides/assets/images/icons/important.png index dafcf0f59e..1096c23295 100644 Binary files a/guides/assets/images/icons/important.png and b/guides/assets/images/icons/important.png differ diff --git a/guides/assets/images/icons/next.png b/guides/assets/images/icons/next.png index 355b329f5a..64e126bdda 100644 Binary files a/guides/assets/images/icons/next.png and b/guides/assets/images/icons/next.png differ diff --git a/guides/assets/images/icons/note.png b/guides/assets/images/icons/note.png index 08d35a6f5c..841820f7c4 100644 Binary files a/guides/assets/images/icons/note.png and b/guides/assets/images/icons/note.png differ diff --git a/guides/assets/images/icons/prev.png b/guides/assets/images/icons/prev.png index ea564c865e..3e8f12fe24 100644 Binary files a/guides/assets/images/icons/prev.png and b/guides/assets/images/icons/prev.png differ diff --git a/guides/assets/images/icons/tip.png b/guides/assets/images/icons/tip.png index d834e6d1bb..a3a029d898 100644 Binary files a/guides/assets/images/icons/tip.png and b/guides/assets/images/icons/tip.png differ diff --git a/guides/assets/images/icons/up.png b/guides/assets/images/icons/up.png index 379f0045af..2db1ce62fa 100644 Binary files a/guides/assets/images/icons/up.png and b/guides/assets/images/icons/up.png differ diff --git a/guides/assets/images/icons/warning.png b/guides/assets/images/icons/warning.png index 72a8a5d873..0b0c419df2 100644 Binary files a/guides/assets/images/icons/warning.png and b/guides/assets/images/icons/warning.png differ diff --git a/guides/assets/images/jaimeiniesta.jpg b/guides/assets/images/jaimeiniesta.jpg index aef95222a9..445f048d92 100644 Binary files a/guides/assets/images/jaimeiniesta.jpg and b/guides/assets/images/jaimeiniesta.jpg differ diff --git a/guides/assets/images/nav_arrow.gif b/guides/assets/images/nav_arrow.gif index ff081819ad..c4f57658d7 100644 Binary files a/guides/assets/images/nav_arrow.gif and b/guides/assets/images/nav_arrow.gif differ diff --git a/guides/assets/images/polymorphic.png b/guides/assets/images/polymorphic.png index a3cbc4502a..ff2fd9f76d 100644 Binary files a/guides/assets/images/polymorphic.png and b/guides/assets/images/polymorphic.png differ diff --git a/guides/assets/images/radar.png b/guides/assets/images/radar.png index caa5b7655b..f61e08763f 100644 Binary files a/guides/assets/images/radar.png and b/guides/assets/images/radar.png differ diff --git a/guides/assets/images/rails_guides_kindle_cover.jpg b/guides/assets/images/rails_guides_kindle_cover.jpg index f068bd9a04..9eb16720a9 100644 Binary files a/guides/assets/images/rails_guides_kindle_cover.jpg and b/guides/assets/images/rails_guides_kindle_cover.jpg differ diff --git a/guides/assets/images/rails_guides_logo.gif b/guides/assets/images/rails_guides_logo.gif index 9b0ad5af28..a24683a34e 100644 Binary files a/guides/assets/images/rails_guides_logo.gif and b/guides/assets/images/rails_guides_logo.gif differ diff --git a/guides/assets/images/rails_welcome.png b/guides/assets/images/rails_welcome.png index 8ad2d351de..f2aa210d19 100644 Binary files a/guides/assets/images/rails_welcome.png and b/guides/assets/images/rails_welcome.png differ diff --git a/guides/assets/images/session_fixation.png b/guides/assets/images/session_fixation.png index ac3ab01614..6b084508db 100644 Binary files a/guides/assets/images/session_fixation.png and b/guides/assets/images/session_fixation.png differ diff --git a/guides/assets/images/tab_grey.gif b/guides/assets/images/tab_grey.gif index 995adb76cf..e9680b7136 100644 Binary files a/guides/assets/images/tab_grey.gif and b/guides/assets/images/tab_grey.gif differ diff --git a/guides/assets/images/tab_info.gif b/guides/assets/images/tab_info.gif index e9dd164f18..458fea9a61 100644 Binary files a/guides/assets/images/tab_info.gif and b/guides/assets/images/tab_info.gif differ diff --git a/guides/assets/images/tab_note.gif b/guides/assets/images/tab_note.gif index f9b546c6f8..1d5c171ed6 100644 Binary files a/guides/assets/images/tab_note.gif and b/guides/assets/images/tab_note.gif differ diff --git a/guides/assets/images/tab_red.gif b/guides/assets/images/tab_red.gif index 0613093ddc..daf140b5a8 100644 Binary files a/guides/assets/images/tab_red.gif and b/guides/assets/images/tab_red.gif differ diff --git a/guides/assets/images/tab_yellow.gif b/guides/assets/images/tab_yellow.gif index 39a3c2dc6a..dc961c99dd 100644 Binary files a/guides/assets/images/tab_yellow.gif and b/guides/assets/images/tab_yellow.gif differ diff --git a/guides/assets/images/tab_yellow.png b/guides/assets/images/tab_yellow.png index 3ab1c56c4d..cceea6581f 100644 Binary files a/guides/assets/images/tab_yellow.png and b/guides/assets/images/tab_yellow.png differ diff --git a/guides/assets/images/validation_error_messages.png b/guides/assets/images/validation_error_messages.png index 30e4ca4a3d..622d35da5d 100644 Binary files a/guides/assets/images/validation_error_messages.png and b/guides/assets/images/validation_error_messages.png differ diff --git a/guides/assets/images/vijaydev.jpg b/guides/assets/images/vijaydev.jpg index fe5e4f1cb4..e21d3cabfc 100644 Binary files a/guides/assets/images/vijaydev.jpg and b/guides/assets/images/vijaydev.jpg differ -- cgit v1.2.3 From 66e0e4216c55c29557a2789a96c3847a901ccb30 Mon Sep 17 00:00:00 2001 From: Alexey Gaziev Date: Mon, 30 Apr 2012 00:40:19 +0400 Subject: Fix some guides for AS core_ext --- .../source/active_support_core_extensions.textile | 130 +++++++++++---------- 1 file changed, 66 insertions(+), 64 deletions(-) (limited to 'guides') diff --git a/guides/source/active_support_core_extensions.textile b/guides/source/active_support_core_extensions.textile index e4a6e145b9..4bee3e400e 100644 --- a/guides/source/active_support_core_extensions.textile +++ b/guides/source/active_support_core_extensions.textile @@ -1034,49 +1034,6 @@ A model may find it useful to set +:instance_accessor+ to +false+ as a way to pr NOTE: Defined in +active_support/core_ext/class/attribute_accessors.rb+. -h4. Class Inheritable Attributes - -WARNING: Class Inheritable Attributes are deprecated. It's recommended that you use +Class#class_attribute+ instead. - -Class variables are shared down the inheritance tree. Class instance variables are not shared, but they are not inherited either. The macros +class_inheritable_reader+, +class_inheritable_writer+, and +class_inheritable_accessor+ provide accessors for class-level data which is inherited but not shared with children: - - -module ActionController - class Base - # FIXME: REVISE/SIMPLIFY THIS COMMENT. - # The value of allow_forgery_protection is inherited, - # but its value in a particular class does not affect - # the value in the rest of the controllers hierarchy. - class_inheritable_accessor :allow_forgery_protection - end -end - - -They accomplish this with class instance variables and cloning on subclassing, there are no class variables involved. Cloning is performed with +dup+ as long as the value is duplicable. - -There are some variants specialised in arrays and hashes: - - -class_inheritable_array -class_inheritable_hash - - -Those writers take any inherited array or hash into account and extend them rather than overwrite them. - -As with vanilla class attribute accessors these macros create convenience instance methods for reading and writing. The generation of the writer instance method can be prevented setting +:instance_writer+ to +false+ (not any false value, but exactly +false+): - - -module ActiveRecord - class Base - class_inheritable_accessor :default_scoping, :instance_writer => false - end -end - - -Since values are copied when a subclass is defined, if the base class changes the attribute after that, the subclass does not see the new value. That's the point. - -NOTE: Defined in +active_support/core_ext/class/inheritable_attributes.rb+. - h4. Subclasses & Descendants h5. +subclasses+ @@ -1255,9 +1212,14 @@ Pass a +:separator+ to truncate the string at a natural break: # => "Oh dear! Oh..."
-In the above example "dear" gets cut first, but then +:separator+ prevents it. +The option +:separator+ can be a regexp: + + +"Oh dear! Oh dear! I shall be late!".truncate(18, :separator => /\s/) +# => "Oh dear! Oh..." + -WARNING: The option +:separator+ can't be a regexp. +In above examples "dear" gets cut first, but then +:separator+ prevents it. NOTE: Defined in +active_support/core_ext/string/filters.rb+. @@ -1810,6 +1772,43 @@ Singular forms are aliased so you are able to say: NOTE: Defined in +active_support/core_ext/numeric/bytes.rb+. +h4. Time + +Enables the use of time calculations and declarations, like 45.minutes + 2.hours + 4.years. + +These methods use Time#advance for precise date calculations when using from_now, ago, etc. +as well as adding or subtracting their results from a Time object. For example: + + +# equivalent to Time.now.advance(:months => 1) +1.month.from_now + +# equivalent to Time.now.advance(:years => 2) +2.years.from_now + +# equivalent to Time.now.advance(:months => 4, :years => 5) +(4.months + 5.years).from_now + + +While these methods provide precise calculation when used as in the examples above, care +should be taken to note that this is not true if the result of `months', `years', etc is +converted before use: + + +# equivalent to 30.days.to_i.from_now +1.month.to_i.from_now + +# equivalent to 365.25.days.to_f.from_now +1.year.to_f.from_now + + +In such cases, Ruby's core +Date[http://ruby-doc.org/stdlib/libdoc/date/rdoc/Date.html] and +Time[http://ruby-doc.org/stdlib/libdoc/time/rdoc/Time.html] should be used for precision +date and time arithmetic. + +NOTE: Defined in +active_support/core_ext/numeric/time.rb+. + h3. Extensions to +Integer+ h4. +multiple_of?+ @@ -2103,20 +2102,20 @@ To do so it sends +to_xml+ to every item in turn, and collects the results under By default, the name of the root element is the underscorized and dasherized plural of the name of the class of the first item, provided the rest of elements belong to that type (checked with is_a?) and they are not hashes. In the example above that's "contributors". -If there's any element that does not belong to the type of the first one the root node becomes "records": +If there's any element that does not belong to the type of the first one the root node becomes "objects": [Contributor.first, Commit.first].to_xml # => # -# -# +# +# # 4583 # Aaron Batalion # 53 # aaron-batalion -# -# +# +# # Joshua Peek # 2009-09-02T16:44:36Z # origin/master @@ -2127,30 +2126,30 @@ If there's any element that does not belong to the type of the first one the roo # false # Kill AMo observing wrap_with_notifications since ARes was only using it # 723a47bfb3708f968821bc969a9a3fc873a3ed58 -# -# +# +# -If the receiver is an array of hashes the root element is by default also "records": +If the receiver is an array of hashes the root element is by default also "objects": [{:a => 1, :b => 2}, {:c => 3}].to_xml # => # -# -# +# +# # 2 # 1 -# -# +# +# # 3 -# -# +# +# WARNING. If the collection is empty the root element is by default "nil-classes". That's a gotcha, for example the root element of the list of contributors above would not be "contributors" if the collection was empty, but "nil-classes". You may use the :root option to ensure a consistent root element. -The name of children nodes is by default the name of the root node singularized. In the examples above we've seen "contributor" and "record". The option :children allows you to set these node names. +The name of children nodes is by default the name of the root node singularized. In the examples above we've seen "contributor" and "object". The option :children allows you to set these node names. The default XML builder is a fresh instance of Builder::XmlMarkup. You can configure your own builder via the :builder option. The method also accepts options like :dasherize and friends, they are forwarded to the builder: @@ -2707,22 +2706,25 @@ NOTE: Defined in +active_support/core_ext/range/blockless_step.rb+. h4. +include?+ -The method +Range#include?+ says whether some value falls between the ends of a given instance: +The methods +Range#include?+ and +Range#===+ say whether some value falls between the ends of a given instance: (2..3).include?(Math::E) # => true -Active Support extends this method so that the argument may be another range in turn. In that case we test whether the ends of the argument range belong to the receiver themselves: +Active Support extends these methods so that the argument may be another range in turn. In that case we test whether the ends of the argument range belong to the receiver themselves: (1..10).include?(3..7) # => true (1..10).include?(0..7) # => false (1..10).include?(3..11) # => false (1...9).include?(3..9) # => false - -WARNING: The original +Range#include?+ is still the one aliased to +Range#===+. +(1..10) === (3..7) # => true +(1..10) === (0..7) # => false +(1..10) === (3..11) # => false +(1...9) === (3..9) # => false +
NOTE: Defined in +active_support/core_ext/range/include_range.rb+. -- cgit v1.2.3 From d785b292a8c921989f606696dff3765836d1fb44 Mon Sep 17 00:00:00 2001 From: Alexey Gaziev Date: Mon, 7 May 2012 22:40:59 +0400 Subject: Changes for numeric api for Time because Time.current works different --- guides/source/active_support_core_extensions.textile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'guides') diff --git a/guides/source/active_support_core_extensions.textile b/guides/source/active_support_core_extensions.textile index 4bee3e400e..52c1cea4b9 100644 --- a/guides/source/active_support_core_extensions.textile +++ b/guides/source/active_support_core_extensions.textile @@ -184,7 +184,7 @@ You can evaluate code in the context of any object's singleton class using +clas class Proc def bind(object) - block, time = self, Time.now + block, time = self, Time.current object.class_eval do method_name = "__bind_#{time.to_i}_#{time.usec}" define_method(method_name, &block) @@ -1780,13 +1780,13 @@ These methods use Time#advance for precise date calculations when using from_now as well as adding or subtracting their results from a Time object. For example: -# equivalent to Time.now.advance(:months => 1) +# equivalent to Time.current.advance(:months => 1) 1.month.from_now -# equivalent to Time.now.advance(:years => 2) +# equivalent to Time.current.advance(:years => 2) 2.years.from_now -# equivalent to Time.now.advance(:months => 4, :years => 5) +# equivalent to Time.current.advance(:months => 4, :years => 5) (4.months + 5.years).from_now -- cgit v1.2.3 From 3a6ffbbe42688f40edc8e0a12d0f556ef3720b9d Mon Sep 17 00:00:00 2001 From: Nick Novitski Date: Wed, 9 May 2012 13:20:19 -0700 Subject: remove inappropriate comma A qualifying clause beginning with words like "as", "if", or "although" should have a comma separating it from any following clauses in a sentence, but should not have a comma immediately after the beginning word, unless it is to separate a third, non-essential clause. Example 1: "Although I would quite like to go to lunch with you, I find myself instead writing a detailed commit message to justify a single-character documentation change." Example 2: "Despite, as you might well imagine, wishing I hadn't even noticed it in the first place, I still felt the error was worth correcting." --- guides/source/security.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/security.textile b/guides/source/security.textile index ac64b82bf6..ac55d60368 100644 --- a/guides/source/security.textile +++ b/guides/source/security.textile @@ -627,7 +627,7 @@ h4. Whitelists versus Blacklists -- _When sanitizing, protecting or verifying something, whitelists over blacklists._ -A blacklist can be a list of bad e-mail addresses, non-public actions or bad HTML tags. This is opposed to a whitelist which lists the good e-mail addresses, public actions, good HTML tags and so on. Although, sometimes it is not possible to create a whitelist (in a SPAM filter, for example), _(highlight)prefer to use whitelist approaches_: +A blacklist can be a list of bad e-mail addresses, non-public actions or bad HTML tags. This is opposed to a whitelist which lists the good e-mail addresses, public actions, good HTML tags and so on. Although sometimes it is not possible to create a whitelist (in a SPAM filter, for example), _(highlight)prefer to use whitelist approaches_: * Use before_filter :only => [...] instead of :except => [...]. This way you don't forget to turn it off for newly added actions. * Use attr_accessible instead of attr_protected. See the mass-assignment section for details -- cgit v1.2.3 From c8f5a216df7d14463027425b53968d7f7023bf85 Mon Sep 17 00:00:00 2001 From: Ben Wilhelm Date: Thu, 10 May 2012 11:15:32 -0700 Subject: Modified template in sample is new.html.erb, not index.html.erb --- guides/source/getting_started.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile index 947abd7ba0..1e9bd1f144 100644 --- a/guides/source/getting_started.textile +++ b/guides/source/getting_started.textile @@ -717,7 +717,7 @@ If you reload try to save a post without a title, Rails will send you back to the form, but that's not very useful. You need to tell the user that something went wrong. To do that, you'll modify -+app/views/posts/index.html.erb+ to check for error messages: ++app/views/posts/new.html.erb+ to check for error messages: <%= form_for :post, :url => { :action => :create } do |f| %> -- cgit v1.2.3 From 1abf15657b47b32dd5ba295bcdb618b41b46c0bc Mon Sep 17 00:00:00 2001 From: Enrico Carlesso Date: Fri, 11 May 2012 11:50:15 +0200 Subject: In robots.txt, User-agent should be all downcase except for the first 'U', according with http://en.wikipedia.org/wiki/Robots_exclusion_standard --- guides/code/getting_started/public/robots.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/code/getting_started/public/robots.txt b/guides/code/getting_started/public/robots.txt index 085187fa58..1a3a5e4dd2 100644 --- a/guides/code/getting_started/public/robots.txt +++ b/guides/code/getting_started/public/robots.txt @@ -1,5 +1,5 @@ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file # # To ban all spiders from the entire site uncomment the next two lines: -# User-Agent: * +# User-agent: * # Disallow: / -- cgit v1.2.3 From c9a4e65217cc0711f264410484d23fb8b519b660 Mon Sep 17 00:00:00 2001 From: Egor Homakov Date: Fri, 11 May 2012 14:48:02 +0400 Subject: Update guides/source/configuring.textile --- guides/source/configuring.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/configuring.textile b/guides/source/configuring.textile index c4e54348d4..bed8ce3eb6 100644 --- a/guides/source/configuring.textile +++ b/guides/source/configuring.textile @@ -448,7 +448,7 @@ There are a few configuration options available in Active Support: * +config.active_support.bare+ enables or disables the loading of +active_support/all+ when booting Rails. Defaults to +nil+, which means +active_support/all+ is loaded. -* +config.active_support.escape_html_entities_in_json+ enables or disables the escaping of HTML entities in JSON serialization. Defaults to +true+. +* +config.active_support.escape_html_entities_in_json+ enables or disables the escaping of HTML entities in JSON serialization. Defaults to +false+. * +config.active_support.use_standard_json_time_format+ enables or disables serializing dates to ISO 8601 format. Defaults to +false+. -- cgit v1.2.3 From d4f4b858d3c493ea74a1e4ed8ed6566bfa4c7e27 Mon Sep 17 00:00:00 2001 From: Egor Homakov Date: Fri, 11 May 2012 15:40:03 +0400 Subject: Update guides/source/configuring.textile --- guides/source/configuring.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/configuring.textile b/guides/source/configuring.textile index bed8ce3eb6..b2c9300034 100644 --- a/guides/source/configuring.textile +++ b/guides/source/configuring.textile @@ -450,7 +450,7 @@ There are a few configuration options available in Active Support: * +config.active_support.escape_html_entities_in_json+ enables or disables the escaping of HTML entities in JSON serialization. Defaults to +false+. -* +config.active_support.use_standard_json_time_format+ enables or disables serializing dates to ISO 8601 format. Defaults to +false+. +* +config.active_support.use_standard_json_time_format+ enables or disables serializing dates to ISO 8601 format. Defaults to +true+. * +ActiveSupport::BufferedLogger.silencer+ is set to +false+ to disable the ability to silence logging in a block. The default is +true+. -- cgit v1.2.3 From 1004ccc84b16a78d9aa3180e57dda278002fe53e Mon Sep 17 00:00:00 2001 From: Eric Carty-Fickes Date: Fri, 11 May 2012 11:12:32 -0500 Subject: Clarify expire_action with namespaced controllers --- guides/source/caching_with_rails.textile | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'guides') diff --git a/guides/source/caching_with_rails.textile b/guides/source/caching_with_rails.textile index e455b504ce..34a100cd3a 100644 --- a/guides/source/caching_with_rails.textile +++ b/guides/source/caching_with_rails.textile @@ -229,6 +229,42 @@ class ProductsController < ActionController end +Sometimes it is necessary to disambiguate the controller when you call +expire_action+, such as when there are two identically named controllers in separate namespaces: + + +class ProductsController < ActionController + caches_action :index + + def index + @products = Product.all + end +end + +module Admin + class ProductsController < ActionController + cache_sweeper :product_sweeper + + def new + @product = Product.new + end + + def create + @product = Product.create(params[:product]) + end + end +end + +class ProductSweeper < ActionController::Caching::Sweeper + observe Product + + def after_create(product) + expire_action(:controller => '/products', :action => 'index') + end +end + + +Note the use of '/products' here rather than 'products'. If you wanted to expire an action cache for the +Admin::ProductsController+, you would use 'admin/products' instead. + h4. SQL Caching Query caching is a Rails feature that caches the result set returned by each query so that if Rails encounters the same query again for that request, it will use the cached result set as opposed to running the query against the database again. -- cgit v1.2.3 From a0d9b7903588cd988c8c9b4164494c792344f43e Mon Sep 17 00:00:00 2001 From: Scott Johnson <7.scott.j@gmail.com> Date: Fri, 11 May 2012 13:42:37 -0500 Subject: update engines guide to show how to have an engine's ApplicationController inherit from the main application's ApplicationController --- guides/source/engines.textile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'guides') diff --git a/guides/source/engines.textile b/guides/source/engines.textile index 71bcf6b713..b94ede44c4 100644 --- a/guides/source/engines.textile +++ b/guides/source/engines.textile @@ -448,6 +448,8 @@ rake db:migrate SCOPE=blorgh VERSION=0 h4. Using a class provided by the application +h5. Using a model provided by the application + When an engine is created, it may want to use specific classes from an application to provide links between the pieces of the engine and the pieces of the application. In the case of the +blorgh+ engine, making posts and comments have authors would make a lot of sense. Usually, an application would have a +User+ class that would provide the objects that would represent the posts' and comments' authors, but there could be a case where the application calls this class something different, such as +Person+. It's because of this reason that the engine should not hardcode the associations to be exactly for a +User+ class, but should allow for some flexibility around what the class is called. @@ -544,6 +546,19 @@ end Now instead of the ugly Ruby object output the author's name will be displayed. +h5. Using a controller provided by the application + +Because Rails controllers generally share code for for things like authentication and accessing session variables, by default they inherit from ApplicationController. Rails engines, however are scoped to run independently from the main application, so each engine gets a scoped ApplicationController. This namespace prevents code collisions, but often engine controllers should access methods in the main application's ApplicationController. An easy way to provide this acess is to change the engine's scoped ApplicationController to inherit from the main application's ApplicationController. For our Blorgh engine this would be done by changing +app/controllers/blorgh/application_controller.rb+ to look like: + + + class Blorgh::ApplicationController < ApplicationController + end + + +By default, the engine's controllers inherit from Blorgh::ApplicationController. So, after making this change they will have access to the main applications ApplicationController as though they were part of the main application. + +This change does require that the engine is run from a Rails application that has an ApplicationController. + h4. Configuring an engine This section covers firstly how you can make the +user_class+ setting of the Blorgh engine configurable, followed by general configuration tips for the engine. -- cgit v1.2.3 From 38b4e7c8b1c4c46985b6e598d6df2df97457308a Mon Sep 17 00:00:00 2001 From: Geoffrey Roguelon Date: Sat, 12 May 2012 10:36:35 +0200 Subject: Add commas missing in performance tests --- guides/code/getting_started/test/performance/browsing_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/code/getting_started/test/performance/browsing_test.rb b/guides/code/getting_started/test/performance/browsing_test.rb index 3fea27b916..2a849b7f2b 100644 --- a/guides/code/getting_started/test/performance/browsing_test.rb +++ b/guides/code/getting_started/test/performance/browsing_test.rb @@ -3,7 +3,7 @@ require 'rails/performance_test_help' class BrowsingTest < ActionDispatch::PerformanceTest # Refer to the documentation for all available options - # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory] + # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory], # :output => 'tmp/performance', :formats => [:flat] } def test_homepage -- cgit v1.2.3 From d897255f8a25c72aa72f14d2f82cb87058447fac Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sat, 12 May 2012 18:07:10 +0530 Subject: copy editing [ci skip] --- guides/source/engines.textile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'guides') diff --git a/guides/source/engines.textile b/guides/source/engines.textile index b94ede44c4..880be57fb5 100644 --- a/guides/source/engines.textile +++ b/guides/source/engines.textile @@ -548,16 +548,16 @@ Now instead of the ugly Ruby object output the author's name will be displayed. h5. Using a controller provided by the application -Because Rails controllers generally share code for for things like authentication and accessing session variables, by default they inherit from ApplicationController. Rails engines, however are scoped to run independently from the main application, so each engine gets a scoped ApplicationController. This namespace prevents code collisions, but often engine controllers should access methods in the main application's ApplicationController. An easy way to provide this acess is to change the engine's scoped ApplicationController to inherit from the main application's ApplicationController. For our Blorgh engine this would be done by changing +app/controllers/blorgh/application_controller.rb+ to look like: +Because Rails controllers generally share code for things like authentication and accessing session variables, by default they inherit from ApplicationController. Rails engines, however are scoped to run independently from the main application, so each engine gets a scoped +ApplicationController+. This namespace prevents code collisions, but often engine controllers should access methods in the main application's +ApplicationController+. An easy way to provide this access is to change the engine's scoped +ApplicationController+ to inherit from the main application's +ApplicationController+. For our Blorgh engine this would be done by changing +app/controllers/blorgh/application_controller.rb+ to look like: - class Blorgh::ApplicationController < ApplicationController - end +class Blorgh::ApplicationController < ApplicationController +end -By default, the engine's controllers inherit from Blorgh::ApplicationController. So, after making this change they will have access to the main applications ApplicationController as though they were part of the main application. +By default, the engine's controllers inherit from Blorgh::ApplicationController. So, after making this change they will have access to the main applications +ApplicationController+ as though they were part of the main application. -This change does require that the engine is run from a Rails application that has an ApplicationController. +This change does require that the engine is run from a Rails application that has an +ApplicationController+. h4. Configuring an engine -- cgit v1.2.3 From 26e2c082595ecca360954cfc20ecc52221748f7b Mon Sep 17 00:00:00 2001 From: Richard Hulse Date: Sun, 13 May 2012 14:16:50 +1200 Subject: [guides] add local precompilation section --- guides/source/asset_pipeline.textile | 37 +++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/asset_pipeline.textile b/guides/source/asset_pipeline.textile index 010154f1d1..59f106acb2 100644 --- a/guides/source/asset_pipeline.textile +++ b/guides/source/asset_pipeline.textile @@ -396,7 +396,7 @@ Rails comes bundled with a rake task to compile the asset manifests and other fi Compiled assets are written to the location specified in +config.assets.prefix+. By default, this is the +public/assets+ directory. -You can call this task on the server during deployment to create compiled versions of your assets directly on the server. If you do not have write access to your production file system, you can call this task locally and then deploy the compiled assets. +You can call this task on the server during deployment to create compiled versions of your assets directly on the server. See the next section for information on compiling locally. The rake task is: @@ -516,6 +516,41 @@ If you're compiling nginx with Phusion Passenger you'll need to pass that option A robust configuration for Apache is possible but tricky; please Google around. (Or help update this Guide if you have a good example configuration for Apache.) +h4. Local Precompilation + +There are several reasons why you might 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. +* You may be doing frequent deploys that do not include asset changes. + +Local compilation allows you to commit the compiled files into source control, and deploy as normal. + +There are two caveats: + +* You must not run the Capistrano deployment task. +* You must change the following two application configuration settings. + +In development.rb place the following line: + + +config.assets.prefix = "/dev-assets" + + +You will also need this in application.rb: + + +config.assets.initialize_on_precompile = false + + +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 +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. + +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. + h4. Live Compilation In some circumstances you may wish to use live compilation. In this mode all requests for assets in the pipeline are handled by Sprockets directly. -- cgit v1.2.3 From e6e6f4ef8675ea001801362b42cdabb13801da67 Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Mon, 14 May 2012 06:52:50 +1000 Subject: Briefly explain static file routing in the getting started guide --- guides/source/getting_started.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile index 1e9bd1f144..bdd385918f 100644 --- a/guides/source/getting_started.textile +++ b/guides/source/getting_started.textile @@ -193,7 +193,7 @@ Now that we have made the controller and view, we need to tell Rails when we wan To fix this, delete the +index.html+ file located inside the +public+ directory of the application. -You need to do this because Rails will serve any static file in the +public+ directory that matches a route in preference to any dynamic content you generate from the controllers. +You need to do this because Rails will serve any static file in the +public+ directory that matches a route in preference to any dynamic content you generate from the controllers. The +index.html+ file is special: it will be served if a request comes in at the root route, e.g. http://localhost:3000. If another request such as http://localhost:3000/welcome happened, a static file at public/welcome.html would be served first, but only if it existed. Next, you have to tell Rails where your actual home page is located. -- cgit v1.2.3 From 9e4fd33ae8860388cff54af44ee07f19a09ba9f6 Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Mon, 14 May 2012 06:54:40 +1000 Subject: Re-enforce/re-explain what happens when you go to root route (Welcome#index) better --- guides/source/getting_started.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile index bdd385918f..a689cf1c3b 100644 --- a/guides/source/getting_started.textile +++ b/guides/source/getting_started.textile @@ -210,7 +210,7 @@ Blog::Application.routes.draw do The +root :to => "welcome#index"+ tells Rails to map requests to the root of the application to the welcome controller's index action. This was created earlier when you ran the controller generator (+rails generate controller welcome index+). -If you navigate to "http://localhost:3000":http://localhost:3000 in your browser, you'll see +Hello, Rails!+. +If you navigate to "http://localhost:3000":http://localhost:3000 in your browser, you'll see the +Hello, Rails!+ message you put into +app/views/welcome/index.html.erb+, indicating that this new route is indeed going to +WelcomeController+'s +index+ action and is rendering the view correctly. NOTE. For more information about routing, refer to "Rails Routing from the Outside In":routing.html. -- cgit v1.2.3 From 96fb77fe8000569ccc6b5bfd91668719bf92fa3d Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Mon, 14 May 2012 06:55:45 +1000 Subject: Separate CR out in CRUD explanation, explain each letter one at a time --- guides/source/getting_started.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile index a689cf1c3b..540084eb15 100644 --- a/guides/source/getting_started.textile +++ b/guides/source/getting_started.textile @@ -220,7 +220,7 @@ Now that you've seen how to create a controller, an action and a view, let's cre In the Blog application, you will now create a new _resource_. A resource is the term used for a collection of similar objects, such as posts, people or animals. You can create, read, update and destroy items for a resource and these operations are referred to as _CRUD_ operations. -In the next section, you will add the ability to create new posts in your application and be able to view them. This is the "CR" from CRUD. The form for doing this will look like this: +In the next section, you will add the ability to create new posts in your application and be able to view them. This is the "C" and the "R" from CRUD: creation and reading. The form for doing this will look like this: !images/getting_started/new_post.png(The new post form)! -- cgit v1.2.3 From dbd131fc0e9394438eb0e76796c89160a924b7ef Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Mon, 14 May 2012 06:56:43 +1000 Subject: Rails actually has one root route defined --- guides/source/getting_started.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile index 540084eb15..3a5868b13e 100644 --- a/guides/source/getting_started.textile +++ b/guides/source/getting_started.textile @@ -232,7 +232,7 @@ The first thing that you are going to need to create a new post within the appli !images/getting_started/routing_error_no_route_matches.png(A routing error, no route matches /posts/new)! -This is because there is nowhere inside the routes for the application -- defined inside +config/routes.rb+ -- that defines this route. By default, Rails has no routes configured at all, and so you must define your routes as you need them. +This is because there is nowhere inside the routes for the application -- defined inside +config/routes.rb+ -- that defines this route. By default, Rails has no routes configured at all, besides the root route you defined earlier, and so you must define your routes as you need them. To do this, you're going to need to create a route inside +config/routes.rb+ file, on a new line between the +do+ and the +end+ for the +draw+ method: -- cgit v1.2.3 From 5f7caff82572daa2adc9a83f280b58572b3ba3e2 Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Mon, 14 May 2012 07:02:58 +1000 Subject: Wrap 'Missing template posts/new' error message in a blockquote for better formatting --- guides/source/getting_started.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'guides') diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile index 3a5868b13e..6a07f87abd 100644 --- a/guides/source/getting_started.textile +++ b/guides/source/getting_started.textile @@ -282,9 +282,9 @@ You're getting this error now because Rails expects plain actions like this one In the above image, the bottom line has been truncated. Let's see what the full thing looks like: - +
Missing template posts/new, application/new with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}. Searched in: * "/path/to/blog/app/views" - +
That's quite a lot of text! Let's quickly go through and understand what each part of it does. -- cgit v1.2.3 From d4801d0229515aae37d8f7a2f72c83990d2d977b Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Mon, 14 May 2012 07:06:41 +1000 Subject: Correct code wrapping around content of welcome/index.html.erb --- guides/source/getting_started.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'guides') diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile index 6a07f87abd..84c438e607 100644 --- a/guides/source/getting_started.textile +++ b/guides/source/getting_started.textile @@ -183,9 +183,9 @@ Rails will create several files for you. Most important of these are of course t Open the +app/views/welcome/index.html.erb+ file in your text editor and edit it to contain a single line of code: - +

Hello, Rails!

-
+ h4. Setting the Application Home Page -- cgit v1.2.3 From 8ef67de03409d0d21e42605e063e501d3ee764cf Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Mon, 14 May 2012 15:17:59 +0530 Subject: fix format in getting started guide [ci skip] --- guides/source/getting_started.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile index 84c438e607..e89602218e 100644 --- a/guides/source/getting_started.textile +++ b/guides/source/getting_started.textile @@ -193,7 +193,7 @@ Now that we have made the controller and view, we need to tell Rails when we wan To fix this, delete the +index.html+ file located inside the +public+ directory of the application. -You need to do this because Rails will serve any static file in the +public+ directory that matches a route in preference to any dynamic content you generate from the controllers. The +index.html+ file is special: it will be served if a request comes in at the root route, e.g. http://localhost:3000. If another request such as http://localhost:3000/welcome happened, a static file at public/welcome.html would be served first, but only if it existed. +You need to do this because Rails will serve any static file in the +public+ directory that matches a route in preference to any dynamic content you generate from the controllers. The +index.html+ file is special: it will be served if a request comes in at the root route, e.g. http://localhost:3000. If another request such as http://localhost:3000/welcome happened, a static file at public/welcome.html would be served first, but only if it existed. Next, you have to tell Rails where your actual home page is located. -- cgit v1.2.3 From ee4e48eab06659b3fea64c70590e8d260a230445 Mon Sep 17 00:00:00 2001 From: Ayrton De Craene Date: Mon, 14 May 2012 13:24:32 +0200 Subject: Improved the readability of some sentences [ci skip] --- guides/source/i18n.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/i18n.textile b/guides/source/i18n.textile index 6179694c40..a9da843d04 100644 --- a/guides/source/i18n.textile +++ b/guides/source/i18n.textile @@ -127,7 +127,7 @@ If you want to translate your Rails application to a *single language other than However, you would probably like to *provide support for more locales* in your application. In such case, you need to set and pass the locale between requests. -WARNING: You may be tempted to store the chosen locale in a _session_ or a cookie. *Do not do so*. The locale should be transparent and a part of the URL. This way you don't break people's basic assumptions about the web itself: if you send a URL of some page to a friend, she should see the same page, same content. A fancy word for this would be that you're being "RESTful":http://en.wikipedia.org/wiki/Representational_State_Transfer. Read more about the RESTful approach in "Stefan Tilkov's articles":http://www.infoq.com/articles/rest-introduction. There may be some exceptions to this rule, which are discussed below. +WARNING: You may be tempted to store the chosen locale in a _session_ or a cookie, however *do not do this*. The locale should be transparent and a part of the URL. This way you won't break people's basic assumptions about the web itself: if you send a URL to a friend, they should see the same page and content as you. A fancy word for this would be that you're being "RESTful":http://en.wikipedia.org/wiki/Representational_State_Transfer. Read more about the RESTful approach in "Stefan Tilkov's articles":http://www.infoq.com/articles/rest-introduction. Sometimes there are exceptions to this rule and those are discussed below. The _setting part_ is easy. You can set the locale in a +before_filter+ in the +ApplicationController+ like this: -- cgit v1.2.3 From 888383e0accf376109f29020c7f8cfbaa39338b9 Mon Sep 17 00:00:00 2001 From: Ayrton De Craene Date: Mon, 14 May 2012 14:04:24 +0200 Subject: 'Netherlands locale' does not make any sense, it's Dutch locale [ci skip] --- guides/source/i18n.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'guides') diff --git a/guides/source/i18n.textile b/guides/source/i18n.textile index a9da843d04..ee7176a6c8 100644 --- a/guides/source/i18n.textile +++ b/guides/source/i18n.textile @@ -220,7 +220,7 @@ Every helper method dependent on +url_for+ (e.g. helpers for named routes like + You may be satisfied with this. It does impact the readability of URLs, though, when the locale "hangs" at the end of every URL in your application. Moreover, from the architectural standpoint, locale is usually hierarchically above the other parts of the application domain: and URLs should reflect this. -You probably want URLs to look like this: +www.example.com/en/books+ (which loads the English locale) and +www.example.com/nl/books+ (which loads the Netherlands locale). This is achievable with the "over-riding +default_url_options+" strategy from above: you just have to set up your routes with "+path_prefix+":http://api.rubyonrails.org/classes/ActionController/Resources.html#M000354 option in this way: +You probably want URLs to look like this: +www.example.com/en/books+ (which loads the English locale) and +www.example.com/nl/books+ (which loads the Dutch locale). This is achievable with the "over-riding +default_url_options+" strategy from above: you just have to set up your routes with "+path_prefix+":http://api.rubyonrails.org/classes/ActionController/Resources.html#M000354 option in this way: # config/routes.rb @@ -229,7 +229,7 @@ scope "/:locale" do end -Now, when you call the +books_path+ method you should get +"/en/books"+ (for the default locale). An URL like +http://localhost:3001/nl/books+ should load the Netherlands locale, then, and following calls to +books_path+ should return +"/nl/books"+ (because the locale changed). +Now, when you call the +books_path+ method you should get +"/en/books"+ (for the default locale). An URL like +http://localhost:3001/nl/books+ should load the Dutch locale, then, and following calls to +books_path+ should return +"/nl/books"+ (because the locale changed). If you don't want to force the use of a locale in your routes you can use an optional path scope (denoted by the parentheses) like so: -- cgit v1.2.3 From 151aa9abae131f1a03513f756aeaef2fc403f9bb Mon Sep 17 00:00:00 2001 From: Vasiliy Ermolovich Date: Mon, 14 May 2012 21:49:42 +0300 Subject: remove docs on Range#step --- guides/source/active_support_core_extensions.textile | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'guides') diff --git a/guides/source/active_support_core_extensions.textile b/guides/source/active_support_core_extensions.textile index 8045316e98..bf30ed64c8 100644 --- a/guides/source/active_support_core_extensions.textile +++ b/guides/source/active_support_core_extensions.textile @@ -2767,18 +2767,6 @@ As the example depicts, the +:db+ format generates a +BETWEEN+ SQL clause. That NOTE: Defined in +active_support/core_ext/range/conversions.rb+. -h4. +step+ - -Active Support extends the method +Range#step+ so that it can be invoked without a block: - - -(1..10).step(2) # => [1, 3, 5, 7, 9] - - -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+. - h4. +include?+ The methods +Range#include?+ and +Range#===+ say whether some value falls between the ends of a given instance: -- cgit v1.2.3