A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.
posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord| module ProgressBar | |
| class << self | |
| def progress_bar(items_count, current_item_index, prefix) | |
| @@start_time = Time.now if current_item_index == 0 | |
| time = Time.now - @@start_time | |
| progress = current_item_index.next.to_f / items_count.to_f * 100 | |
| bar = "▓" * ( 50 * (progress / 100 ) ).floor | |
| minutes = ((time / progress) * (100 - progress) / 60).round | |
| left_str = "#{minutes} minutes left " |
| class NativeColumnStore < ActiveRecord::SessionStore::Session | |
| class << self | |
| attr_reader :native_columns | |
| def native_columns=(columns) | |
| @native_columns = columns.map(&:to_s) | |
| end | |
| @native_columns = [] | |
| end | |
| def data |