#7 new
Aitor García Rey

Rails dependencies introduced in rubigen >1.5.0

Reported by Aitor García Rey | January 20th, 2009 @ 11:05 PM

Generate a RubiGen::Base based application generator:


newgem foobar
script/generate application_generator foobar

add this to the manifest method on foobar_generator.rb to test the migration generation process:


m.migration_template 'test.rb', 'db/migrate',:migration_file_name => 'test'

and add a simple migration template:


class Test < ActiveRecord::Migration
  def self.up
  end

  def self.down
  end
end

Then try to use this generator:


chmod +x bin/foobar
bin/foobar test_app

This throws an "uninitialized constant":


uninitialized constant RubiGen::Commands::Base::ActiveRecord

I think this error is related to Rails dependencies no satisfied in [RUBIGEN_PATH]/lib/rubigen/commands.rb line 65:


Dir.glob("#{RAILS_ROOT}/#{@migration_directory}/[0-9]*_*.rb").inject(0) do |max, file_path|

and line 88:


if ActiveRecord::Base.timestamped_migrations

As workaround a simple require 'active_record' would fix it. Obviously this Rails dependencies could be not desired and a few changes in the rubigen gem will remove this dependency.

Let me know if a you a few test to clarify this issue.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

A generator system extracted from Rails

People watching this ticket

You can update this ticket by sending an email to from your email client. (help)