Notes posted by amasses
RSS feedRemoved in 3.1.x
This method (and #auto_link_urls) has been removed in Rails 3.1 - other options are out there, such as Rinku, however there is a gem you can use for migration purposes etc, which is rails_autolink: http://rubygems.org/gems/rails_autolink
Does not work for has_one associations
If you are using this to validate that a has_one association has been made with another object this will not work, as the test used in the AssociatedValidator #validates_each method tests for nil and then ignores this object.
To test for association with a has_one association you can use the following code:
validate do [:teacher, :book].each do |attr| errors.add(attr, "is required") if self.send(attr).nil? end end
HTML5 support
To support multiple file selection simply pass :multiple => true in the options hash:
file_field_tag 'file', :accept => 'image/jpeg', :multiple => true
Changes self
This method changes the object/array the method is called on. For example:
a = ["a", "b", "c"] b = ["x", "y", "z"] a.concat(b) #=> [a", "b", "c", "z", "y", "z"] a #=> [a", "b", "c", "z", "y", "z"]
In this example the object A is modified, the method modifies the object, then returns the new object.