File tree Expand file tree Collapse file tree 3 files changed +12
-8
lines changed
Expand file tree Collapse file tree 3 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -13,11 +13,15 @@ def initialize(name, id)
1313 List . new ( 'ruby-talk' , 4 ) ,
1414 ]
1515
16- def self . find_by_name ( name )
17- LISTS . find { |list | list . name == name }
18- end
16+ class << self
17+ def find_by_name ( name )
18+ List ::LISTS . find { |list | list . name == name }
19+ end
20+
21+ def find_by_id ( id )
22+ List ::LISTS . find { |list | list . id == id }
23+ end
1924
20- def self . find_by_id ( id )
21- LISTS . find { |list | list . id == id }
25+ alias find find_by_id
2226 end
2327end
Original file line number Diff line number Diff line change @@ -127,15 +127,15 @@ def from_string(str)
127127 end
128128
129129 def list
130- @list ||= List . find_by_id ( list_id )
130+ @list ||= List . find ( list_id )
131131 end
132132
133133 def count_recursively ( count = 0 )
134134 count + 1 + ( children &.sum ( &:count_recursively ) || 0 )
135135 end
136136
137137 def reload_from_s3 ( s3_client = Aws ::S3 ::Client . new ( region : BLADE_BUCKET_REGION ) )
138- m = Message . from_s3 ( List . find_by_id ( self . list_id ) . name , self . list_seq , s3_client )
138+ m = Message . from_s3 ( List . find ( self . list_id ) . name , self . list_seq , s3_client )
139139
140140 self . body = m . body
141141 self . subject = m . subject
Original file line number Diff line number Diff line change 2727
2828<% @messages . each do |message | %>
2929 < div class ="search-result ">
30- <% list_name = List . find_by_id ( message . list_id ) . name %>
30+ <% list_name = List . find ( message . list_id ) . name %>
3131 < h2 class ="subject ">
3232 < span class ="prefix "> <%= list_name %> :<%= message . list_seq %> </ span >
3333 <%= link_to without_list_prefix ( message . subject ) , "/#{ list_name } /#{ message . list_seq } " %>
You can’t perform that action at this time.
0 commit comments