I have a list of records in Rails, and these records have a boolean field to make them public or private. I need a way of changing every public record to private **whenever** updated\_at >= 30 days ago. 

I don't know where to start. Any advice, links and tips are welcome. Thank you! 

**The Solution**

Following the recommendation from @lol007 i use whenever gem. The steps i follow are:

1. Create a app with a table Post title:string content:text status:boolean and run first time the server to add info, then stop the server and continue with the other steps.
2. Add whenever gem to my gemfile and run bundle install.
3. Run wheneverize . in the console to create the config/schedule.rb file
4. Add in the models/post.rb the next code:

```
def self.check_updated_at
  where('updated_at < ?', 30.minutes.ago).update_all({ :status => :true })
end 

```
5. Add in config/schedule.rb the next code:

```
every 3.minutes do
  runner "Post.check_updated_at"
end

```
6. Because im working in development, i run the next command:

```
$ whenever --update-crontab --set environment='development'

```
7. Then to check my cron is working i run the next command:

```
$ crontab -l

```
8. My last step is run the rails server and put to work my app.

Other lines i used in my test are:

```
    $ whenever -w 

```

To generate the cron file in production. And

```
   $ crontab -r

```

To remove the cron file, when is not the one i want.

thank you all for your time and input.