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], :default => key.is_a?(String) ? key : key.to_s.titleize}.merge(options)
    # text = nil if text.include?('translation missing:')
  end
  text ||= key 
  text
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.db_schema.collect {|name,properties| {:name => name, :type => properties[:type]} if [:date, :datetime].include?(properties[: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 file column
  date_picker_fields.each{|field|
    col_config = self.columns[field[:name]] 
    col_config.form_ui = (field[:type] == :date ? :date_picker : :datetime_picker)
  }
end