# Constant didn't update?

**URL:** <https://www.ruby-forum.com/t/constant-didnt-update/189432>\
**Category:** Rails\
**Created:** [May 31, 2010, 10:32pm UTC](https://www.ruby-forum.com/t/constant-didnt-update/189432 "2010-05-31T22:32:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![minka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b38774/32.png) [@minka](https://www.ruby-forum.com/u/minka)\
**Post date:** [May 31, 2010, 10:32pm UTC](https://www.ruby-forum.com/t/constant-didnt-update/189432/1 "2010-05-31T22:32:59Z")

</div>

A very puzzling thing has happened. Any ideas on this?

I have two rates for this service I provide.

5 cents per line  
10 cents per line

I updated the latter to 20 cents per line, and made other changes  
to my site. I use a constant for the rate so I did this:  
EXEC\_RATE = 20 // used to be, EXEC\_RATE = 10

I made other changes to my site, did a successful upload,  
stopped and started mongrel, etc.  
I have verified that the products\_controller on my site has the  
new constant value above but I find that the new value does  
not show.

I see the old value, 10 cents per line, everywhere.

I am referencing my constant this way throughout my site:  
\<%= ProductsController::EXEC\_RATE.to\_s %\> cents per line

I flushed my browser cache.  
All my other changes have appeared correctly.  
I look at the current source in current/app/products\_controller.rb  
and my constant on the site has the correct value.

What could this be? Any ideas?  
thanks!!  
lucidbee

---

<div class="post-metadata">

**Author:** ![minka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b38774/32.png) [@minka](https://www.ruby-forum.com/u/minka)\
**Post date:** [May 31, 2010, 10:38pm UTC](https://www.ruby-forum.com/t/constant-didnt-update/189432/2 "2010-05-31T22:38:15Z")

</div>

// is not a ruby comment

Change it to # and see what happens.

(Sorry for top-posting - mobile phone has awful email client)

On May 31, 2010 9:31 PM, “minka” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

A very puzzling thing has happened. Any ideas on this?

I have two rates for this service I provide.

5 cents per line  
10 cents per line

I updated the latter to 20 cents per line, and made other changes  
to my site. I use a constant for the rate so I did this:  
EXEC\_RATE = 20 // used to be, EXEC\_RATE = 10

I made other changes to my site, did a successful upload,  
stopped and started mongrel, etc.  
I have verified that the products\_controller on my site has the  
new constant value above but I find that the new value does  
not show.

I see the old value, 10 cents per line, everywhere.

I am referencing my constant this way throughout my site:  
\<%= ProductsController::EXEC\_RATE.to\_s %\> cents per line

I flushed my browser cache.  
All my other changes have appeared correctly.  
I look at the current source in current/app/products\_controller.rb  
and my constant on the site has the correct value.

What could this be? Any ideas?  
thanks!!  
lucidbee

–  
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 removed\_email\_address@domain.invalid.  
To unsubscribe from this group, send email to  
removed\_email\_address@domain.invalid[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
.  
For more options, visit this group at  
[http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

---

<div class="post-metadata">

**Author:** ![minka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b38774/32.png) [@minka](https://www.ruby-forum.com/u/minka)\
**Post date:** [May 31, 2010, 10:56pm UTC](https://www.ruby-forum.com/t/constant-didnt-update/189432/3 "2010-05-31T22:56:23Z")

</div>

Thanks for the feedback, actually the line is

EXEC\_RATE = 20 # cents per line, convert and exec

So that could not be it.

I have also checked in my IDE, and the new value is showing up  
in my local development environment.  
The new value is on the production machine, in the production code.  
BUT it is not being displayed in the production site.  
All other changes are being properly displayed.  
This is ruby1.8.6  
??

thanks!  
lucidbee

---

<div class="post-metadata">

**Author:** ![minka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b38774/32.png) [@minka](https://www.ruby-forum.com/u/minka)\
**Post date:** [May 31, 2010, 11:18pm UTC](https://www.ruby-forum.com/t/constant-didnt-update/189432/4 "2010-05-31T23:18:38Z")

</div>

On 31 May 2010 21:55, minka [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> All other changes are being properly displayed.  
> This is ruby1.8.6

When I have this sort of problem, one trick I have used is to put an  
intentional syntax error in the file and upload it to the production  
server, this allows you to check that the file is actually being  
loaded.

Colin

---

<div class="post-metadata">

**Author:** ![minka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b38774/32.png) [@minka](https://www.ruby-forum.com/u/minka)\
**Post date:** [June 1, 2010, 10:41am UTC](https://www.ruby-forum.com/t/constant-didnt-update/189432/5 "2010-06-01T10:41:06Z")

</div>

On 31 May 2010 21:55, minka [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> EXEC\_RATE = 20 # cents per line, convert and exec
> 
> So that could not be it.
> 
> The new value is on the production machine, in the production code.  
> BUT it is not being displayed in the production site.

Have you done a search to ensure you’re not setting it again somewhere  
else (Ruby should warn you in the logs if you are, but it won’t stop  
you)

Can you view the file on the production site to be _sure_ it’s the  
right version.

Also, when you stopped Mongrel - are you _sure_ it stopped? If you do  
a request to the site do you get a 404 before starting again? (maybe  
there’s more instances running!)
