Public instance methods
can_console_update
(options={})
Enable a model to be updated via the console and an editor. By default editable attributes are columns with text, boolean or integer-like values.
Options:
- :only
- Sets these attributes as the default editable attributes.
- :except
- Sets the default editable attributes as normal except for these attributes.
- :editor
- Overrides global editor for just this model.
[show source]
# File lib/console_update.rb, line 22 def can_console_update(options={}) cattr_accessor :console_editor self.console_editor = options[:editor] || ConsoleUpdate.editor cattr_accessor :default_editable_attributes if options[:only] self.default_editable_attributes = options[:only] elsif options[:except] self.default_editable_attributes = self.column_names.select {|e| !options[:except].include?(e) } else self.default_editable_attributes = get_default_editable_attributes end extend SingletonMethods send :include, InstanceMethods end