Right Traq Blog

Rails Subversion External Management with Piston

Posted by acts_as_flinn Sun, 04 Feb 2007 05:25:00 GMT

I’ve been mulling over the best way to manage the many plugins I use that have external svn repositories. Luckily Piston makes light work of vendor branch management in rails.

Piston Homepage

Here’s a rundown:


$ gem install --include-dependencies piston

$ cd $your_rails_project_cwd

$ piston convert
Importing 'http://svn.techno-weenie.net/projects/plugins/acts_as_versioned' to vendor/plugins/acts_as_versioned (-r 2691)
Exported r2691 from 'http://svn.techno-weenie.net/projects/plugins/acts_as_versioned' to 'vendor/plugins/acts_as_versioned'

...

$ svn proplist --verbose vendor/plugins/acts_as_versioned/
Properties on 'vendor/plugins/acts_as_versioned':
  piston:root : http://svn.techno-weenie.net/projects/plugins/acts_as_versioned
  piston:local-revision : 19
  piston:uuid : 567b1171-46fb-0310-a4c9-b4bef9110e78
  piston:remote-revision : 2691

Now, when I deploy my app with capistrano or check out a cwd with subversion I’ll grab revision 2691 of acts_as_versioned instead of a newer revision that I haven’t tested with my app.

Ok, great I could have done something similar by hand, but Piston makes handling the large number of plugins very easy to deal with super easy to manage updates.

Problem Solved. Thank you Piston developer François Beausoleil!

no comments | no trackbacks

Rails Reporting with acts_as_reportable

Posted by acts_as_flinn Thu, 01 Feb 2007 02:25:00 GMT

One of the biggest missing features of Rails has been the lack of a reporting tool. Dynamic reporting is a pain in just about any language, but particularly with Rails because of predefined views and railsish renderings. Views are great when working with predefined sets of data derived from ActiveRecord.

Unfortunately it isn’t easy to dynamically query and render resulting data sets.

Ruport has been around for some time now, but until now hasn’t had a sweet rails plugin to convert ActiveRecord data to ruport data collections.

Along comes acts_as_reportable...

With acts_as_reportable you can do really cool stuff like this:


class Part < ActiveRecord::Base
  acts_as_reportable
  belongs_to :account
  belongs_to :category
end

class Category < ActiveRecord::Base
  acts_as_reportable
  has_many :parts
end

class Account < ActiveRecord::Base
  acts_as_reportable
  has_many :parts
  has_many :categories, :through => :parts
end

class ReportsController < ApplicationController
  def index
    parts = Part.report_table(:all, :include => [:account, :category])

    # Remove non content columns
    parts.column_names.each{ |c| parts.remove_column(:name => c) if c =~ /(.id|_id|_count)$/ }

    # Convert table headings
    parts.column_names = parts.column_names.collect{ |cn| cn.gsub(/\./, ' ').titleize }

    render :text => parts.as(:html), :layout => true
  end
end

See the results here

The possibilities here are pretty awesome. To make this work really well, we could very easily create a form to add conditions to a find. Combine it with something like the ez_where plugin and you’ve got some pretty powerful reporting functionality.

Posted in Rails Development | no comments | no trackbacks

Happy New Year!!!

Posted by acts_as_flinn Mon, 01 Jan 2007 16:28:00 GMT

Welcome to 2007! We’re all excited about big things coming up in the year. This month we are rolling out the TRAQInventory.com beta and we’re working on some other super secret projects to add to our inventory management services.

Posted in Misc. | no comments | no trackbacks

Older posts: 1 2 3 ... 9