Making a form reset button in Rails

Rails doesn't have reset_tag to automatically make a form reset button, instead you have to take a slightly different route. To make a form reset button in Rails you simply do this:
[source:ruby]
< %= submit_tag("Start Over", { :name => 'reset', :id => 'reset_button', :type => "reset" }) %>
[/source]
which will create the following:
[source:html]

[/source]

Tags: 

Strip HTML in any string in Ruby

A little code snippet to let you remove HTML from any string in Ruby:
[source:ruby]
class String

# remove all HTML tags from the source string
def strip_html
self.gsub(/< \/?[^>]*>/, "")
end

end
[/source]
Then to run the code just do this:
[source:ruby]
blurb_html = "

Thanks for visiting our site.

"
blurb_text = blurb_html.strip_html
[/source]

Tags: 

Amazing PR thanks to Ryan Price

Mr Price, a well known figure in the Orlando, FL internet-savvy community, just promoted my search for employment on his community site's blog with many complimentary things to say. He also highlighted how through a limited amount of networking over the past year I've managed to gain a great deal number leads very quickly, which has just been an amazing experience - thanks to the feedback my family will be just fine.

Pages

Subscribe to Front page feed