Skip to content
Browse files

netzke_array and netzke_hash are defaulting to netzke_attributes

  • Loading branch information...
1 parent 905a65f commit ed5cd4aedab33ad2f8a2f4233f0c969d995ff72c @pschyska committed Mar 2, 2012
View
6 lib/netzke/active_record/attributes.rb
@@ -143,7 +143,7 @@ def association_attr?(attr_name)
end
# Transforms a record to array of values according to the passed attributes
- def netzke_array(attributes)
+ def netzke_array(attributes = self.class.netzke_attributes)
res = []
for a in attributes
next if a[:included] == false
@@ -153,11 +153,11 @@ def netzke_array(attributes)
end
def netzke_json
- netzke_hash(self.class.netzke_attributes).to_nifty_json
+ netzke_hash.to_nifty_json
end
# Accepts both hash and array of attributes
- def netzke_hash(attributes)
+ def netzke_hash(attributes = self.class.netzke_attributes)
res = {}
for a in (attributes.is_a?(Hash) ? attributes.values : attributes)
next if a[:included] == false
View
6 lib/netzke/data_mapper/attributes.rb
@@ -159,7 +159,7 @@ def association_attr?(attr_name)
end
# Transforms a record to array of values according to the passed attributes
- def netzke_array(attributes)
+ def netzke_array(attributes = self.class.netzke_attributes)
res = []
for a in attributes
next if a[:included] == false
@@ -169,11 +169,11 @@ def netzke_array(attributes)
end
def netzke_json
- netzke_hash(self.class.netzke_attributes).to_nifty_json
+ netzke_hash.to_nifty_json
end
# Accepts both hash and array of attributes
- def netzke_hash(attributes)
+ def netzke_hash(attributes = self.class.netzke_attributes)
res = {}
for a in (attributes.is_a?(Hash) ? attributes.values : attributes)
next if a[:included] == false
View
6 lib/netzke/sequel/attributes.rb
@@ -154,7 +154,7 @@ def association_attr?(attr_name)
end
# Transforms a record to array of values according to the passed attributes
- def netzke_array(attributes)
+ def netzke_array(attributes = self.class.netzke_attributes)
res = []
for a in attributes
next if a[:included] == false
@@ -165,11 +165,11 @@ def netzke_array(attributes)
# convenience method to convert all netzke attributes of a model to nifty json
def netzke_json
- netzke_hash(self.class.netzke_attributes).to_nifty_json
+ netzke_hash.to_nifty_json
end
# Accepts both hash and array of attributes
- def netzke_hash(attributes)
+ def netzke_hash(attributes = self.class.netzke_attributes)
res = {}
for a in (attributes.is_a?(Hash) ? attributes.values : attributes)
next if a[:included] == false

0 comments on commit ed5cd4a

Please sign in to comment.
Something went wrong with that request. Please try again.