class Object

Public Instance Methods

as_(key, options = {}) click to toggle source
# File lib/active_scaffold/extensions/localize.rb, line 2
def as_(key, options = {})
  unless key.blank?
    text = I18n.translate "#{key}", {:scope => [:active_scaffold, *options.delete(:scope)], :default => key.is_a?(String) ? key : key.to_s.titleize}.merge(options)
    # text = nil if text.include?('translation missing:')
  end
  text ||= key 
  text
end
datetime_conversion_for_condition_with_datepicker(column) click to toggle source
# File lib/active_scaffold/bridges/date_picker/ext.rb, line 52
def datetime_conversion_for_condition_with_datepicker(column)
  if column.search_ui == :date_picker
    :to_date
  else
    datetime_conversion_for_condition_without_datepicker(column)
  end
end
dbg() click to toggle source
# File lib/active_scaffold/bridges/file_column/test/test_helper.rb, line 11
def dbg
  require 'ruby-debug'
  Debugger.start
  debugger
end
initialize_with_ancestry(model_id) click to toggle source
# File lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb, line 2
def initialize_with_ancestry(model_id)
  initialize_without_ancestry(model_id)

  return unless self.model.respond_to? :ancestry_column
  
  self.columns << :parent_id
  self.columns[:parent_id].form_ui = :ancestry
  update.columns.exclude :ancestry
  create.columns.exclude :ancestry, :parent_id
  list.columns.exclude :ancestry, :parent_id
end
initialize_with_date_picker(model_id) click to toggle source
# File lib/active_scaffold/bridges/date_picker/ext.rb, line 12
def initialize_with_date_picker(model_id)
  initialize_without_date_picker(model_id)
  
  date_picker_fields = self.model.columns.collect{|c| {:name => c.name.to_sym, :type => c.type} if [:date, :datetime].include?(c.type) }.compact
  # check to see if file column was used on the model
  return if date_picker_fields.empty?
  
  # automatically set the forum_ui to a date_picker or datetime_picker
  date_picker_fields.each{|field|
    col_config = self.columns[field[:name]] 
    col_config.form_ui = (field[:type] == :date ? :date_picker : :datetime_picker)
  }
end
offset(*args, &block) click to toggle source
# File lib/active_scaffold/extensions/active_record_offset.rb, line 3
def offset(*args, &block) 
  scoped.__send__(:offset, *args, &block)
rescue NoMethodError       
  if scoped.nil?           
    'depends on :allow_nil'
  else                     
    raise                  
  end                      
end

Public Class Methods

fallback_string_to_date_with_date_picker(string) click to toggle source
# File lib/active_scaffold/bridges/date_picker/ext.rb, line 31
def fallback_string_to_date_with_date_picker(string)
  Date.strptime(string, I18n.t('date.formats.default')) rescue fallback_string_to_date_without_date_picker(string)
end