aniltimt / substruct

Automatically exported from code.google.com/p/substruct
http://code.google.com/p/substruct
6 stars 0 forks source link

Module::substruct_deprecate method not included for rake tasks environment #110

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create rake task with model class that uses substruct_deprecate, for example 
Product.new
2. Execute it from console

What is the expected output? What do you see instead?
undefined method `substruct_deprecate' for #<Class:0x24b7ab0>
/Users/gmiklaszewski/Documents/AGH/MGR/Aplikacja/chatbot/substruct/vendor/rails/
activere
cord/lib/active_record/base.rb:1532:in `method_missing_without_paginate'
/Users/gmiklaszewski/Documents/AGH/MGR/Aplikacja/chatbot/substruct/vendor/plugin
s/will_
paginate/lib/will_paginate/finder.rb:82:in `method_missing'
/Users/gmiklaszewski/Documents/AGH/MGR/Aplikacja/chatbot/substruct/vendor/plugin
s/subs
truct/app/models/product.rb:91
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in 
`gem_original_require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
/Users/gmiklaszewski/Documents/AGH/MGR/Aplikacja/chatbot/substruct/vendor/rails/
activesu
pport/lib/active_support/dependencies.rb:496:in `require'
/Users/gmiklaszewski/Documents/AGH/MGR/Aplikacja/chatbot/substruct/vendor/rails/
activesu
pport/lib/active_support/dependencies.rb:342:in `new_constants_in'
/Users/gmiklaszewski/Documents/AGH/MGR/Aplikacja/chatbot/substruct/vendor/rails/
activesu
pport/lib/active_support/dependencies.rb:496:in `require'
/Users/gmiklaszewski/Documents/AGH/MGR/Aplikacja/chatbot/substruct/vendor/rails/
activesu
pport/lib/active_support/dependencies.rb:104:in 
`require_or_load_without_engine_additions'
/Users/gmiklaszewski/Documents/AGH/MGR/Aplikacja/chatbot/substruct/vendor/plugin
s/engi
nes/lib/engines/rails_extensions/dependencies.rb:139:in `require_or_load'
/Users/gmiklaszewski/Documents/AGH/MGR/Aplikacja/chatbot/substruct/vendor/rails/
activesu
pport/lib/active_support/dependencies.rb:60:in `depend_on'
/Users/gmiklaszewski/Documents/AGH/MGR/Aplikacja/chatbot/substruct/vendor/rails/
activesu
pport/lib/active_support/dependencies.rb:442:in `require_dependency'
/Users/gmiklaszewski/Documents/AGH/MGR/Aplikacja/chatbot/substruct/app/models/pr
oduct
.rb:1
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in 
`gem_original_require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
/Users/gmiklaszewski/Documents/AGH/MGR/Aplikacja/chatbot/substruct/vendor/rails/
activesu
pport/lib/active_support/dependencies.rb:496:in `require'
/Users/gmiklaszewski/Documents/AGH/MGR/Aplikacja/chatbot/substruct/vendor/rails/
activesu
pport/lib/active_support/dependencies.rb:342:in `new_constants_in'
/Users/gmiklaszewski/Documents/AGH/MGR/Aplikacja/chatbot/substruct/vendor/rails/
activesu
pport/lib/active_support/dependencies.rb:496:in `require'
/Users/gmiklaszewski/Documents/AGH/MGR/Aplikacja/chatbot/substruct/vendor/rails/
activesu
pport/lib/active_support/dependencies.rb:104:in 
`require_or_load_without_engine_additions'
/Users/gmiklaszewski/Documents/AGH/MGR/Aplikacja/chatbot/substruct/vendor/plugin
s/engi
nes/lib/engines/rails_extensions/dependencies.rb:139:in `require_or_load'
/Users/gmiklaszewski/Documents/AGH/MGR/Aplikacja/chatbot/substruct/vendor/rails/
activesu
pport/lib/active_support/dependencies.rb:248:in `load_missing_constant'
/Users/gmiklaszewski/Documents/AGH/MGR/Aplikacja/chatbot/substruct/vendor/rails/
activesu
pport/lib/active_support/dependencies.rb:453:in `const_missing'
/Users/gmiklaszewski/Documents/AGH/MGR/Aplikacja/chatbot/substruct/vendor/rails/
activesu
pport/lib/active_support/dependencies.rb:465:in `const_missing'
/Users/gmiklaszewski/Documents/AGH/MGR/Aplikacja/chatbot/substruct/lib/tasks/cha
tbot.rak
e:56
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in `call'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in `execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in `execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:508:in 
`invoke_with_call_chain'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in 
`invoke_with_call_chain'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:494:in `invoke'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1931:in `invoke_task'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in 
`standard_exception_handling'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1903:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1881:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in 
`standard_exception_handling'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1878:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/bin/rake:31
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19

What version of the product are you using? On what operating system?
Substruct                       1.0.a3
Ruby version                    1.8.6 (2008-03-03 patchlevel 114) 
RubyGems version    1.2.0
Rails version                   2.0.2
System                            Leopard 10.5.4

Please provide any additional information below.
Substruct_deprecated.rb file is included in SubstructApplicationController 
which is next included in ApplicationController. ApplicationController 
is not loaded with environment for rake tasks, that's why the error occurs. Im 
my opinion it 
should be included in environment.rb.

Original issue reported on code.google.com by GMiklasz...@gmail.com on 19 Jul 2008 at 9:17

GoogleCodeExporter commented 8 years ago
SubstructApplicationController is a module, which is specifically meant for the
ApplicationController usage. Don't quote me on this but I believe you can't 
include
modules in environment.rb, only classes.

That being said, if you want the functions available to your rakefile, include 
them
in your rakefile or other applicable place. Not sure this is a bug worth fixing.

Original comment by subim...@gmail.com on 16 Aug 2008 at 3:48