hobo 1.3.0.pre21 → 1.3.0.pre22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/doctests/hobo/scopes.rdoctest +10 -2
- data/lib/generators/hobo/rapid/templates/hobo-rapid.js +1 -1
- data/lib/generators/hobo/test_framework/test_framework_generator.rb +4 -4
- data/lib/hobo/controller/model.rb +4 -3
- data/lib/hobo/model.rb +3 -0
- data/lib/hobo/model/lifecycles.rb +8 -7
- data/lib/hobo/model/scopes/automatic_scopes.rb +10 -0
- data/lib/hobo/model/view_hints.rb +1 -1
- metadata +13 -13
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.3.0.
|
1
|
+
1.3.0.pre22
|
@@ -285,10 +285,18 @@ Gives the N most recent items:
|
|
285
285
|
|
286
286
|
## include
|
287
287
|
|
288
|
-
|
288
|
+
DEPRECATED: Automatic scope :include has been deprecated: use :including instead.
|
289
|
+
|
290
|
+
## including
|
291
|
+
|
292
|
+
Adding the including function to your query chain has the same effect as
|
289
293
|
the `:include` option to the `find` method.
|
290
294
|
|
291
|
-
>> Person.
|
295
|
+
>> Person.search("B", :name).including(:friends).*.name # test LH#839
|
296
|
+
=> ["Bryan", "Bethany"]
|
297
|
+
.hidden
|
298
|
+
|
299
|
+
>> Person.including(:friends).*.name
|
292
300
|
=> ["Bryan", "Bethany"]
|
293
301
|
|
294
302
|
## search
|
@@ -691,7 +691,7 @@ HoboInputMany = {
|
|
691
691
|
Event.stop(ev);
|
692
692
|
var ul = el.up('ul.input-many'), li = el.up('li.input-many-li');
|
693
693
|
|
694
|
-
if(li.id.search(/_-1$/ && ul.immediateDescendants().length>2)
|
694
|
+
if(li.id.search(/_-1$/)>=0 && ul.immediateDescendants().length>2) {
|
695
695
|
/* if(console) console.log("IE7 messed up again (bug 605)"); */
|
696
696
|
return;
|
697
697
|
}
|
@@ -61,10 +61,10 @@ private
|
|
61
61
|
def add_generators_block
|
62
62
|
n = name == 'rspec_with_shoulda' ? 'rspec' : name
|
63
63
|
block = " config.generators do |g|"
|
64
|
-
block << "\n
|
65
|
-
block << "\n
|
66
|
-
block << "\n
|
67
|
-
block << "\n
|
64
|
+
block << "\n g.test_framework :#{n}, :fixtures => #{options[:fixtures].inspect}" if !options[:fixtures] || name != 'test_unit'
|
65
|
+
block << "\n g.fallbacks[:#{n}] = :test_unit" unless name == 'test_unit'
|
66
|
+
block << "\n g.fixture_replacement => :#{options[:fixture_replacement]}" unless options[:fixture_replacement].blank?
|
67
|
+
block << "\n end"
|
68
68
|
environment block
|
69
69
|
end
|
70
70
|
|
@@ -578,10 +578,11 @@ module Hobo
|
|
578
578
|
|
579
579
|
self.this ||= args.first || find_instance
|
580
580
|
changes = options[:attributes] || attribute_parameters or raise RuntimeError, t("hobo.messages.update.no_attribute_error", :default=>["No update specified in params"])
|
581
|
-
this.user_update_attributes(current_user, changes)
|
582
581
|
|
583
|
-
|
584
|
-
|
582
|
+
if this.user_update_attributes(current_user, changes)
|
583
|
+
# Ensure current_user isn't out of date
|
584
|
+
@current_user = @this if @this == current_user
|
585
|
+
end
|
585
586
|
|
586
587
|
in_place_edit_field = changes.keys.first if changes.size == 1 && params[:render]
|
587
588
|
update_response(in_place_edit_field, options, &b)
|
data/lib/hobo/model.rb
CHANGED
@@ -34,6 +34,8 @@ module Hobo
|
|
34
34
|
|
35
35
|
alias_method_chain :has_one, :new_method
|
36
36
|
|
37
|
+
# eval avoids the ruby 1.9.2 "super from singleton method ..." error
|
38
|
+
eval %(
|
37
39
|
def inherited(klass)
|
38
40
|
super
|
39
41
|
fields(false) do
|
@@ -41,6 +43,7 @@ module Hobo
|
|
41
43
|
field(klass.inheritance_column, :string)
|
42
44
|
end
|
43
45
|
end
|
46
|
+
)
|
44
47
|
end
|
45
48
|
|
46
49
|
base.fields(false) # force hobo_fields to load
|
@@ -56,14 +56,15 @@ module Hobo
|
|
56
56
|
|
57
57
|
end
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
context =
|
59
|
+
# eval avoids the ruby 1.9.2 "super from singleton method ..." error
|
60
|
+
eval %(
|
61
|
+
def valid?(context=nil)
|
62
|
+
if context.nil? && self.class.has_lifecycle? && (step = lifecycle.active_step)
|
63
|
+
context = step.name
|
64
|
+
end
|
65
|
+
super(context)
|
63
66
|
end
|
64
|
-
|
65
|
-
end
|
66
|
-
|
67
|
+
)
|
67
68
|
|
68
69
|
def lifecycle
|
69
70
|
@lifecycle ||= if self.class.const_defined?(:Lifecycle)
|
@@ -310,6 +310,16 @@ module Hobo
|
|
310
310
|
|
311
311
|
|
312
312
|
when "include"
|
313
|
+
# DEPRECATED: it clashes with Module.include when called on an ActiveRecord::Relation
|
314
|
+
# after a scope chain, if you didn't call it on the class itself first
|
315
|
+
Rails.logger.warn "Automatic scope :include has been deprecated: use :including instead."
|
316
|
+
return true if check_only
|
317
|
+
|
318
|
+
def_scope do |inclusions|
|
319
|
+
@klass.includes(inclusions)
|
320
|
+
end
|
321
|
+
|
322
|
+
when "including"
|
313
323
|
return true if check_only
|
314
324
|
|
315
325
|
def_scope do |inclusions|
|
@@ -25,7 +25,7 @@ module Hobo
|
|
25
25
|
|
26
26
|
setter :children, [] do |*args|
|
27
27
|
# Setting children also gives a default parent using the reverse association
|
28
|
-
child_model = model.
|
28
|
+
child_model = model.reflect_on_association(args.first).klass
|
29
29
|
if child_model.view_hints.parent.nil? and !child_model.view_hints.parent_defined
|
30
30
|
parent = model.reverse_reflection(args.first)
|
31
31
|
child_model.view_hints.parent(parent.name, :undefined => true) if parent
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hobo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: -
|
4
|
+
hash: -1637108444
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 3
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 1.3.0.
|
10
|
+
- pre22
|
11
|
+
version: 1.3.0.pre22
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Tom Locke
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-11-
|
19
|
+
date: 2010-11-27 00:00:00 -04:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -59,13 +59,13 @@ dependencies:
|
|
59
59
|
requirements:
|
60
60
|
- - "="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
hash: -
|
62
|
+
hash: -1637108444
|
63
63
|
segments:
|
64
64
|
- 1
|
65
65
|
- 3
|
66
66
|
- 0
|
67
|
-
-
|
68
|
-
version: 1.3.0.
|
67
|
+
- pre22
|
68
|
+
version: 1.3.0.pre22
|
69
69
|
type: :runtime
|
70
70
|
version_requirements: *id003
|
71
71
|
- !ruby/object:Gem::Dependency
|
@@ -76,13 +76,13 @@ dependencies:
|
|
76
76
|
requirements:
|
77
77
|
- - "="
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
hash: -
|
79
|
+
hash: -1637108444
|
80
80
|
segments:
|
81
81
|
- 1
|
82
82
|
- 3
|
83
83
|
- 0
|
84
|
-
-
|
85
|
-
version: 1.3.0.
|
84
|
+
- pre22
|
85
|
+
version: 1.3.0.pre22
|
86
86
|
type: :runtime
|
87
87
|
version_requirements: *id004
|
88
88
|
- !ruby/object:Gem::Dependency
|
@@ -93,13 +93,13 @@ dependencies:
|
|
93
93
|
requirements:
|
94
94
|
- - "="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
hash: -
|
96
|
+
hash: -1637108444
|
97
97
|
segments:
|
98
98
|
- 1
|
99
99
|
- 3
|
100
100
|
- 0
|
101
|
-
-
|
102
|
-
version: 1.3.0.
|
101
|
+
- pre22
|
102
|
+
version: 1.3.0.pre22
|
103
103
|
type: :runtime
|
104
104
|
version_requirements: *id005
|
105
105
|
- !ruby/object:Gem::Dependency
|