...to Cucumber that helps integration-testing command line tools. When your tests involve a Rails test application, your tool's Bundler environment will shadow that of the test application. To...

...param is a string and you don't get the magic type casting that Rails would give you if it was an actual database column. E.g. when you set an...

...param is a string and you don't get the magic type casting that Rails would give you if it was an actual database column. One effect is that when...

Submit buttons in Rails come with a useful option :disable_with which will disable the button when clicked and change its label to something like "Please wait...". An annoying side...

...is to re-enable the submit button before leaving the page. This works in Rails 3: $(window).unload(function() { $.rails.enableFormElements($($.rails.formSubmitSelector...

...just upgraded to Bundler 10.0.10 you might get the following error when bringing up Rails: /usr/lib/ruby/1.9.1/psych.rb:148:in `parse': couldn't parse YAML at line 17 column 14 (Psych::SyntaxError...

...This is caused by Rails localization files (en.yml, de.yml, etc.) using symbols for various translation strings, and Bundler 10.0.10 defaults to a new YAML engine which cannot handle symbols.

stackoverflow.com

...a low-level Ruby message like Fix: "undefined method `bytesize' for #" or the standard Rails error box. You will not get an exception notification per e-mail or Airbrake.

island94.org

GoodJob is a new background worker gem. It's compatible with ActiveJob. We're huge fans of Sidekiq for its...

github.com

Leads to awesomeness and unicorns when used in production.

ActiveSupport::Memoizable will be removed from Rails and has a lot of strange caveats that will ruin your day. Use the Memoizer gem instead. It works in all past and...

...future Railses and has none of the annoying "features" of ActiveSupport::Memoizable. It just does memoization and does it well. The syntax is similiar also: class Foo include Memoizer

makandra dev
github.com

...x versions of Capybara does not support Ruby 1.8.x anymore removes confusion with Rails' built in integration tests (you put capybara rspec integration tests into the spec/feature/... folder) and...

Once Rails knows a given string is html_safe, it will never escape it. However, there may be times when you still need to escape it. Examples are some safe...

...to turn your string into an unsafe string to get the escaping love from Rails: embed = javascript_tag('var foo = 1337;') # This is an html_safe SafeBuffer embed.to_str # This...

makandra dev

...want to uninstall newer ones): bundle _1.0.10_ -v Bundler version 1.0.10 An example is rails 3.2, which freezes bundler at version ~> 1.0: Bundler could not find compatible versions for gem...

In Gemfile: rails (~> 3.2) was resolved to 3.2.0, which depends on bundler (~> 1.0) Current Bundler version: bundler (1.13.6) You can solve this with: gem install bundler -v 1.0.10

...some actions protected by SSL, some not. A popular way to implement this in Rails is using the ssl_requirement plugin by DHH, which redirects a requests from HTTP to...

...to append filepaths to it. With this method, Ruby code can look like this: Rails.root/"features"/"fixtures"/"picture.jpg" Alternatively you can use the #join method, which feels less magic: Rails.root.join...

...While in_groups and in_groups_of are provided by Rails this also works in pure Ruby. If it does not for you, require 'enumerator...

stackoverflow.com

From Rails 3.0.9, there is a method Hash#to_query that will turn a Hash into a query string: >> {:a => "a", :b => ["c", "d", "e"]}.to_query

...or from the public folder with javascript_include_tag. The subtle difference that tells rails how to build the path correctly is a single slash at the beginning of the...

...stylesheet in /assets you need to add it to the list of assets that Rails will precompile...

...files at once. To activate this feature, set the multiple attribute: Or in a Rails view: <%= file_field_tag "images[]", multiple: true %> This works in IE10+. Make sure that the...

...incoming files into an array. Obviously this naming convention is not compatible with default Rails nested attribute setters, so you'll need to write a form model to adapt...

makandra dev
rakeroutes.com

...print, if present requires interactive_editor, if present (basically makes vim available) loads .irbrc_rails if in Rails (e.g. for the Rails console) .irbrc_rails defines efind(email), which is...

...to find users by email requires hirb, if present set the prompt to your Rails app's name Of course you can put anything into these files...

...code below is a rough equivalent to the simple_format helper that ships with Rails: function simpleFormat(str) { str = str.replace(/\r\n?/, "\n"); str = $.trim(str); if (str.length > 0) {

...str.replace(/\n\n+/g, ' '); str = str.replace(/\n/g, ' '); str = ' ' + str + ' '; } return str; } Unlike the Rails helper, this does not preserve whitespace. You probably don't care...

I got these warnings while deploying a Rails 3.2 app with asset pipeline enabled: *** [err :: host.tld] find: `/opt/www/hollyapp.com/releases/20120503115342/public/images': No such file or directory *** [err :: host.tld] find: `/opt/www/hollyapp.com/releases/20120503115342/public/stylesheets': No such file...

...fix this issue. This patch is planned to be included in the next makandra Rails LTS release...

...route that only responds to a given format, here is how you do it: Rails 3 match 'sitemap.xml' => 'feeds#sitemap', :constraints => { :format => 'xml' }, :as => 'sitemap' Rails 2 map.sitemap 'sitemap.xml', :controller...

If you have the following deprecation warning after upgrading to rails >= 2.3.10 DEPRECATION WARNING: The :overwrite_params option is deprecated. Specify all the necessary parameters instead. that is for example...