提交 04d308a0 编写于 作者: V Vijay Dev

Merge branch 'master' of github.com:lifo/docrails

......@@ -1053,6 +1053,13 @@ def resource(*resources, &block)
#
# 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 @@ def radio_button_tag(name, value, checked = false, options = {})
# 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 @@ def submit_tag(value = "Save changes", options = {})
# 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 @@ def rename_column(table_name, column_name, new_column_name)
# 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 @@ def reset_counters(id, *counters)
# 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 @@ def destroy_all(conditions = nil)
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.
#
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册