Use the htmlentities gem. Encoding works like this: require 'htmlentities' coder = HTMLEntities.new string = "<élan>" coder.encode(string) # => "<élan>"
When rendering a partial with the :collection option, you are automatically provided with a counter variable inside the partial template...
This step tests whether a given select option comes preselected in the HTML. There is another step to test that...
Regular spaces and non-breaking spaces are hard to distinguish for a human. Instead of using the HTML entity...
If a controller action responds to other formats than HTML (XML, PDF, Excel, JSON, ...), you can reach that code in...
Sometimes the order in which strings appear on a page matters to you. Spreewald gives you steps like these:
If you have several submit elements (inputs or buttons with type="submit") that each cause different things to happen (e.g...
This will show you how to create a RSS feed that the Feed Validator considers valid. Note that RSS is...
WMD is a simple, lightweight HTML editor for blog comments, forum posts, and basic content management. You can add WMD...
There are two distinct ways of commenting Haml markup: HTML and Ruby. HTML comments This will create an HTML comment...
To return non-HTML responses (like XLS spreadsheets), we usually use the respond_to do |format| format.xls do # send spreadsheet...
One option is to use partials. Or you can set the @template field to the name of another action:
Sometimes files attain executable-flags that they do not need, e.g. when your Windows VM copies them over a Samba...
You can write regular expressions some different ways, e.g. /regex/ and %r{regex}. For examples, look here. Remember that it...
jamesgolick / resource_controller at Github module ResourceController module Actions def index load_collection before :index response_for :index end
tinyMCE.activeEditor.getContent()
Most of these will not work in newer projects because these use the Capybara/Rack::Test combo in lieu of Webrat...
With defaults, RCov doesn't work the way you how you would like it to. To create a nice test...
To parse XML-documents, I recommend the gem nokogiri. A few hints: xml = Nokogiri::XML(" foo bar ") parses an xml...
This is about converting Haml to ERB and not the other way round which you probably want! This process can...
tmp/* storage/* db/*.sqlite3 db/schema.rb db/structure.sql public/system .project .idea/ public/javascripts/all* public/stylesheets/all* public/stylesheets/*.css config/database.yml *~ *#* .#* .DS_Store webrat-*.html
Given a list of acceptable elements and attributes, Sanitize will remove all unacceptable HTML from a string.
Until some future version of HTML gives us new native controls to use in a browser, at Google, we’ve...