Download an image file using wget

wget -O filename.png “http://some.url/folder/some_image.png” And to upload the same file using Capistrano: task :something do put File.read(“filename.png”), “#{deploy_to}/remote_filename.png” end

Using named routes in Streamlined addition files

For you Streamlined users out there, here’s an easy way to include named routes in your Streamlined addition modules. Previously, you had to hard code the URLs like so: module OrderAdditions def name_link link_to user.name, “/users/show/#{user.id}” end end Order.class_eval do include OrderAdditions include ActionView::Helpers::UrlHelper include ActionView::Helpers::TagHelper end Streamlined.ui_for(Order) do list_columns … Continue reading

Add layout checking to test_spec_on_rails

test_spec_on_rails is a plugin that adds Rails-specific assertions to test_spec, allowing you to do nifty things like this: it “should render with foo template” do get :some_action template.should.be “foo” # equivalent to assert_equal “foo”, @response.template end it “should display foo on page” do get :some_action page.should.select “p”, “foo” # equivalent … Continue reading