hobo 1.3.3 → 1.4.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. data/{CHANGES.txt → CHANGES-1.3.txt} +0 -0
  2. data/CHANGES-1.4.txt +678 -0
  3. data/Rakefile +13 -3
  4. data/TODO-1.4.txt +69 -0
  5. data/VERSION +1 -1
  6. data/app/helpers/hobo_debug_helper.rb +16 -0
  7. data/app/helpers/hobo_deprecated_helper.rb +45 -0
  8. data/app/helpers/hobo_helper_base.rb +8 -0
  9. data/app/helpers/hobo_permissions_helper.rb +136 -0
  10. data/app/helpers/hobo_route_helper.rb +196 -0
  11. data/{lib/hobo/helper/translations.rb → app/helpers/hobo_translations_helper.rb} +4 -7
  12. data/{lib/hobo/helper/translations/normalizer.rb → app/helpers/hobo_translations_normalizer_helper.rb} +3 -10
  13. data/app/helpers/hobo_type_helper.rb +24 -0
  14. data/app/helpers/hobo_view_hint_helper.rb +13 -0
  15. data/hobo.gemspec +3 -3
  16. data/lib/generators/hobo/admin_subsite/admin_subsite_generator.rb +0 -9
  17. data/lib/generators/hobo/admin_subsite/templates/application.dryml +2 -0
  18. data/lib/generators/hobo/admin_subsite/templates/gitkeep +0 -0
  19. data/lib/generators/hobo/admin_subsite/templates/site.css.erb +9 -0
  20. data/lib/generators/hobo/admin_subsite/templates/site.js.erb +10 -0
  21. data/lib/generators/hobo/assets/assets_generator.rb +16 -2
  22. data/lib/generators/hobo/assets/templates/application.css +9 -0
  23. data/lib/generators/hobo/assets/templates/application.dryml.erb +0 -5
  24. data/lib/generators/hobo/assets/templates/application.js +11 -0
  25. data/lib/generators/hobo/assets/templates/front.css +10 -0
  26. data/lib/generators/hobo/assets/templates/front.js +11 -0
  27. data/lib/generators/hobo/assets/templates/front_site.dryml.erb +6 -0
  28. data/lib/generators/hobo/assets/templates/gitkeep +0 -0
  29. data/lib/generators/hobo/dev_tweaks/dev_tweaks_generator.rb +31 -0
  30. data/lib/generators/hobo/i18n/templates/hobo.en.yml +1 -1
  31. data/lib/generators/hobo/install_plugin/USAGE +3 -0
  32. data/lib/generators/hobo/install_plugin/install_plugin_generator.rb +36 -0
  33. data/lib/generators/hobo/plugin.rb +112 -0
  34. data/lib/generators/hobo/setup_wizard/setup_wizard_generator.rb +31 -14
  35. data/lib/generators/hobo/subsite.rb +16 -2
  36. data/lib/generators/hobo/subsite/templates/gitkeep +0 -0
  37. data/lib/generators/hobo/subsite/templates/site.css.erb +9 -0
  38. data/lib/generators/hobo/subsite/templates/site.js.erb +10 -0
  39. data/lib/generators/hobo/subsite_taglib/templates/taglib.dryml.erb +0 -17
  40. data/lib/generators/hobo/test_framework/test_framework_generator.rb +1 -1
  41. data/lib/hobo.rb +3 -2
  42. data/lib/hobo/controller.rb +43 -24
  43. data/lib/hobo/controller/model.rb +63 -42
  44. data/lib/hobo/controller/user_base.rb +1 -3
  45. data/lib/hobo/engine.rb +1 -1
  46. data/lib/hobo/extensions/active_record/associations/association.rb +36 -0
  47. data/lib/hobo/extensions/active_record/associations/collection.rb +10 -19
  48. data/lib/hobo/extensions/active_record/associations/proxy.rb +3 -15
  49. data/lib/hobo/extensions/active_record/associations/scope.rb +2 -2
  50. data/lib/hobo/extensions/active_record/permissions.rb +32 -38
  51. data/lib/hobo/extensions/active_record/relation_with_origin.rb +5 -5
  52. data/lib/hobo/model.rb +12 -7
  53. data/lib/hobo/model/accessible_associations.rb +8 -15
  54. data/lib/hobo/model/lifecycles/creator.rb +1 -1
  55. data/lib/hobo/model/lifecycles/transition.rb +1 -1
  56. data/lib/hobo/model/permissions.rb +4 -4
  57. data/lib/hobo/model/scopes.rb +4 -17
  58. data/lib/hobo/model/scopes/automatic_scopes.rb +5 -13
  59. data/lib/hobo/rapid/helper.rb +1 -161
  60. data/lib/hobo/rapid/taglibs/rapid.dryml +3 -17
  61. data/test/doctest/hobo/hobo_helper.rdoctest +8 -44
  62. data/{doctests → test/doctest}/hobo/lifecycles.rdoctest +0 -0
  63. data/{doctests → test/doctest}/hobo/model.rdoctest +2 -4
  64. data/{doctests → test/doctest}/hobo/multi_model_forms.rdoctest +3 -24
  65. data/{doctests → test/doctest}/hobo/scopes.rdoctest +3 -53
  66. data/test/doctest/prepare_testapp.rb +11 -0
  67. data/test/irt/generators/admin_subsite.irt +1 -19
  68. data/test/irt/generators/assets.irt +4 -9
  69. data/test/irt/generators/controller.irt +0 -3
  70. data/test/irt/generators/front_controller.irt +0 -5
  71. data/test/irt/generators/{helper.rb → irt_helper.rb} +2 -2
  72. data/test/irt/generators/model.irt +1 -12
  73. data/test/irt/generators/partials/_account_user_model_tests.rb +0 -8
  74. data/test/irt/generators/partials/_accounts_users_controller_tests.rb +0 -2
  75. data/test/irt/generators/partials/_default_user_model_tests.rb +0 -8
  76. data/test/irt/generators/partials/_default_users_controller_tests.rb +0 -2
  77. data/test/irt/generators/partials/_house_controller_tests.rb +0 -2
  78. data/test/irt/generators/partials/_house_model_tests.rb +1 -9
  79. data/test/irt/generators/partials/_subsite_taglib_admin.rb +5 -2
  80. data/test/irt/generators/partials/_subsite_taglib_admin_invite_only.rb +1 -1
  81. data/test/irt/generators/partials/_subsite_taglib_noopt.rb +2 -2
  82. data/test/irt/generators/partials/_subsite_taglib_variables.rb +0 -15
  83. data/test/irt/generators/partials/_user_mailer_tests.rb +1 -3
  84. data/test/irt/generators/resource.irt +0 -3
  85. data/test/irt/generators/subsite.irt +6 -22
  86. data/test/irt/generators/subsite_taglib.irt +0 -18
  87. data/test/irt/generators/test_framework.irt +2 -5
  88. data/test/irt/generators/user_controller.irt +0 -3
  89. data/test/irt/generators/user_mailer.irt +0 -3
  90. data/test/irt/generators/user_model.irt +0 -3
  91. data/test/irt/generators/user_resource.irt +0 -3
  92. data/test/irt/readme.txt +6 -3
  93. metadata +116 -159
  94. data/app/controllers/dev_controller.rb +0 -25
  95. data/app/views/dev/summary.dryml +0 -102
  96. data/doctests/prepare_testapp.rb +0 -8
  97. data/lib/generators/hobo/admin_subsite/templates/admin.css +0 -20
  98. data/lib/generators/hobo/rapid/USAGE +0 -3
  99. data/lib/generators/hobo/rapid/rapid_generator.rb +0 -24
  100. data/lib/generators/hobo/rapid/templates/IE7.js +0 -2
  101. data/lib/generators/hobo/rapid/templates/blank.gif +0 -0
  102. data/lib/generators/hobo/rapid/templates/hobo-rapid.css +0 -94
  103. data/lib/generators/hobo/rapid/templates/hobo-rapid.js +0 -1015
  104. data/lib/generators/hobo/rapid/templates/ie7-recalc.js +0 -166
  105. data/lib/generators/hobo/rapid/templates/lowpro.js +0 -339
  106. data/lib/generators/hobo/rapid/templates/reset.css +0 -95
  107. data/lib/generators/hobo/rapid/templates/themes/clean/public/images/101-3B5F87-ACD3E6.png +0 -0
  108. data/lib/generators/hobo/rapid/templates/themes/clean/public/images/30-3E547A-242E42.png +0 -0
  109. data/lib/generators/hobo/rapid/templates/themes/clean/public/images/30-DBE1E5-FCFEF5.png +0 -0
  110. data/lib/generators/hobo/rapid/templates/themes/clean/public/images/300-ACD3E6-fff.png +0 -0
  111. data/lib/generators/hobo/rapid/templates/themes/clean/public/images/50-ACD3E6-fff.png +0 -0
  112. data/lib/generators/hobo/rapid/templates/themes/clean/public/images/fieldbg.gif +0 -0
  113. data/lib/generators/hobo/rapid/templates/themes/clean/public/images/pencil.png +0 -0
  114. data/lib/generators/hobo/rapid/templates/themes/clean/public/images/small_close.png +0 -0
  115. data/lib/generators/hobo/rapid/templates/themes/clean/public/images/spinner.gif +0 -0
  116. data/lib/generators/hobo/rapid/templates/themes/clean/public/stylesheets/clean.css +0 -327
  117. data/lib/generators/hobo/rapid/templates/themes/clean/public/stylesheets/rapid-ui.css +0 -102
  118. data/lib/generators/hobo/rapid/templates/themes/clean/views/clean.dryml +0 -10
  119. data/lib/hobo/helper.rb +0 -460
  120. data/lib/hobo/rapid/taglibs/rapid_core.dryml +0 -808
  121. data/lib/hobo/rapid/taglibs/rapid_document_tags.dryml +0 -56
  122. data/lib/hobo/rapid/taglibs/rapid_editing.dryml +0 -287
  123. data/lib/hobo/rapid/taglibs/rapid_forms.dryml +0 -1156
  124. data/lib/hobo/rapid/taglibs/rapid_generics.dryml +0 -48
  125. data/lib/hobo/rapid/taglibs/rapid_i18n.dryml +0 -173
  126. data/lib/hobo/rapid/taglibs/rapid_lifecycles.dryml +0 -96
  127. data/lib/hobo/rapid/taglibs/rapid_navigation.dryml +0 -108
  128. data/lib/hobo/rapid/taglibs/rapid_pages.dryml +0 -259
  129. data/lib/hobo/rapid/taglibs/rapid_plus.dryml +0 -247
  130. data/lib/hobo/rapid/taglibs/rapid_summary.dryml +0 -283
  131. data/lib/hobo/rapid/taglibs/rapid_support.dryml +0 -102
  132. data/lib/hobo/rapid/taglibs/rapid_user_pages.dryml +0 -182
  133. data/test/irt/generators/rapid.irt +0 -29
