mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix indentation [ci skip]
This commit is contained in:
parent
2fb658d1e3
commit
566a056115
5 changed files with 11 additions and 11 deletions
|
@ -295,7 +295,7 @@ Action Pack
|
||||||
```ruby
|
```ruby
|
||||||
@items.each do |item|
|
@items.each do |item|
|
||||||
content_tag_for(:li, item) do
|
content_tag_for(:li, item) do
|
||||||
Title: <%= item.title %>
|
Title: <%= item.title %>
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
|
@ -379,7 +379,7 @@ class GuestsCleanupJob < ApplicationJob
|
||||||
queue_as :default
|
queue_as :default
|
||||||
|
|
||||||
rescue_from(ActiveRecord::RecordNotFound) do |exception|
|
rescue_from(ActiveRecord::RecordNotFound) do |exception|
|
||||||
# Do something with the exception
|
# Do something with the exception
|
||||||
end
|
end
|
||||||
|
|
||||||
def perform
|
def perform
|
||||||
|
|
|
@ -1989,7 +1989,7 @@ Extensions to `BigDecimal`
|
||||||
The method `to_s` provides a default specifier of "F". This means that a simple call to `to_s` will result in floating point representation instead of engineering notation:
|
The method `to_s` provides a default specifier of "F". This means that a simple call to `to_s` will result in floating point representation instead of engineering notation:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
BigDecimal.new(5.00, 6).to_s # => "5.0"
|
BigDecimal.new(5.00, 6).to_s # => "5.0"
|
||||||
```
|
```
|
||||||
|
|
||||||
and that symbol specifiers are also supported:
|
and that symbol specifiers are also supported:
|
||||||
|
@ -3641,7 +3641,7 @@ Durations can be added to and subtracted from time objects:
|
||||||
now = Time.current
|
now = Time.current
|
||||||
# => Mon, 09 Aug 2010 23:20:05 UTC +00:00
|
# => Mon, 09 Aug 2010 23:20:05 UTC +00:00
|
||||||
now + 1.year
|
now + 1.year
|
||||||
# => Tue, 09 Aug 2011 23:21:11 UTC +00:00
|
# => Tue, 09 Aug 2011 23:21:11 UTC +00:00
|
||||||
now - 1.week
|
now - 1.week
|
||||||
# => Mon, 02 Aug 2010 23:21:11 UTC +00:00
|
# => Mon, 02 Aug 2010 23:21:11 UTC +00:00
|
||||||
```
|
```
|
||||||
|
|
|
@ -663,11 +663,11 @@ By default, associations look for objects only within the current module's scope
|
||||||
module MyApplication
|
module MyApplication
|
||||||
module Business
|
module Business
|
||||||
class Supplier < ApplicationRecord
|
class Supplier < ApplicationRecord
|
||||||
has_one :account
|
has_one :account
|
||||||
end
|
end
|
||||||
|
|
||||||
class Account < ApplicationRecord
|
class Account < ApplicationRecord
|
||||||
belongs_to :supplier
|
belongs_to :supplier
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -679,13 +679,13 @@ This will work fine, because both the `Supplier` and the `Account` class are def
|
||||||
module MyApplication
|
module MyApplication
|
||||||
module Business
|
module Business
|
||||||
class Supplier < ApplicationRecord
|
class Supplier < ApplicationRecord
|
||||||
has_one :account
|
has_one :account
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module Billing
|
module Billing
|
||||||
class Account < ApplicationRecord
|
class Account < ApplicationRecord
|
||||||
belongs_to :supplier
|
belongs_to :supplier
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -697,14 +697,14 @@ To associate a model with a model in a different namespace, you must specify the
|
||||||
module MyApplication
|
module MyApplication
|
||||||
module Business
|
module Business
|
||||||
class Supplier < ApplicationRecord
|
class Supplier < ApplicationRecord
|
||||||
has_one :account,
|
has_one :account,
|
||||||
class_name: "MyApplication::Billing::Account"
|
class_name: "MyApplication::Billing::Account"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module Billing
|
module Billing
|
||||||
class Account < ApplicationRecord
|
class Account < ApplicationRecord
|
||||||
belongs_to :supplier,
|
belongs_to :supplier,
|
||||||
class_name: "MyApplication::Business::Supplier"
|
class_name: "MyApplication::Business::Supplier"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -928,7 +928,7 @@ each of the seven default actions, you can use the following command:
|
||||||
$ bin/rails generate test_unit:scaffold article
|
$ bin/rails generate test_unit:scaffold article
|
||||||
...
|
...
|
||||||
invoke test_unit
|
invoke test_unit
|
||||||
create test/controllers/articles_controller_test.rb
|
create test/controllers/articles_controller_test.rb
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue