# Rails rake - setting constant and cache delete

**URL:** <https://www.ruby-forum.com/t/rails-rake-setting-constant-and-cache-delete/191969>\
**Category:** Rails\
**Created:** [July 21, 2010, 2:12pm UTC](https://www.ruby-forum.com/t/rails-rake-setting-constant-and-cache-delete/191969 "2010-07-21T14:12:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aldoitalo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@aldoitalo](https://www.ruby-forum.com/u/aldoitalo)\
**Post date:** [July 21, 2010, 2:12pm UTC](https://www.ruby-forum.com/t/rails-rake-setting-constant-and-cache-delete/191969/1 "2010-07-21T14:12:15Z")

</div>

i perform a rake task with a cron, in this task i have 2 problems:

-i using a constant name setting in my config/environment.rb, when i try  
to run the rake job on the “environment developer” the constant is read  
an the job works fine, but when i try on the “environment production”  
the constant seem not include in the job.

-on the cron job i want to delete 3 cache fragments, i try this:  
expire\_obj = ActionController::Base.new  
expire\_obj.expire\_fragment(%r{(._)part=my\_first\_part.cache})  
expire\_obj.expire\_fragment(%r{(._)part== my\_first\_second.cache})  
expire\_obj.expire\_fragment(%r{(.\*)part= my\_third\_part.cache})  
when i run on “environment developer” the fragments are deleted, but  
when i try on the “environment production” they aren’t.

any solutions?
