class Object
Constants
- ACTIVE_SCAFFOLD_GEM
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
build_association(*opts, &block)
click to toggle source
# File lib/active_scaffold/extensions/active_association_reflection.rb, line 4 def build_association(*opts, &block) col = klass.inheritance_column.to_sym if !col.nil? && opts.first.is_a?(Hash) && (opts.first.symbolize_keys[col]) sti_model = opts.first.delete(col) sti_model.to_s.camelize.constantize.new(*opts, &block) else klass.new(*opts, &block) 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/lib/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/lib/datepicker_bridge.rb, line 15 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 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