Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ruboss_on_ruby/active_foo.rb

Overview

Flex friendly XML serialization patches

Class Method Summary collapse

Class Method Details

.default_fxml_includes(*args) ⇒ Object



64
65
66
67
68
69
70
71
# File 'lib/ruboss_on_ruby/active_foo.rb', line 64

def default_fxml_includes(*args)
  includes = *args.dup
  module_eval <<-END
    def self.default_fxml_include_params
      return [#{includes.inspect}].flatten
    end
  END
end

.default_fxml_methods(*args) ⇒ Object

TODO: this doesn’t work with hash based to_fxml(:include) options, only array based



55
56
57
58
59
60
61
62
# File 'lib/ruboss_on_ruby/active_foo.rb', line 55

def default_fxml_methods(*args)
  methods = *args.dup
  module_eval <<-END 
      def self.default_fxml_methods_array
        return [#{methods.inspect}].flatten
      end
    END
end

.find(*args) ⇒ Object



46
47
48
49
50
51
52
# File 'lib/ruboss_on_ruby/active_foo.rb', line 46

def find(*args)
  result = old_find(*args)
  if result.class == Array and result.empty?
    result = ClassyEmptyArray.new(self.class_name.tableize)
  end
  result
end

.old_findObject



44
# File 'lib/ruboss_on_ruby/active_foo.rb', line 44

alias_method :old_find, :find