mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge branch 'master' of github.com:lifo/docrails
This commit is contained in:
commit
04d308a03b
5 changed files with 17 additions and 22 deletions
|
@ -1053,6 +1053,13 @@ module ActionDispatch
|
|||
#
|
||||
# The above example will now change /posts/new to /posts/brand_new
|
||||
#
|
||||
# [:path]
|
||||
# Allows you to change the path prefix for the resource.
|
||||
#
|
||||
# resources :posts, :path => 'postings'
|
||||
#
|
||||
# The resource and all segments will now route to /postings instead of /posts
|
||||
#
|
||||
# [:only]
|
||||
# Only generate routes for the given actions.
|
||||
#
|
||||
|
|
|
@ -393,21 +393,17 @@ module ActionView
|
|||
# submit_tag "Save edits", :disabled => true
|
||||
# # => <input disabled="disabled" name="commit" type="submit" value="Save edits" />
|
||||
#
|
||||
#
|
||||
# submit_tag "Complete sale", :disable_with => "Please wait..."
|
||||
# # => <input name="commit" data-disable-with="Please wait..."
|
||||
# # type="submit" value="Complete sale" />
|
||||
# # => <input name="commit" data-disable-with="Please wait..." type="submit" value="Complete sale" />
|
||||
#
|
||||
# submit_tag nil, :class => "form_submit"
|
||||
# # => <input class="form_submit" name="commit" type="submit" />
|
||||
#
|
||||
# submit_tag "Edit", :disable_with => "Editing...", :class => "edit_button"
|
||||
# # => <input class="edit_button" data-disable_with="Editing..."
|
||||
# # name="commit" type="submit" value="Edit" />
|
||||
# # => <input class="edit_button" data-disable_with="Editing..." name="commit" type="submit" value="Edit" />
|
||||
#
|
||||
# submit_tag "Save", :confirm => "Are you sure?"
|
||||
# # => <input name='commit' type='submit' value='Save'
|
||||
# data-confirm="Are you sure?" />
|
||||
# # => <input name='commit' type='submit' value='Save' data-confirm="Are you sure?" />
|
||||
#
|
||||
def submit_tag(value = "Save changes", options = {})
|
||||
options = options.stringify_keys
|
||||
|
@ -451,12 +447,11 @@ module ActionView
|
|||
# content_tag(:strong, 'Ask me!')
|
||||
# end
|
||||
# # => <button name="button" type="button">
|
||||
# <strong>Ask me!</strong>
|
||||
# </button>
|
||||
# # <strong>Ask me!</strong>
|
||||
# # </button>
|
||||
#
|
||||
# button_tag "Checkout", :disable_with => "Please wait..."
|
||||
# # => <button data-disable-with="Please wait..." name="button"
|
||||
# type="submit">Checkout</button>
|
||||
# # => <button data-disable-with="Please wait..." name="button" type="submit">Checkout</button>
|
||||
#
|
||||
def button_tag(content_or_options = nil, options = nil, &block)
|
||||
options = content_or_options if block_given? && content_or_options.is_a?(Hash)
|
||||
|
|
|
@ -301,15 +301,8 @@ module ActiveRecord
|
|||
# Adds a new index to the table. +column_name+ can be a single Symbol, or
|
||||
# an Array of Symbols.
|
||||
#
|
||||
# The index will be named after the table and the first column name,
|
||||
# unless you pass <tt>:name</tt> as an option.
|
||||
#
|
||||
# When creating an index on multiple columns, the first column is used as a name
|
||||
# for the index. For example, when you specify an index on two columns
|
||||
# [<tt>:first</tt>, <tt>:last</tt>], the DBMS creates an index for both columns as well as an
|
||||
# index for the first column <tt>:first</tt>. Using just the first name for this index
|
||||
# makes sense, because you will never have to create a singular index with this
|
||||
# name.
|
||||
# The index will be named after the table and the column name(s), unless
|
||||
# you pass <tt>:name</tt> as an option.
|
||||
#
|
||||
# ===== Examples
|
||||
#
|
||||
|
|
|
@ -65,7 +65,7 @@ module ActiveRecord
|
|||
# Post.update_counters [10, 15], :comment_count => 1
|
||||
# # Executes the following SQL:
|
||||
# # UPDATE posts
|
||||
# # SET comment_count = COALESCE(comment_count, 0) + 1,
|
||||
# # SET comment_count = COALESCE(comment_count, 0) + 1
|
||||
# # WHERE id IN (10, 15)
|
||||
def update_counters(id, counters)
|
||||
updates = counters.map do |counter_name, value|
|
||||
|
|
|
@ -356,7 +356,7 @@ module ActiveRecord
|
|||
end
|
||||
end
|
||||
|
||||
# Destroy an object (or multiple objects) that has the given id, the object is instantiated first,
|
||||
# Destroy an object (or multiple objects) that has the given id. The object is instantiated first,
|
||||
# therefore all callbacks and filters are fired off before the object is deleted. This method is
|
||||
# less efficient than ActiveRecord#delete but allows cleanup methods and other actions to be run.
|
||||
#
|
||||
|
|
Loading…
Reference in a new issue