# Undefined method \`table\_name' for REXML::Comment:Class

**URL:** <https://www.ruby-forum.com/t/undefined-method-table-name-for-rexml-class/149612>\
**Category:** Rails\
**Created:** [September 26, 2008, 6:51pm UTC](https://www.ruby-forum.com/t/undefined-method-table-name-for-rexml-class/149612 "2008-09-26T18:51:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![neetinforum](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/779978/32.png) [@neetinforum](https://www.ruby-forum.com/u/neetinforum)\
**Post date:** [September 26, 2008, 6:51pm UTC](https://www.ruby-forum.com/t/undefined-method-table-name-for-rexml-class/149612/1 "2008-09-26T18:51:07Z")

</div>

i am using rexml and try to find id from Comment table i got the error

my code is like this…

XPath.each(new\_article, ‘comments’) do |comments|  
XPath.each(comments, ‘comment’) do |new\_comment|  
c\_oldid =  
XmlMigratedData.find(:first,:conditions=\>[“model\_type=? and  
ext\_id=?”,“Comment”,new\_comment.attribute(‘id’).to\_s])  
if c\_oldid !=nil  
debugger  
@comment=Comment.find(c\_oldid.int\_id)  
@comment.update\_attributes(:article\_id=\>article.id) if  
@comment  
else  
logger.error("#{comment.attribute(‘id’).to\_s} for  
#{old\_id}")  
end  
end  
end

/usr/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/runner.rb:47:  
undefined method `find’ for REXML::Comment:Class (NoMethodError)

Suggest me…

---

<div class="post-metadata">

**Author:** ![neetinforum](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/779978/32.png) [@neetinforum](https://www.ruby-forum.com/u/neetinforum)\
**Post date:** [September 26, 2008, 8:05pm UTC](https://www.ruby-forum.com/t/undefined-method-table-name-for-rexml-class/149612/2 "2008-09-26T20:05:09Z")

</div>

On Sep 26, 5:51 pm, Neetin K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> i am using rexml and try to find id from Comment table i got the error

Rexml’s Comment class is shadowing your own. Either don’t include  
REXML in the model that is doing this processing (so you’ll need to  
prefix rexml classes with REXML:🙂 or replace Comment with ::Comment

Fred

---

<div class="post-metadata">

**Author:** ![neetinforum](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/779978/32.png) [@neetinforum](https://www.ruby-forum.com/u/neetinforum)\
**Post date:** [September 29, 2008, 9:20am UTC](https://www.ruby-forum.com/t/undefined-method-table-name-for-rexml-class/149612/3 "2008-09-29T09:20:46Z")

</div>

Frederick C. wrote:

> On Sep 26, 5:51ï¿½pm, Neetin K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:
> 
> > i am using rexml and try to find id from Comment table i got the error
> 
> Rexml’s Comment class is shadowing your own. Either don’t include  
> REXML in the model that is doing this processing (so you’ll need to  
> prefix rexml classes with REXML:🙂 or replace Comment with ::Comment
> 
> Fred

thank’s a lot it solved my problem

---

<div class="post-metadata">

**Author:** ![neetinforum](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/779978/32.png) [@neetinforum](https://www.ruby-forum.com/u/neetinforum)\
**Post date:** [January 23, 2009, 5:42pm UTC](https://www.ruby-forum.com/t/undefined-method-table-name-for-rexml-class/149612/4 "2009-01-23T17:42:39Z")

</div>

Hi Neetin,

I would like to find out how you solved the problem with REXML’s  
comment overshadowing your own Comment model. I am not including REXML  
myself, but I assume that a part of Rails is doing so. How do I not  
include it then?

Thank you.

On Sep 29 2008, 3:20 pm, Neetin K. \<rails-mailing-l…@andreas-
