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
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
One question that seems to come up a lot on the Streamlined mailing list is how best to filter the records that are displayed in the list view using a certain set of conditions. There are several ways of doing this, but the simplest way is to use Rails’ built-in … Continue reading
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
After contacting Rick with my patch, he offered to give me commit access to the project. I took him up on the offer, so the layout assertion is now in there. test_spec_on_rails is now on Git so unless you’re running Edge Rails you can’t use script/install to grab it. My … Continue reading
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
I’ve been using the excellent fixture_replacement plugin for several months now and greatly prefer it over traditional fixtures (yes, even foxy fixtures). fixture_replacement2 adds even more goodness to the party. However, I ran into a problem today when trying to use default_xxx methods in my example_data.rb file: module FixtureReplacement attributes_for … Continue reading
I’ve been futzing with the goodness that is Merb lately. It’s nifty. Really nifty. The documentation is pretty rough though. I’ll be posting some of my discoveries here. Maybe it will help someone who, like me, was a tad lost early on. One of the first things that confused me … Continue reading
The Rails PDF plugin is a dandy little thing. It wraps the PDF::Writer library for Ruby, allowing PDF templates to be defined like any other Rails view (with a .rpdf extension, of course). One thing it doesn’t do is allow access to the parent controller’s helper from within a PDF … Continue reading
So you’re savvy with flexmock, a fine Rails plugin that lets you create mock objects in your tests. You’ve been coding up a boatload of fine tests that are elegant in their isolation thanks to your super mocks. They all run fine, but they’re kind of slow so you go … Continue reading
Are you fairly new to Ruby programming? Do you want to learn more about how Ruby can be used as the “glue” to script various libraries into harmonious cooperation? Look no further… InfoQ recently published an article I wrote last year about how to automate file uploads to a web … Continue reading