jackdempsey / acts_as_commentable

The ActiveRecord acts_as_commentable plugin
http://juixe.com/svn/acts_as_commentable/
MIT License
833 stars 177 forks source link

undefined method `quoted_table_name' for REXML::Comment:Class #7

Closed wiemann closed 14 years ago

wiemann commented 14 years ago

Has anybody seen this issue in the newest version in Rails 2.3.5?

NoMethodError: undefined method `quoted_table_name' for REXML::Comment:Class

jackdempsey commented 14 years ago

haven't seen that myself, but will try to take a look later today.

jackdempsey commented 14 years ago

Closing. If anyone can verify please reopen.

GauravShetty1016 commented 13 years ago

Hi, I am facing the issue too. Only in production environment. Works fine in development.

jackdempsey commented 13 years ago

Hi Gaurav,

What version of the gem are you using? There's one for Rails 3 and Rails 2.3.x.

GauravShetty1016 commented 13 years ago

Sorry for the lack of info.. typed it just as i was rushing out. I am using rails 2.3.5. I followed the instructions on the website and it works great on development mode. But yesterday i tried it in production for the first time and it gave this error while trying to display the list of comments associated with a particular model.

The code i was using was straightforward <%@model.comments.each do |comment| %> display code <%end%>

the error was being thrown by the first line as i commented all the display code and checked. Any help is appreciated.

jackdempsey commented 13 years ago

Hey Gaurav,

Sounds like the classes are getting confused somehow between REXML::Comment and top level Comment. Are you using that inside a .xml file?

GauravShetty1016 commented 13 years ago

Hi Jack,

No, I am not using XML anywhere in my project.

jackdempsey commented 13 years ago

Gaurav,

Can you give me some more info:

It's a bit of a challenge for me to figure out what might be going on without seeing it myself, so the more info the more likely I can help.

Thanks.

jackdempsey commented 13 years ago

Gaurav,

I created a 2.3.5 app with the 2.1.1 version of aac and everything works fine in console in production mode. I have to guess that perhaps you're using a later version?

If you want to take a look, I put the app up here: http://github.com/jackdempsey/aac_test

GauravShetty1016 commented 13 years ago

thanks for the quick replies Jack. I am using the plugin. I installed the correct version as per the instructions i the readme file for 2.3.x. Thanks for the tip about testing in console in dev and production. In production mode i get the error when i try to access Model.comments and in development console i do not get the error. I will take a look at the test app that you have put up to see what differences in implementation are there. Once again thanks a lot for the help

GauravShetty1016 commented 13 years ago

If its nay help i am working in windows environment. And this is the error i get in console in production mode

NoMethodError: undefined method quoted_table_name' for REXML::Comment:Class from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record /reflection.rb:187:inquoted_table_name' from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record /associations/has_many_association.rb:92:in construct_sql' from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record /associations/association_collection.rb:21:ininitialize' from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record /associations.rb:1300:in new' from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record /associations.rb:1300:incomments' from (irb):4

jackdempsey commented 13 years ago

Ahh...Yes, that piece of info helps :-)

This might end up being a windows issue. Try to replicate it in a fork of the aac_test project and I'll see if I can reproduce on os x. If I can't, we might get stuck real soon...

GauravShetty1016 commented 13 years ago

Ok, i just updated a linux machine with my project and tried to run it in production mode. Same error. So i dont think its a OS issue. I noticed that the sample was using the gem. I am using the plugin in the project. Some issue with that?

jackdempsey commented 13 years ago

I'm not sure. Have you tried using it as a gem? That's more the standard/suggested way these days anyway. Give it a go and see what happens.

GauravShetty1016 commented 13 years ago

Hi jack, We finally reached a stage in our project where fixing the comments module was a must do and i took a hard look at our project code and found that a plugin provided by a third party was actually using REXML and had included the rexml module to get out of appending REXML:: to method calls. This was polluting the top level namespace so you were right all along. Thank you so much for all your help and for the wonderful plugin.

jackdempsey commented 13 years ago

Hey Gaurav,

Glad you tracked it down! Can definitely be frustrating when things are mixed in without your knowledge. Good tracking and glad everything's better on your end now.

best, jack