Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

netzke_array and netzke_hash are defaulting to netzke_attributes

  • Loading branch information...
commit ed5cd4aedab33ad2f8a2f4233f0c969d995ff72c 1 parent 905a65f
Paul Schyska authored
6 lib/netzke/active_record/attributes.rb
@@ -143,7 +143,7 @@ def association_attr?(attr_name)
143 143 end
144 144
145 145 # Transforms a record to array of values according to the passed attributes
146   - def netzke_array(attributes)
  146 + def netzke_array(attributes = self.class.netzke_attributes)
147 147 res = []
148 148 for a in attributes
149 149 next if a[:included] == false
@@ -153,11 +153,11 @@ def netzke_array(attributes)
153 153 end
154 154
155 155 def netzke_json
156   - netzke_hash(self.class.netzke_attributes).to_nifty_json
  156 + netzke_hash.to_nifty_json
157 157 end
158 158
159 159 # Accepts both hash and array of attributes
160   - def netzke_hash(attributes)
  160 + def netzke_hash(attributes = self.class.netzke_attributes)
161 161 res = {}
162 162 for a in (attributes.is_a?(Hash) ? attributes.values : attributes)
163 163 next if a[:included] == false
6 lib/netzke/data_mapper/attributes.rb
@@ -159,7 +159,7 @@ def association_attr?(attr_name)
159 159 end
160 160
161 161 # Transforms a record to array of values according to the passed attributes
162   - def netzke_array(attributes)
  162 + def netzke_array(attributes = self.class.netzke_attributes)
163 163 res = []
164 164 for a in attributes
165 165 next if a[:included] == false
@@ -169,11 +169,11 @@ def netzke_array(attributes)
169 169 end
170 170
171 171 def netzke_json
172   - netzke_hash(self.class.netzke_attributes).to_nifty_json
  172 + netzke_hash.to_nifty_json
173 173 end
174 174
175 175 # Accepts both hash and array of attributes
176   - def netzke_hash(attributes)
  176 + def netzke_hash(attributes = self.class.netzke_attributes)
177 177 res = {}
178 178 for a in (attributes.is_a?(Hash) ? attributes.values : attributes)
179 179 next if a[:included] == false
6 lib/netzke/sequel/attributes.rb
@@ -154,7 +154,7 @@ def association_attr?(attr_name)
154 154 end
155 155
156 156 # Transforms a record to array of values according to the passed attributes
157   - def netzke_array(attributes)
  157 + def netzke_array(attributes = self.class.netzke_attributes)
158 158 res = []
159 159 for a in attributes
160 160 next if a[:included] == false
@@ -165,11 +165,11 @@ def netzke_array(attributes)
165 165
166 166 # convenience method to convert all netzke attributes of a model to nifty json
167 167 def netzke_json
168   - netzke_hash(self.class.netzke_attributes).to_nifty_json
  168 + netzke_hash.to_nifty_json
169 169 end
170 170
171 171 # Accepts both hash and array of attributes
172   - def netzke_hash(attributes)
  172 + def netzke_hash(attributes = self.class.netzke_attributes)
173 173 res = {}
174 174 for a in (attributes.is_a?(Hash) ? attributes.values : attributes)
175 175 next if a[:included] == false

0 comments on commit ed5cd4a

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