Right Traq Blog

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

New Ruby Site

Posted by acts_as_flinn Tue, 12 Sep 2006 23:06:00 GMT

There is a new Ruby Language website!

I’d really have to say I like the new look, and the new home page says it all…


# Ruby knows what you
# mean, even if you
# want to do math on
# an entire Array
cities  = %w[ London
              Oslo
              Paris
              Amsterdam
              Berlin ]
visited = %w[Berlin Oslo]

puts "I still need " +
     "to visit the " +
     "following cities:",
     cities - visited

Posted in Rails Development, Misc. | no comments | no trackbacks

Ruby on Rails Inventory Management

Posted by acts_as_flinn Tue, 22 Aug 2006 01:29:00 GMT

When we founded Right Traq I had tons of experience doing custom PHP Inventory applications. Some of them were plain old function based, and others MVC based. About a year before we got started I had a prototype asset manager that I did in rails-0.12.1. This project was my first go at a rails application and I was astonished. It was relatively easy to develop, and in about 2 weeks I had about the same features as a huge PHP project I worked on for 6 months. Ruby on Rails really made development simple. Most of routine tasks needed for my projects were already taken care of in Rails, and better yet I could easily add features that really separate it from the competition.

TRAQInventory is a Ruby on Rails Inventory Management application.

After 6 months of development TRAQInventory is the result. We like to call it Inventory Management 2.0 because TRAQInventory brings Web 2.0 features that drive social networking, user generated content, and semantic web content to inventory management. Inventory Management 2.0 means your inventory data can actually tell you something, send you messages, integrate with other apps and be more of an information tool than a cumbersome liability that underperforms, and wastes time and money.

So I am pleased to announce that we’re opening the signup for the TRAQInventory Beta program.

Click Beta Signup to sign up for the TRAQInventory beta program.

Posted in Inventory Management, Rails Development, TRAQInventory | no comments | no trackbacks

Older posts: 1 2 3