Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working for active_record 2.3.2 #1

Open
umaviswanathan opened this issue Aug 2, 2013 · 9 comments
Open

Not working for active_record 2.3.2 #1

umaviswanathan opened this issue Aug 2, 2013 · 9 comments

Comments

@umaviswanathan
Copy link

I have included this

sunspot_submodel_index :parent => :usage

in model file

while checking the page in browser I got this error

undefined method `class_attribute' for #Class:0xb60b4f30

/home/premedia/.rvm/gems/ruby-1.8.7-p370/gems/activerecord-2.3.2/lib/active_record/base.rb:1964:in method_missing_without_paginate' /home/premedia/.rvm/gems/ruby-1.8.7-p370/gems/will_paginate-2.3.16/lib/will_paginate/finder.rb:170:inmethod_missing'
/home/premedia/.rvm/gems/ruby-1.8.7-p370/gems/sunspot_submodel_index-0.0.4/lib/sunspot_submodel_index/submodel_index.rb:33:in sunspot_submodel_index' /home/premedia/Desktop/prepress/app/models/request.rb:23 /home/premedia/Desktop/prepress/app/views/projects/index.html.erb:42:in_run_erb_app47views47projects47index46html46erb'
/home/premedia/Desktop/prepress/app/views/projects/index.html.erb:30:in each' /home/premedia/Desktop/prepress/app/views/projects/index.html.erb:30:in_run_erb_app47views47projects47index46html46erb'

can I get any help on this?

@swalterd
Copy link
Member

swalterd commented Aug 2, 2013

I looks like when I upgraded it to Rails 3 I used class_attribute to
replace class_inheritable_hash. Rails 3 deprecated class_inheritable_hash.
If you are locked on Rails 2.3 you can use try and use version 0.0.2
(before the change) or you can checkout the code and replace
class_attribute with class_inheritable_hash. I will also look at adding a
check for the rails version around it.

Scott

On Fri, Aug 2, 2013 at 7:48 AM, umaviswanathan [email protected]:

I have included this

sunspot_submodel_index :parent => :usage

in model file

while checking the page in browser I got this error

undefined method `class_attribute' for #Class:0xb60b4f30

/home/premedia/.rvm/gems/ruby-1.8.7-p370/gems/activerecord-2.3.2/lib/active_record/base.rb:1964:in
method_missing_without_paginate'

/home/premedia/.rvm/gems/ruby-1.8.7-p370/gems/will_paginate-2.3.16/lib/will_paginate/finder.rb:170:in
method_missing'
/home/premedia/.rvm/gems/ruby-1.8.7-p370/gems/sunspot_submodel_index-0.0.4/lib/sunspot_submodel_index/submodel_index.rb:33:in
sunspot_submodel_index'
/home/premedia/Desktop/prepress/app/models/request.rb:23
/home/premedia/Desktop/prepress/app/views/projects/index.html.erb:42:in
_run_erb_app47views47projects47index46html46erb'
/home/premedia/Desktop/prepress/app/views/projects/index.html.erb:30:in
each'
/home/premedia/Desktop/prepress/app/views/projects/index.html.erb:30:in
_run_erb_app47views47projects47index46html46erb'

can I get any help on this?


Reply to this email directly or view it on GitHubhttps://github.com//issues/1
.

@umaviswanathan
Copy link
Author

Its working when I changed class_attribute to class_inheritable_hash in submodel_index.rb for sunspot_submodel_index 0.0.4 in rails 2.3.2

Thanks Scott

@swalterd
Copy link
Member

swalterd commented Aug 3, 2013

No problem.

On Friday, August 2, 2013, umaviswanathan wrote:

Its working when I changed class_attribute to class_inheritable_hash in
submodel_index.rb for sunspot_submodel_index 0.0.4 in rails 2.3.2

Thanks Scott


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-22049695
.

@umaviswanathan
Copy link
Author

HI Scott, can I fork the repository for this rails2 version .

@swalterd
Copy link
Member

swalterd commented Sep 4, 2013

Please do. It shouldn't be that big of a change. It will work with the
latest rails 2, but not the older ones.

Scott

On Wed, Sep 4, 2013 at 7:36 AM, umaviswanathan [email protected]:

HI Scott, can I fork the repository for this rails2 version .


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-23785599
.

@PBalraj
Copy link

PBalraj commented May 2, 2014

