Welcome to Working With Rails

 

Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
how to get embeded tag element in the text area
4 Posts
how to get embeded tag element in the text area

Hi..

to convert string to xml

you can use REXML.

REXML - http://www.germane-software.com/software/rexml/docs/tutorial.html

like

temp_hash = Hash.new string_val = "MyTitlehello..How are you?? "

xml_val = REXML::Document.new string_val

xml_val.root.each do |doc| temp_hash[doc.name.to_s] = doc.text end

OUTPUT of temp_hash will be like :

temp_hash => {"title"=>"MyTitle", "description"=>"hello..How are you?? "}

I hope it will be helpful for you.

Good Luck ;)

-Ganesh K

Person
Jruby, Ruby, Rails Programmer
Sign In To Rate Post

HI, I cant create indivual tags into db .I have to copy whole tags in signle column. So that how can we get tags from string

Person
Forum Rating: 50
Sign In To Rate Post

Judging from your code, the only thing that changes are the youtube path, and the dimensions. I recommend having a field in the database for each of those, and have the tags required to show it in the view. Then populate the width, height and src using erb tags in that view.

If you really need to save the html as is, I suggest converting the < > to < and > respectively, then when you output the textarea on the page, wrap it in your own method to replace those with the html tags. Put this in your application_helpers file:

https://gist.github.com/728563 Then in the view, simply call it:

Hi , Am saving video embeded code into db my using textarea. Am copying video code into text area.before submitting from am doing validations.Here how to get the embeded tag width and height

Please this link to view my code http://railsforum.com/viewtopic.php?id=41824 It's very urgent please help me

Person
Forum Rating: 50
Sign In To Rate Post
4 Posts
Login to add your message