Closed s-ashwinkumar closed 8 years ago
Rails 3.2 applications require rake > 0.8.7 so whatever change is made needs to be compatible across versions:
Array.wrap(Rake.application.instance_variable_get(:@scope).dup).push(name).join(':')
May want to make that a bit more readable.
@wingrunr21 Rake.application.instance_variable_get(:@scope).dup
this will throw an error with the newer rakes . The variable @scope
is not an array there. I guess the dup method needs to come out of the Array.wrap
.
dup
is a method on Object
. Nearly any object in Ruby can be dupped. Are you sure it isn't push
that is causing the exception?
The other option is that @scope is nil in newer Rakes and as such dup
will fail.
Yup that was mistyped. Its push where we have error. Have used to_a
above since Array.wrap
wont do the job. EX :
(rdb:1) Array.wrap(Rake.application.instance_variable_get(:@scope).dup) -----> [LL("db")]
(rdb:1) Array.wrap(Rake.application.instance_variable_get(:@scope).dup).push(name).join(':') -----> "LL(db):create"
(rdb:1) Rake.application.instance_variable_get(:@scope).dup.to_a ----> ["db"]
(rdb:1) Rake.application.instance_variable_get(:@scope).dup.to_a.push(name).join(':') ---> "db:create"
Need to polish it to support old ones as well.
Closing this issue. Fixed in master branch.
Rails 3.2 applications use rake 10.x and hence issue with https://github.com/customink/secondbase/blob/rails32_compatible/lib/secondbase/rake_method_chain.rb#L19
Need to update the gem to use newer version of rake and for newer version of rake this line has to be changed to
Rake.application.instance_variable_get(:@scope).to_a.dup.push(name).join(':')