Hi,
Using Active Record 2.3.18, getting the issue as
undefined method `sunspot_submodel_index' for #Class:0xc394610.
Using sunspot_submodel_index version 0.0.2, still it contains the class_inheritable_hash

Any idea on this ?

@swalterd
Copy link
Member

swalterd commented May 6, 2014

@PBalraj 2.3.18 should have class_attribute to replace class_inheritable_hash. Try the latest version of sunspot_submodel_index and let me know. Also, if it still breaks please include the stack trace.

@PBalraj
Copy link

PBalraj commented May 6, 2014

Thanks for ur reply
Yes,
It still breaks at the latest version, while running sunspot reindex command

The trace below here for your reference

pandu@administrator-desktop:~/project$ bundle exec rake sunspot:solr:reindex[100,Project] --trace
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
DEPRECATION WARNING: Rake tasks in vendor/plugins/attribute_fu/tasks, vendor/plugins/enumerable_constants/tasks, and vendor/plugins/sunspot_autocomplete-master/tasks are deprecated. Use lib/tasks instead. (called from /home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rails-2.3.18/lib/tasks/rails.rb:10)
** Invoke sunspot:solr:reindex (first_time)
** Invoke sunspot:reindex (first_time)
** Invoke environment (first_time)
** Execute environment
NAMED SCOPE from 2.3.4
** Execute sunspot:reindex
rake aborted!
undefined method sunspot_submodel_index' for #<Class:0xb789014> /home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/activerecord-2.3.18/lib/active_record/base.rb:2002:inmethod_missing_without_paginate'
/home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/will_paginate-2.3.16/lib/will_paginate/finder.rb:170:in method_missing' /home/pandu/project/app/models/request.rb:22 /home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/activesupport-2.3.18/lib/active_support/dependencies.rb:406:inload_without_new_constant_marking'
/home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/activesupport-2.3.18/lib/active_support/dependencies.rb:406:in load_file' /home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/activesupport-2.3.18/lib/active_support/dependencies.rb:547:innew_constants_in'
/home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/activesupport-2.3.18/lib/active_support/dependencies.rb:405:in load_file' /home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/activesupport-2.3.18/lib/active_support/dependencies.rb:285:inrequire_or_load'
/home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/activesupport-2.3.18/lib/active_support/dependencies.rb:451:in load_missing_constant' /home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/activesupport-2.3.18/lib/active_support/dependencies.rb:106:inconst_missing'
/home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/activesupport-2.3.18/lib/active_support/dependencies.rb:118:in const_missing' /home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/activesupport-2.3.18/lib/active_support/inflector.rb:364:inconstantize'
/home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/activesupport-2.3.18/lib/active_support/inflector.rb:363:in each' /home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/activesupport-2.3.18/lib/active_support/inflector.rb:363:inconstantize'
/home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/activesupport-2.3.18/lib/active_support/core_ext/string/inflections.rb:162:in constantize' /home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/sunspot_rails-1.1.0/lib/sunspot/rails/tasks.rb:51 /home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/sunspot_rails-1.1.0/lib/sunspot/rails/tasks.rb:51:inmap'
/home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/sunspot_rails-1.1.0/lib/sunspot/rails/tasks.rb:51
/home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rake-0.9.2/lib/rake/task.rb:205:in call' /home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rake-0.9.2/lib/rake/task.rb:205:inexecute'
/home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rake-0.9.2/lib/rake/task.rb:200:in each' /home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rake-0.9.2/lib/rake/task.rb:200:inexecute'
/home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rake-0.9.2/lib/rake/task.rb:158:in invoke_with_call_chain' /home/pandu/.rvm/rubies/ree-1.8.7-2012.02/lib/ruby/1.8/monitor.rb:242:insynchronize'
/home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rake-0.9.2/lib/rake/task.rb:151:in invoke_with_call_chain' /home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rake-0.9.2/lib/rake/task.rb:176:ininvoke_prerequisites'
/home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rake-0.9.2/lib/rake/task.rb:174:in each' /home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rake-0.9.2/lib/rake/task.rb:174:ininvoke_prerequisites'
/home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rake-0.9.2/lib/rake/task.rb:157:in invoke_with_call_chain' /home/pandu/.rvm/rubies/ree-1.8.7-2012.02/lib/ruby/1.8/monitor.rb:242:insynchronize'
/home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rake-0.9.2/lib/rake/task.rb:151:in invoke_with_call_chain' /home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rake-0.9.2/lib/rake/task.rb:144:ininvoke'
/home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rake-0.9.2/lib/rake/application.rb:112:in invoke_task' /home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rake-0.9.2/lib/rake/application.rb:90:intop_level'
/home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rake-0.9.2/lib/rake/application.rb:90:in each' /home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rake-0.9.2/lib/rake/application.rb:90:intop_level'
/home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rake-0.9.2/lib/rake/application.rb:129:in standard_exception_handling' /home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rake-0.9.2/lib/rake/application.rb:84:intop_level'
/home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rake-0.9.2/lib/rake/application.rb:62:in run' /home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rake-0.9.2/lib/rake/application.rb:129:instandard_exception_handling'
/home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rake-0.9.2/lib/rake/application.rb:59:in run' /home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/gems/rake-0.9.2/bin/rake:32 /home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/bin/rake:19:inload'
/home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/bin/rake:19
/home/pandu/.rvm/gems/ree-1.8.7-2012.02@project-dev/bin/ruby_executable_hooks:15
Tasks: TOP => sunspot:solr:reindex => sunspot:reindex

@swalterd
Copy link
Member

swalterd commented May 9, 2014

If you are not getting a similar error when running your app from the rails server it may be a problem with the gem not getting required in Rake. You might want to write your own rake task to try and load the Active record you are trying to reindex and see if it can load. Remember to include your environment in the rake task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants