Class: Search
- Inherits:
-
Object
show all
- Defined in:
- app/models/search.rb
Overview
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.attr_accessors ⇒ Object
21
22
23
|
# File 'app/models/search.rb', line 21
def attr_accessors
@attr_accessors
end
|
.attr_accessors=(more_accessors) ⇒ Object
extend with += [ :something ] NOT << :something
24
25
26
27
|
# File 'app/models/search.rb', line 24
def attr_accessors=(more_accessors) @attr_accessors = more_accessors
attr_accessor *@attr_accessors
end
|
.searchable_attributes ⇒ Object
15
16
17
|
# File 'app/models/search.rb', line 15
def searchable_attributes
@searchable_attributes
end
|
.searchable_attributes=(more_attributes) ⇒ Object
18
19
20
|
# File 'app/models/search.rb', line 18
def searchable_attributes=(more_attributes)
@searchable_attributes = more_attributes
end
|
.valid_orders ⇒ Object
9
10
11
|
# File 'app/models/search.rb', line 9
def valid_orders
@valid_orders
end
|
.valid_orders=(more_orders) ⇒ Object
12
13
14
|
# File 'app/models/search.rb', line 12
def valid_orders=(more_orders)
@valid_orders = more_orders
end
|
Instance Method Details
#attr_accessors ⇒ Object
41
42
43
|
# File 'app/models/search.rb', line 41
def attr_accessors
self.class.attr_accessors
end
|
#search_order ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'app/models/search.rb', line 45
def search_order
if valid_orders.has_key?(@order)
order_string = if valid_orders[@order].blank?
@order
else
valid_orders[@order]
end
dir = case @dir.try(:downcase)
when 'desc' then 'desc'
else 'asc'
end
[order_string,dir].join(' ')
else
nil
end
end
|
#searchable_attributes ⇒ Object
37
38
39
|
# File 'app/models/search.rb', line 37
def searchable_attributes
self.class.searchable_attributes
end
|
#valid_orders ⇒ Object
33
34
35
|
# File 'app/models/search.rb', line 33
def valid_orders
self.class.valid_orders
end
|