# Railroad problem

**URL:** <https://www.ruby-forum.com/t/railroad-problem/120399>\
**Category:** Ruby\
**Created:** [November 16, 2007, 3:37pm UTC](https://www.ruby-forum.com/t/railroad-problem/120399 "2007-11-16T15:37:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [November 16, 2007, 3:37pm UTC](https://www.ruby-forum.com/t/railroad-problem/120399/1 "2007-11-16T15:37:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [November 16, 2007, 3:52pm UTC](https://www.ruby-forum.com/t/railroad-problem/120399/2 "2007-11-16T15:52:20Z")

</div>

removed\_email\_address@domain.invalid 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.

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [November 16, 2007, 3:54pm UTC](https://www.ruby-forum.com/t/railroad-problem/120399/3 "2007-11-16T15:54:40Z")

</div>

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
