@@ -1763,12 +1763,12 @@ class Article < ApplicationRecord
1763
1763
validates :title , presence: true
1764
1764
validates :body , presence: true , length: { minimum: 10 }
1765
1765
1766
- VALID_STATUSES = [' public' , ' private' , ' archived' ]
1766
+ VALID_STATUSES = [ " public" , " private" , " archived" ]
1767
1767
1768
1768
validates :status , inclusion: { in: VALID_STATUSES }
1769
1769
1770
1770
def archived?
1771
- status == ' archived'
1771
+ status == " archived"
1772
1772
end
1773
1773
end
1774
1774
```
@@ -1779,12 +1779,12 @@ and in the `Comment` model:
1779
1779
class Comment < ApplicationRecord
1780
1780
belongs_to :article
1781
1781
1782
- VALID_STATUSES = [' public' , ' private' , ' archived' ]
1782
+ VALID_STATUSES = [ " public" , " private" , " archived" ]
1783
1783
1784
1784
validates :status , inclusion: { in: VALID_STATUSES }
1785
1785
1786
1786
def archived?
1787
- status == ' archived'
1787
+ status == " archived"
1788
1788
end
1789
1789
end
1790
1790
```
@@ -1832,7 +1832,7 @@ A concern is only responsible for a focused subset of the model's responsibility
1832
1832
``` ruby
1833
1833
module Visible
1834
1834
def archived?
1835
- status == ' archived'
1835
+ status == " archived"
1836
1836
end
1837
1837
end
1838
1838
```
@@ -1843,14 +1843,14 @@ We can add our status validation to the concern, but this is slightly more compl
1843
1843
module Visible
1844
1844
extend ActiveSupport ::Concern
1845
1845
1846
- VALID_STATUSES = [' public' , ' private' , ' archived' ]
1846
+ VALID_STATUSES = [ " public" , " private" , " archived" ]
1847
1847
1848
1848
included do
1849
1849
validates :status , inclusion: { in: VALID_STATUSES }
1850
1850
end
1851
1851
1852
1852
def archived?
1853
- status == ' archived'
1853
+ status == " archived"
1854
1854
end
1855
1855
end
1856
1856
```
@@ -1887,20 +1887,20 @@ Class methods can also be added to concerns. If we want to display a count of pu
1887
1887
module Visible
1888
1888
extend ActiveSupport ::Concern
1889
1889
1890
- VALID_STATUSES = [' public' , ' private' , ' archived' ]
1890
+ VALID_STATUSES = [ " public" , " private" , " archived" ]
1891
1891
1892
1892
included do
1893
1893
validates :status , inclusion: { in: VALID_STATUSES }
1894
1894
end
1895
1895
1896
1896
class_methods do
1897
1897
def public_count
1898
- where(status: ' public' ).count
1898
+ where(status: " public" ).count
1899
1899
end
1900
1900
end
1901
1901
1902
1902
def archived?
1903
- status == ' archived'
1903
+ status == " archived"
1904
1904
end
1905
1905
end
1906
1906
```
0 commit comments