# Calling own classes within RoR

**URL:** <https://www.ruby-forum.com/t/calling-own-classes-within-ror/69175>\
**Category:** Ruby\
**Created:** [September 19, 2006, 5:03am UTC](https://www.ruby-forum.com/t/calling-own-classes-within-ror/69175 "2006-09-19T05:03:53Z")\
**Posts on this page:** 2\
**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:** [September 19, 2006, 5:03am UTC](https://www.ruby-forum.com/t/calling-own-classes-within-ror/69175/1 "2006-09-19T05:03:53Z")

</div>

hiya!

i am seeing some odd behavior inside a controller. I am including my  
own class and calling methods on it. some of them work, and some of  
them dont… very odd.

in top of the controller:  
require “lib/swfcat/swfroom”

def preview  
@swfRoomObj = SwfRoom.new  
@swfRoomObj.loadRoom(@params[‘id’]) #this works  
@swfRoomObj.roomRender(true) # this says "undefined method  
`roomRender’ "  
end

i cant understand why one method would work and the other not?  
also, is there some odd caching of objects/classes going on? it seems  
sometimes it takes a while for changes in source to be reflected in  
server (usign webbrick/radrails)

tx!

## /dc

```
  David "DC" Collier

```

[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
+81 (0)80 6521 9559  
skype: callto://d3ntaku

---

<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:** [September 19, 2006, 10:06am UTC](https://www.ruby-forum.com/t/calling-own-classes-within-ror/69175/2 "2006-09-19T10:06:18Z")

</div>

Hi David,

You might find more effective and poignant help either on the  
RubyOnRails mailing list or on the #rubyonrails IRC channel on  
[irc.freenode.net](http://irc.freenode.net).

Your problem sounds generic enough, though, that I will at least  
venture some help.

Do you mind showing the implementation of lib/swfcat/swfroom.rb? What  
exactly does #loadRoom do? Is it possible that #loadRoom isn’t saving  
the results for the #roomRender method to perform on? Perhaps you  
accidentally defined it as class method (as opposed to an instance  
method)?

M.T.
