Railroad problem

Hi all,

        Got struck up with this. Please help.

The actual requirement is that I am trying to generate a model diagram
thru the railroad which I have installed in my machine. I use both
oracle and postgre db’s in the db connection (database.yml file).

"puredisk_development:

adapter: postgresql

database: ca

port: 10085

username: ***

password: ***

reporting_development:

adapter: oracle

username: ***

password: ***

database: ***

"

The error which I am getting when I am running the command “railroad -M
-v -o models” is

/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support
/dependencies.rb:249:in `load_missing_constant’: Expected
config/…/app/models/pd.rb to define Pd (LoadError)

    from

/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support
/dependencies.rb:452:in `const_missing’

    from

/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support
/dependencies.rb:464:in `const_missing’

    from

/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support
/inflector.rb:250:in `constantize’

    from

/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support
/core_ext/string/inflections.rb:148:in `constantize’

    from

/usr/local/lib/ruby/gems/1.8/gems/railroad-0.4.0/lib/railroad/models_dia
gram.rb:25:in `generate’

    from

/usr/local/lib/ruby/gems/1.8/gems/railroad-0.4.0/lib/railroad/models_dia
gram.rb:24:in `each’

    from

/usr/local/lib/ruby/gems/1.8/gems/railroad-0.4.0/lib/railroad/models_dia
gram.rb:24:in `generate’

    from

/usr/local/lib/ruby/gems/1.8/gems/railroad-0.4.0/bin/railroad:40

    from /usr/local/bin/railroad:16:in `load'

    from /usr/local/bin/railroad:16

This “pd.rb” in the error uses the postgre db conection.

The contents of the pd.rb file are

"

class PD < ActiveRecord::Base

connection = “puredisk_#{ENV[‘RAILS_ENV’]}”

establish_connection connection.to_sym

end

class PD::Policy < PD; set_table_name ‘policy’; end

class PD::Dsinpolicies < PD; set_table_name ‘dsinpolicies’; end

class PD::Dataselection < PD; set_table_name ‘dataselection’; end

class PD::Agent < PD; set_table_name ‘agent’; end

class PD::Job < PD; set_table_name ‘job’; end

class PD::Policyrun < PD; set_table_name ‘policyrun’; end

class PD::Dstemplate < PD; set_table_name ‘dataselectiontemplate’; end

class PD::Policytype < PD; set_table_name ‘policytype’; end

"

And the rails_env is “development”

Thanks in advance …

Regards,

Anand.

This message is for the designated recipient only and may contain
privileged, proprietary, or otherwise private information. If you have
received it in error, please notify the sender immediately and delete
the original. Any other use of the email by you is prohibited.

[email protected] wrote:

oracle and postgre db’s in the db connection (database.yml file).

username: ***

establish_connection connection.to_sym

end

Do you have an environment called ‘development’ in database.yml? It
seems you have reporting_development and puredisk_development but not
development.

That said, I think for one of my projects, I had some problems with
railroad trying to resolve class name because my file names didn’t seem
to match the convention… I think my table was called TTFiles and my
model was TtFile and the file name was tt_file.rb - and it all didn’t
add up to Railroad properly at that time. I don’t know if the problem
you are seeing is because it expects your class to be Pd (not PD)?

Hope this helps.

Cheers,
Mohit.
11/16/2007 | 10:51 PM.

It looks like it is looking for a class called Pd and not PD.

Try “class Pd < ActiveRecord::Base”.

On Fri, 16 Nov 2007 23:36:00 +0900, srinivasan.anand wrote