@@ -1,10 +0,0 @@
1
- <extend tag="page">
2
- <old-page merge>
3
- <stylesheets: param>
4
- <stylesheet name="reset"/>
5
- <theme-stylesheet/>
6
- <theme-stylesheet name="rapid-ui"/>
7
- <stylesheet name="application" param="app-stylesheet"/>
8
- </stylesheets:>
9
- </old-page>
10
- </extend>
data/lib/hobo/helper.rb DELETED
@@ -1,460 +0,0 @@
1
- module Hobo
2
-
3
- module Helper
4
-
5
- def self.add_to_controller(controller)
6
- controller.send(:include, self)
7
- controller.hide_action(self.instance_methods)
8
- end
9
-
10
- protected
11
-
12
-
13
- def uid
14
- @hobo_uid ||= 0
15
- @hobo_uid += 1
16
- end
17
-
18
-
19
- def current_user
20
- # simple one-hit-per-request cache
21
- @current_user ||= begin
22
- id = session._?[:user]
23
- (id && Hobo::Model.find_by_typed_id(id) rescue nil) || ::Guest.new
24
- end
25
- end
26
-
27
-
28
- def logged_in?
29
- !current_user.guest?
30
- end
31
-
32
-
33
- def base_url
34
- "#{Rails.application.config.action_controller.relative_url_root}"
35
- end
36
-
37
-
38
- def controller_for(obj)
39
- if obj.is_a? Class
40
- obj.name.underscore.pluralize
41
- else
42
- obj.class.name.underscore.pluralize
43
- end
44
- end
45
-
46
-
47
- def subsite
48
- params[:controller]._?.match(/([^\/]+)\//)._?[1]
49
- end
50
-
51
-
52
- IMPLICIT_ACTIONS = [:index, :show, :create, :update, :destroy]
53
-
54
- def object_url(obj, *args)
55
- params = args.extract_options!
56
- action = args.first._?.to_sym
57
- options, params = params.partition_hash([:subsite, :method, :format])
58
- options[:subsite] ||= self.subsite
59
- subsite, method = options.get :subsite, :method
60
-
61
- if obj.respond_to?(:member_class) && obj.respond_to?(:origin) && obj.origin
62
- # Asking for URL of a collection, e.g. category/1/adverts or category/1/adverts/new
63
-
64
- refl = obj.origin.class.reverse_reflection(obj.origin_attribute)
65
- owner_name = refl.name.to_s
66
- owner_name = owner_name.singularize if refl.macro == :has_many
67
- if action == :new
68
- action_path = "#{obj.origin_attribute}/new"
69
- action = :"new_for_#{owner_name}"
70
- elsif action.nil?
71
- action_path = obj.origin_attribute
72
- if method.to_s == 'post'
73
- action = :"create_for_#{owner_name}"
74
- else
75
- action = :"index_for_#{owner_name}"
76
- end
77
- end
78
- klass = obj.member_class
79
- obj = obj.origin
80
- else
81
- action ||= case options[:method].to_s
82
- when 'put'; :update
83
- when 'post'; :create
84
- when 'delete'; :destroy
85
- else; obj.is_a?(Class) ? :index : :show
86
- end
87
-
88
- if options[:method].to_s == 'post' && obj.try.new_record?
89
- # Asking for url to post new record to
90
- obj = obj.class
91
- end
92
-
93
- klass = if obj.is_a?(Class)
94
- obj
95
- elsif obj.respond_to?(:member_class)
96
- obj.member_class # We get here if we're passed a scoped class
97
- else
98
- obj.class
99
- end
100
- end
101
-
102
- if Hobo::Routes.linkable?(klass, action, options)
103
-
104
- url = base_url_for(obj, subsite, action)
105
- url += "/#{action_path || action}" unless action.in?(IMPLICIT_ACTIONS)
106
-
107
- params = make_params(params)
108
- params.blank? ? url : "#{url}?#{params}"
109
- end
110
- end
111
-
112
-
113
- def app_name(add_subsite=true)
114
- an = Rails.application.config.hobo.app_name
115
- if add_subsite && subsite
116
- subsite_name = t 'hobo.admin.subsite_name', :default => subsite.titleize
117
- an = an + " - #{subsite_name}"
118
- end
119
- an
120
- end
121
-
122
-
123
- def base_url_for(object, subsite, action)
124
- path = object.to_url_path or Hobo::Error.new("cannot create url for #{object.inspect} (#{object.class})")
125
- "#{base_url}#{'/' + subsite unless subsite.blank?}/#{path}"
126
- end
127
-
128
-
129
- def recognize_page_path
130
- if params[:page_path]
131
- Rails.application.routes.recognize_path(params[:page_path].gsub(/^#{Rails.configuration.action_controller.relative_url_root}/,''))
132
- else
133
- params
134
- end
135
- end
136
-
137
- def url_for_page_path(options={})
138
- url_for recognize_page_path.merge(options)
139
- end
140
-
141
- def controller_action_from_page_path
142
- recognize_page_path.values_at(:controller,:action)
143
- end
144
-
145
- def _as_params(name, obj)
146
- if obj.is_a? Array
147
- obj.map {|x| _as_params("#{name}[]", x)}.join("&")
148
- elsif obj.is_a? Hash
149
- obj.map {|k,v| _as_params("#{name}[#{k}]", v)}.join("&")
150
- elsif obj.is_a? Hobo::RawJs
151
- "#{name}=' + #{obj} + '"
152
- else
153
- v = if obj.is_one_of?(ActiveRecord::Base, Array)
154
- "@" + typed_id(obj)
155
- else
156
- obj.to_s.gsub("'"){"\\'"}
157
- end
158
- "#{name}=#{v}"
159
- end
160
- end
161
-
162
-
163
- def make_params(*hashes)
164
- hash = {}
165
- hashes.each {|h| hash.update(h) if h}
166
- hash.map {|k,v| _as_params(k, v)}.join("&")
167
- end
168
-
169
-
170
- def type_id(type=nil)
171
- type ||= (this.is_a?(Class) && this) || this_type || this.class
172
- HoboFields.to_name(type) || type.name.to_s.underscore.gsub("/", "__")
173
- end
174
-
175
-
176
- def type_and_field(*args)
177
- type, field = args.empty? ? [this_parent.class, this_field] : args
178
- "#{type.typed_id}_#{field}" if type.respond_to?(:typed_id)
179
- end
180
-
181
-
182
- def model_id_class(object=this, attribute=nil)
183
- object.respond_to?(:typed_id) ? "model::#{typed_id(object, attribute).to_s.dasherize}" : ""
184
- end
185
-
186
- def update_elements_class(updates)
187
- 'update::'+comma_split(updates).join(':') unless updates.blank?
188
- end
189
-
190
- def can_create?(object=this)
191
- if object.is_a?(Class) and object < ActiveRecord::Base
192
- object = object.new
193
- elsif (refl = object.try.proxy_reflection) && refl.macro == :has_many
194
- if Hobo.simple_has_many_association?(object)
195
- object = object.new
196
- object.set_creator(current_user)
197
- else
198
- return false
199
- end
200
- end
201
- object.creatable_by?(current_user)
202
- end
203
-
204
-
205
- def can_update?(object=this)
206
- object.updatable_by?(current_user)
207
- end
208
-
209
-
210
- def can_edit?(*args)
211
- object, field = if args.empty?
212
- if this.respond_to?(:editable_by?) && !this_field_reflection
213
- [this, nil]
214
- elsif this_parent && this_field
215
- [this_parent, this_field]
216
- else
217
- [this, nil]
218
- end
219
- elsif args.length == 2
220
- args
221
- else
222
- [this, args.first]
223
- end
224
-
225
- if !field && (origin = object.try.origin)
226
- object, field = origin, object.origin_attribute
227
- end
228
-
229
- object.editable_by?(current_user, field)
230
- end
231
-
232
-
233
- def can_delete?(object=this)
234
- object.destroyable_by?(current_user)
235
- end
236
-
237
-
238
-
239
- def can_call?(*args)
240
- method = args.last
241
- object = args.length == 2 ? args.first : this
242
-
243
- object.method_callable_by?(current_user, method)
244
- end
245
-
246
-
247
- # can_view? has special behaviour if it's passed a class or an
248
- # association-proxy -- it instantiates the class, or creates a new
249
- # instance "in" the association, and tests the permission of this
250
- # object. This means the permission methods in models can't rely
251
- # on the instance being properly initialised. But it's important
252
- # that it works like this because, in the case of an association
253
- # proxy, we don't want to loose the information that the object
254
- # belongs_to the proxy owner.
255
- def can_view?(*args)
256
- # TODO: Man does this need a big cleanup!
257
-
258
- if args.empty?
259
- # if we're repeating over an array, this_field ends up with the current index. Is this useful to anybody?
260
- if this_parent && this_field && !this_field.is_a?(Integer)
261
- object = this_parent
262
- field = this_field
263
- else
264
- object = this
265
- end
266
- elsif args.first.is_one_of?(String, Symbol)
267
- object = this
268
- field = args.first
269
- else
270
- object, field = args
271
- end
272
-
273
- if field
274
- # Field can be a dot separated path
275
- if field.is_a?(String) && (path = field.split(".")).length > 1
276
- _, _, object = Dryml.get_field_path(object, path[0..-2])
277
- field = path.last
278
- end
279
- elsif (origin = object.try.origin)
280
- object, field = origin, object.origin_attribute
281
- end
282
-
283
- @can_view_cache ||= {}
284
- @can_view_cache[ [object, field] ] ||=
285
- if !object.respond_to?(:viewable_by?)
286
- true
287
- elsif object.viewable_by?(current_user, field)
288
- # If possible, we also check if the current *value* of the field is viewable
289
- if field.is_one_of?(Symbol, String) && (v = object.send(field)) && v.respond_to?(:viewable_by?)
290
- v.viewable_by?(current_user, nil)
291
- else
292
- true
293
- end
294
- else
295
- false
296
- end
297
- end
298
-
299
-
300
- def select_viewable(collection=this)
301
- collection.select {|x| can_view?(x)}
302
- end
303
-
304
-
305
- def theme_asset(path)
306
- theme_path = Hobo.current_theme ? "hobothemes/#{Hobo.current_theme}/" : ""
307
- "#{base_url}/#{theme_path}#{path}"
308
- end
309
-
310
- def js_str(s)
311
- if s.is_a? Hobo::RawJs
312
- s.to_s
313
- else
314
- "'" + s.to_s.gsub("'"){"\\'"} + "'"
315
- end
316
- end
317
-
318
-
319
- def make_params_js(*args)
320
- ("'" + make_params(*args) + "'").sub(/ \+ ''$/,'')
321
- end
322
-
323
-
324
- def nl_to_br(s)
325
- s.to_s.gsub("\n", "<br/>") if s
326
- end
327
-
328
- def transpose_with_field(field, collection=nil)
329
- collection ||= this
330
- matrix = collection.map {|obj| obj.send(field) }
331
- max_length = matrix.*.length.max
332
- matrix = matrix.map do |a|
333
- a + [nil] * (max_length - a.length)
334
- end
335
- matrix.transpose
336
- end
337
-
338
-
339
- def new_for_current_user(model_or_assoc=nil)
340
- model_or_assoc ||= this
341
- if model_or_assoc.respond_to?(:new_candidate)
342
- model_or_assoc.user_new_candidate(current_user)
343
- else
344
- model_or_assoc.user_new(current_user)
345
- end
346
- end
347
-
348
-
349
- def defined_route?(r)
350
- @view.respond_to?("#{r}_url")
351
- end
352
-
353
-
354
- # Login url for a given user record or user class
355
- def forgot_password_url(user_class=Hobo::Model::UserBase.default_user_model)
356
- send("#{user_class.name.underscore}_forgot_password_url") rescue nil
357
- end
358
-
359
-
360
- # Login url for a given user record or user class
361
- def login_url(user_class=Hobo::Model::UserBase.default_user_model)
362
- send("#{user_class.name.underscore}_login_url") rescue nil
363
- end
364
-
365
-
366
- # Sign-up url for a given user record or user class
367
- def signup_url(user_class=Hobo::Model::UserBase.default_user_model)
368
- send("#{user_class.name.underscore}_signup_url") rescue nil
369
- end
370
-
371
-
372
- # Login url for a given user record or user class
373
- def logout_url(user_or_class=nil)
374
- c = if user_or_class.nil?
375
- current_user.class
376
- elsif user_or_class.is_a?(Class)
377
- user_or_class
378
- else
379
- user_or_class.class
380
- end
381
- send("#{c.name.underscore}_logout_url") rescue nil
382
- end
383
-
384
-
385
- def current_page_url
386
- request.fullpath.match(/^([^?]*)/)._?[1]
387
- end
388
-
389
- def query_params
390
- query = request.fullpath =~ /\?([^?]+)/ && $1
391
- result = HashWithIndifferentAccess.new
392
- if query
393
- query.gsub!('+', ' ')
394
- query.split('&').each do |param|
395
- name, val = param.split('=', 2)
396
- result[URI.unescape(name)] = val ? URI.unescape(val) : ''
397
- end
398
- end
399
- result
400
- end
401
-
402
-
403
- def linkable?(*args)
404
- options = args.extract_options!
405
- target = args.empty? || args.first.is_a?(Symbol) ? this : args.shift
406
- action = args.first
407
- return false if action.nil? && target.try.new_record?
408
-
409
- if target.respond_to?(:member_class) && (origin = target.try.origin)
410
- klass = origin.class
411
- action = if action == :new
412
- "new_#{target.origin_attribute.to_s.singularize}"
413
- elsif action.nil?
414
- target.origin_attribute
415
- end
416
- elsif target.is_a?(Class)
417
- klass = target
418
- action ||= :index
419
- else
420
- klass = target.class
421
- action ||= :show
422
- end
423
-
424
- Hobo::Routes.linkable?(klass, action, options.reverse_merge(:subsite => subsite))
425
- end
426
-
427
-
428
- def css_data(name, *args)
429
- "#{name.to_s.dasherize}::#{args * '::'}"
430
- end
431
-
432
-
433
- # --- ViewHint Helpers --- #
434
-
435
- def this_field_name
436
- this_parent.class.try.human_attribute_name(this_field) || this_field
437
- end
438
-
439
- def this_field_help
440
- this_parent.class.try.attribute_help(this_field.to_sym) || ""
441
- end
442
-
443
- # --- Debugging Helpers ---- #
444
-
445
- def abort_with(*args)
446
- raise args.*.pretty_inspect.join("-------\n")
447
- end
448
-
449
- def log_debug(*args)
450
- return if not logger
451
- logger.debug("\n### DRYML Debug ###")
452
- logger.debug(args.*.pretty_inspect.join("-------\n"))
453
- logger.debug("DRYML THIS = #{this.typed_id rescue this.inspect}")
454
- logger.debug("###################\n")
455
- args.first unless args.empty?
456
- end
457
-
458
- end
459
-
460
- end