warning: already initialized constant

151 views
Skip to first unread message

Gurdipe Dosanjh

unread,
May 30, 2012, 5:44:16 AM5/30/12
to rubyonra...@googlegroups.com
Hi All,

The Linux box I was using to do my rails development had the hard disk upgraded and restarted.  Now I am getting the following warnings when I use script/console or script/server

Loading development environment (Rails 2.1.0)
/denorm_brag_report.rb:423: warning: already initialized constant MAIN_CATEGORIES
denorm_brag_report.rb:425: warning: already initialized constant SUB_CATEGORIES
/denorm_brag_report.rb:432: warning: already initialized constant TABLE_STD_DESCRIPTIONS
/denorm_brag_report.rb:447: warning: already initialized constant SUMMARY_NAMES
/denorm_brag_report.rb:455: warning: already initialized constant REPORT_TYPES
/denorm_brag_report.rb:469: warning: already initialized constant BRAG_SUMMARY_COLS

I have checked the code and these constants are only used in one place

I have cleared the cache, checked the gems, and anything else I can think of

Is there anything else I could check

Gurdipe

Michael Pavling

unread,
May 30, 2012, 5:51:39 AM5/30/12
to rubyonra...@googlegroups.com
On 30 May 2012 10:44, Gurdipe Dosanjh <rhomob...@gmail.com> wrote:
> Loading development environment (Rails 2.1.0)
> /denorm_brag_report.rb:423: warning: already initialized constant
> MAIN_CATEGORIES

Does your code include the denorm_brag_report.rb file more than once?

Gurdipe Dosanjh

unread,
May 30, 2012, 7:07:32 AM5/30/12
to rubyonra...@googlegroups.com
hi Michael

I have checked and its not been called anywhere else, but may be im missing something simple

it always gives a warning on the last entry of the set of values  in assigned to the constants

gurdipe


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.


Michael Pavling

unread,
May 30, 2012, 7:28:57 AM5/30/12
to rubyonra...@googlegroups.com
On 30 May 2012 12:07, Gurdipe Dosanjh <rhomob...@gmail.com> wrote:
> I have checked and its not been called anywhere else, but may be im missing
> something simple
>
> it always gives a warning on the last entry of the set of values  in
> assigned to the constants

I would recommend putting a breakpoint on the line that defines the
constant, and then the second time it gets there have a look at the
call stack to see how it's ending up there twice.

Lenart

unread,
May 30, 2012, 11:48:16 AM5/30/12
to rubyonra...@googlegroups.com
It might be that this file is somewhere in autoload path (/lib, etc.) and you're also manually requiring it by hand somewhere.
Reply all
Reply to author
Forward
0 new messages