# This works on windows but not linux

**URL:** <https://www.ruby-forum.com/t/this-works-on-windows-but-not-linux/129896>\
**Category:** Rails\
**Created:** [February 22, 2008, 2:20pm UTC](https://www.ruby-forum.com/t/this-works-on-windows-but-not-linux/129896 "2008-02-22T14:20:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 22, 2008, 2:20pm UTC](https://www.ruby-forum.com/t/this-works-on-windows-but-not-linux/129896/1 "2008-02-22T14:20:57Z")

</div>

I have this app where if I am logged in as admin, I set the Group  
model so that when it saves a record it will automatically set  
the approved field to true. That field has a default value of false  
in mysql. This works fine in windows, but when I setup the app  
to run on [hostingrails.com](http://hostingrails.com) which is linux, it doesn’t work. Any  
ideas ?

=================================

class Admin::BaseController \< ApplicationController  
layout ‘admin’  
before\_filter :set\_admin, :authorize, :except =\>  
[“login”,“admin\_login”, ‘logout’]

…

def set\_admin  
Group.set\_admin()  
end

======================================

class Group \< ActiveRecord::Base

before\_create :set\_fields

def Group.set\_admin  
@@admin = true  
end

def set\_fields  
if defined? @@admin  
self.approved = true  
end  
end

end

end

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 22, 2008, 8:05pm UTC](https://www.ruby-forum.com/t/this-works-on-windows-but-not-linux/129896/2 "2008-02-22T20:05:01Z")

</div>

never mind, user error on this, I had a bug in one of my models and I  
figured it out

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 22, 2008, 10:41pm UTC](https://www.ruby-forum.com/t/this-works-on-windows-but-not-linux/129896/3 "2008-02-22T22:41:27Z")

</div>

removed\_email\_address@domain.invalid wrote:

> never mind, user error on this, I had a bug in one of my models and I  
> figured it out

I hope that you discovered that setting @@admin will never work in  
production when you have more than one user on your system… 🙂

ilan
