[Rails] Re: Store XML format data into database
On Nov 4, 5:33 am, Preksha Patel <li...@ruby-forum.com> wrote:
> Hi,
>
> Thanks for the reply.. When I puts tag.children[9] like this:
>
> doc.xpath('//item').each do |tag|
> puts tag.children[9]
> @req = Hash.new
> @req = tag.children[9]
>
> detail.create(
> :my_field => tag.children[9]
> )
> end
>
> I am getting the whole XML Tag. But this tag is not saving into the
> database. It is saving like '--0 \n'. Is there any problem with my model
> or Datatype into the database??
>
I think you'll find that tag.children[9] is just an object
representing the node, which doesn't have much meaning without the
document it belongs to. You need to call something like to_s or to_xml
on it to turn it back into a string
Fred
> Thanks
>
> --
> 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@googlegroups.com.
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.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home