Neetin Kumar
2008-Sep-26 16:51 UTC
undefined method `table_name'' for REXML::Comment:Class
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....
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Sep-26 17:13 UTC
Re: undefined method `table_name'' for REXML::Comment:Class
On Sep 26, 5:51 pm, Neetin Kumar <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> 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> 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.... > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Neetin Kumar
2008-Sep-29 07:20 UTC
Re: undefined method `table_name'' for REXML::Comment:Class
Frederick Cheung wrote:> On Sep 26, 5:51�pm, Neetin Kumar <rails-mailing-l...-ARtvInVfO7m5VldFQK4jKA@public.gmane.orgt> > 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 > > Fredthank''s a lot it solved my problem -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---