any_persistent_class (Class)

In: highcrest/persistence.rb

Methods

Public Class methods

Returns a database handle

[Source]

# File highcrest/persistence.rb, line 89
            def dbh()
                instance.dbh
            end

Deletes matching objects

[Source]

# File highcrest/persistence.rb, line 109
            def delete_all(conditions)
                instance.delete_all conditions
            end

Registers an attribute to contain an array of dependent child objects, and modifies the class’s CRUD methods to persist that array

[Source]

# File highcrest/persistence.rb, line 116
            def dependent_array(attribute_symbol, type)
                @array_types ||= Hash.new
                @array_types[attribute_symbol.id2name] = type
                self.module_eval "def \#{ attribute_symbol.id2name }\n@\#{ attribute_symbol.id2name } ||= Array.new\nend\n\ndef \#{ attribute_symbol.id2name }=(array)\n@\#{ attribute_symbol.id2name } = array\nend\n\nalias_method :__\#{ :select_where!.to_i }__, :select_where!\ndef select_where!(where_sql, *key)\n__\#{ :select_where!.to_i }__ where_sql, *key\nread_array_\#{ attribute_symbol.id2name }\nself\nend\n\nalias_method :__\#{ :insert!.to_i }__, :insert!\ndef insert!\n__\#{ :insert!.to_i }__\nwrite_array_\#{ attribute_symbol.id2name }\nself\nend\n\nalias_method :__\#{ :update!.to_i }__, :update!\ndef update!\ndelete_array_\#{ attribute_symbol.id2name }\n__\#{ :update!.to_i }__\nwrite_array_\#{ attribute_symbol.id2name }\nself\nend\n\nalias_method :__\#{ :delete!.to_i }__, :delete!\ndef delete!\ndelete_array_\#{ attribute_symbol.id2name }\n__\#{ :delete!.to_i }__\nend\n"
            end

Fetches an object by primary key

[Source]

# File highcrest/persistence.rb, line 94
            def read(*key)
                instance.select! *key
            end

Fetches an array of database rows

[Source]

# File highcrest/persistence.rb, line 99
            def search(conditions)
                instance.search conditions
            end

Fetches an array of objects

[Source]

# File highcrest/persistence.rb, line 104
            def select_all(conditions)
                instance.select_all conditions
            end

[Validate]