Use the htmlentities gem. Encoding works like this: require 'htmlentities' coder = HTMLEntities.new string = "<élan>" coder.encode(string) # => "<élan>"
Deadlocks only occur if two transactions in separate threads compete for the same rows in the database. They usually (but...
You can get YAML.load to instantiate any Ruby object by embedding the desired class name into the YAML code. E.g...
If your controller spec never reaches your controller code: Make sure you are signed in. Make sure you are actually...
When a has_many association basically serves to store a list of associated strings (tags, categories, ...), it can be convenient...
Have you guys ever done the math on that? You asked or allowed for 24000 interruptions from literally every human...
Note that this card is very old. You might want to use ActiveType for your auto-coerced virtual attributes instead...
E.g. when you're using a tagging gem, you have seen virtual attributes that get and set a string array...
Plugins (and gems) are typically tested using a complete sample rails application that lives in the spec folder of the...
This step tests whether a given select option comes preselected in the HTML. There is another step to test that...
This collection of Sass mixins enables cross-browser styling (including IE with CSS3PIE) with less lines of code.
There is a problem with AJAX response handling for Rails 3 remote links and forms in Internet Explorer. This problem...
For clarity and traceability, your commit messages should include the ID and title of the Pivotal Tracker story you're...
The following initializer provides an :alias => "my_route_name" option to restful routes in your route.rb. This simply makes the...
Regular spaces and non-breaking spaces are hard to distinguish for a human. Instead of using the HTML entity...
Use this scope: class Stick named_scope :shuffled, lambda { last_record = last { :conditions => [ 'id >= ?', rand(last_record.id) ] } if last_record }
Thanks to habits engrained by Rails 2’s link_to_remote and remote_form_for, we expect that Rails 3...
This note describes how to setup a box running Ubuntu to share its Internet connection with another PC.
CONCAT('foo', 'bar', NULL) = NULL the NULL always wins in MySQL. If you would rather treat NULL as...
If a controller action responds to other formats than HTML (XML, PDF, Excel, JSON, ...), you can reach that code in...
This returns the name (including path) of your current layout: response.layout => "layouts/admin" # inside views that are using the 'admin' layout...
You will need to upgrade to RSpec >= 2 and rspec-rails >= 2 for Rails 3. Here are some hints to...
In rare cases you might need something like form_for (for using form builder methods on the resulting block element...
When using form_for you can give the form's target URL either as a string or an array: