Module: ActiveRecordExtensions::ClassMethods
- Defined in:
- lib/patches/active_record_extensions.rb
Overview
add your static(class) methods here
Instance Method Summary collapse
- #identifier_starts_with(letter) ⇒ Object
- #starts_with_a ⇒ Object
- #starts_with_b ⇒ Object
- #starts_with_c ⇒ Object
- #starts_with_d ⇒ Object
- #starts_with_e ⇒ Object
- #starts_with_f ⇒ Object
- #starts_with_g ⇒ Object
- #starts_with_h ⇒ Object
- #starts_with_i ⇒ Object
- #starts_with_j ⇒ Object
- #starts_with_k ⇒ Object
- #starts_with_l ⇒ Object
- #starts_with_m ⇒ Object
- #starts_with_n ⇒ Object
- #starts_with_o ⇒ Object
- #starts_with_p ⇒ Object
- #starts_with_q ⇒ Object
- #starts_with_r ⇒ Object
- #starts_with_s ⇒ Object
- #starts_with_t ⇒ Object
- #starts_with_u ⇒ Object
- #starts_with_v ⇒ Object
- #starts_with_w ⇒ Object
- #starts_with_x ⇒ Object
- #starts_with_y ⇒ Object
- #starts_with_z ⇒ Object
-
#top_ten ⇒ Object
E.g: Order.top_ten.
Instance Method Details
#identifier_starts_with(letter) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/patches/active_record_extensions.rb', line 11 def identifier_starts_with letter # Se ha name o code o barcode, uso uno di questi: column = if self.column_names.include? "name" :name elsif self.column_names.include? "title" :title elsif self.column_names.include? "code" :code elsif self.column_names.include? "barcode" :barcode end # Ecco la ricerca dedicata a Postgres, la facciamo multiplatform? Fatto query = "#{letter}%" match = arel_table[column].matches(query) where(match) end |
#starts_with_a ⇒ Object
28 29 30 |
# File 'lib/patches/active_record_extensions.rb', line 28 def starts_with_a identifier_starts_with :a end |
#starts_with_b ⇒ Object
32 33 34 |
# File 'lib/patches/active_record_extensions.rb', line 32 def starts_with_b identifier_starts_with :b end |
#starts_with_c ⇒ Object
36 37 38 |
# File 'lib/patches/active_record_extensions.rb', line 36 def starts_with_c identifier_starts_with :c end |
#starts_with_d ⇒ Object
40 41 42 |
# File 'lib/patches/active_record_extensions.rb', line 40 def starts_with_d identifier_starts_with :d end |
#starts_with_e ⇒ Object
44 45 46 |
# File 'lib/patches/active_record_extensions.rb', line 44 def starts_with_e identifier_starts_with :e end |
#starts_with_f ⇒ Object
48 49 50 |
# File 'lib/patches/active_record_extensions.rb', line 48 def starts_with_f identifier_starts_with :f end |
#starts_with_g ⇒ Object
52 53 54 |
# File 'lib/patches/active_record_extensions.rb', line 52 def starts_with_g identifier_starts_with :g end |
#starts_with_h ⇒ Object
56 57 58 |
# File 'lib/patches/active_record_extensions.rb', line 56 def starts_with_h identifier_starts_with :h end |
#starts_with_i ⇒ Object
60 61 62 |
# File 'lib/patches/active_record_extensions.rb', line 60 def starts_with_i identifier_starts_with :i end |
#starts_with_j ⇒ Object
64 65 66 |
# File 'lib/patches/active_record_extensions.rb', line 64 def starts_with_j identifier_starts_with :j end |
#starts_with_k ⇒ Object
68 69 70 |
# File 'lib/patches/active_record_extensions.rb', line 68 def starts_with_k identifier_starts_with :k end |
#starts_with_l ⇒ Object
72 73 74 |
# File 'lib/patches/active_record_extensions.rb', line 72 def starts_with_l identifier_starts_with :l end |
#starts_with_m ⇒ Object
76 77 78 |
# File 'lib/patches/active_record_extensions.rb', line 76 def starts_with_m identifier_starts_with :m end |
#starts_with_n ⇒ Object
80 81 82 |
# File 'lib/patches/active_record_extensions.rb', line 80 def starts_with_n identifier_starts_with :n end |
#starts_with_o ⇒ Object
84 85 86 |
# File 'lib/patches/active_record_extensions.rb', line 84 def starts_with_o identifier_starts_with :o end |
#starts_with_p ⇒ Object
88 89 90 |
# File 'lib/patches/active_record_extensions.rb', line 88 def starts_with_p identifier_starts_with :p end |
#starts_with_q ⇒ Object
92 93 94 |
# File 'lib/patches/active_record_extensions.rb', line 92 def starts_with_q identifier_starts_with :q end |
#starts_with_r ⇒ Object
96 97 98 |
# File 'lib/patches/active_record_extensions.rb', line 96 def starts_with_r identifier_starts_with :r end |
#starts_with_s ⇒ Object
100 101 102 |
# File 'lib/patches/active_record_extensions.rb', line 100 def starts_with_s identifier_starts_with :s end |
#starts_with_t ⇒ Object
104 105 106 |
# File 'lib/patches/active_record_extensions.rb', line 104 def starts_with_t identifier_starts_with :t end |
#starts_with_u ⇒ Object
108 109 110 |
# File 'lib/patches/active_record_extensions.rb', line 108 def starts_with_u identifier_starts_with :u end |
#starts_with_v ⇒ Object
112 113 114 |
# File 'lib/patches/active_record_extensions.rb', line 112 def starts_with_v identifier_starts_with :v end |
#starts_with_w ⇒ Object
116 117 118 |
# File 'lib/patches/active_record_extensions.rb', line 116 def starts_with_w identifier_starts_with :w end |
#starts_with_x ⇒ Object
120 121 122 |
# File 'lib/patches/active_record_extensions.rb', line 120 def starts_with_x identifier_starts_with :x end |
#starts_with_y ⇒ Object
124 125 126 |
# File 'lib/patches/active_record_extensions.rb', line 124 def starts_with_y identifier_starts_with :y end |
#starts_with_z ⇒ Object
128 129 130 |
# File 'lib/patches/active_record_extensions.rb', line 128 def starts_with_z identifier_starts_with :z end |
#top_ten ⇒ Object
E.g: Order.top_ten
7 8 9 |
# File 'lib/patches/active_record_extensions.rb', line 7 def top_ten limit(10) end |