@@ -21,41 +21,41 @@ class ServiceRequest < ActiveRecord::Base
21
21
mount_uploader :media , ImageUploader
22
22
acts_as_voteable
23
23
24
- default_scope order : 'created_at DESC'
24
+ default_scope { order ( 'created_at DESC' ) }
25
25
26
- scope :on_start_date , lambda { | from |
26
+ scope :on_start_date , -> ( from ) {
27
27
where ( "service_requests.created_at >= ?" , from ) unless from . blank?
28
28
}
29
29
30
- scope :on_finish_date , lambda { | to |
30
+ scope :on_finish_date , -> ( to ) {
31
31
where ( "service_requests.created_at <= ?" , to ) unless to . blank?
32
32
}
33
33
34
- scope :with_status , lambda { | status_id |
34
+ scope :with_status , -> ( status_id ) {
35
35
where ( status_id : status_id ) unless status_id . blank?
36
36
}
37
37
38
- scope :on_status_name , lambda { | status_name |
38
+ scope :on_status_name , -> ( status_name ) {
39
39
joins ( :status ) . where ( 'statuses.name = ?' , status_name ) unless status_name . blank?
40
40
}
41
41
42
- scope :on_service , lambda { | service_ids |
42
+ scope :on_service , -> ( service_ids ) {
43
43
where ( service_id : service_ids . split ( ',' ) ) unless service_ids . blank?
44
44
}
45
45
46
- scope :find_by_ids , lambda { | ids |
46
+ scope :find_by_ids , -> ( ids ) {
47
47
where ( "service_requests.id IN (?)" , ids . split ( ',' ) ) unless ids . blank?
48
48
}
49
49
50
- scope :closed , lambda {
50
+ scope :closed , -> {
51
51
where ( status_id : 4 )
52
52
}
53
53
54
- scope :not_closed , lambda {
54
+ scope :not_closed , -> {
55
55
where ( 'status_id != ?' , 4 )
56
56
}
57
57
58
- scope :open , lambda {
58
+ scope :open , -> {
59
59
where ( status : 1 )
60
60
}
61
61
0 commit comments