Articles

CSV views with FasterCSV and csv_builder

We were asked to add a "Download as CSV" link to the top of each of our reporting actions. We already had a "revenue_report" controller-action with it's own html view template... and just wanted to add something similar in CSV.

FasterCSV seemed to provide some great CSV-generation functionality...

Pro Git Book

For about the last 8 months, I’ve been working on a side project. In November, Apress contacted me about writing a book about Git and I thought it would be a good idea. I may have slightly underestimated the amount of work that it would take, but a few days ago I put the content of the book online under a Creative Commons noncommercial 3.0 license. The book is titled “Pro Git” and you can read it or reference it online at http://progit.org.

Ruby on Rails įdiegimas Mac OS X sistemose

Leopard (10.5)

Ruby (1.8.6), Ruby Gems (1.0.1) ir Rails (1.2.3) ateina kartu su vėliausia OS X versija (10.5, Leopard).

Siūlau iš karto atsinaujinti Rails į vėliausią versiją. Versija, kuri ateina kartu su OS X yra ganėtinai sena (kalbant Rails programavimo terminais).

JRuby’s Future at Engine Yard

By now you’ve heard the news: Tom Enebo, Nick Sieger and I will be joining the Engine Yard team to work on JRuby! We’re very excited about this opportunity and we’re looking forward to a bright future for JRuby and the community.

Turbocharge Your Ruby Testing with Parallel Specs

bearonshark.pngIn Make Your Test Suite UNCOMFORTABLY FAST! (called "the best blog post ever written" by one commenter) Jason Morrison of Thoughtbot demonstrates how to use Michael Grosser's Parallel Specs project to speed up your

Robert Dempsey Wants an Agile Coaching Job in San Fran

 Robert Dempsey Wants an Agile Coaching Job in San Fran

Yesterday I announced that

On JRuby’s importance for the future of Ruby

In a recent blog entry, Charles Nutter argues about the importance of JRuby for Ruby’s adoption within the Enterprise. Or, in his own words:

Key-Value Stores in Ruby

Key-value stores have emerged in the last few years as an alternative to relational database management systems for some data storage tasks. SimpleDB, BigTable, and Tokyo are just three of the variants. So what are they? How are they different than relational databases? And when should you use them?

Double Shot #505

Looks like my August hours may be starting to fill out. That was a bit too close for comfort.

rails gotchas: undefined method `expects'

If you've just installed rails edge and run the tests, they may fail with:
NoMethodError: undefined method `expects' for ... etc etc over and over again (along with a few other errors).
Install the mocha gem via rubygems to get rid of a lot of these errors.
It was the line NoMethodError: undefined method `stub' for ...

How to call a controller's action from a different controller | Rails Fire

How to call a controller's action from a different controller

We come up with this solution after a couple of failing attempt to find a way to emulate a redirect_to method without actually create a 302 HTTP message which need to be sent to the user and then back to the application.

By using this internal_redirect_to function you will be able to get the same results as a normal redirect_to without send anything to the user, only keep in mind to explicit invoke the return after this function.


def internal_redirect_to (options={})
    params.merge!(options)
    (c = ActionController.const_get(Inflector.classify("#{params[:controller]}_controller")).new).process(request,response)
    c.instance_variables.each{|v| self.instance_variable_set(v,c.instance_variable_get(v))} 
end

Note: this function must be placed inside the calling controller.

Then you can simply invoke this function by typing:


MasterController < ApplicationController
  def index
    internal_redirect_to :controller=>'another', :action=>'an_action'
   return 
  end
end

Sandro