# Calls between methods of application.rb

**URL:** <https://www.ruby-forum.com/t/calls-between-methods-of-application-rb/112271>\
**Category:** Ruby\
**Created:** [August 16, 2007, 11:32pm UTC](https://www.ruby-forum.com/t/calls-between-methods-of-application-rb/112271 "2007-08-16T23:32:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikos\_Kanellopoulos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/c5a1d2/32.png) [@Nikos\_Kanellopoulos](https://www.ruby-forum.com/u/Nikos_Kanellopoulos)\
**Post date:** [August 16, 2007, 11:32pm UTC](https://www.ruby-forum.com/t/calls-between-methods-of-application-rb/112271/1 "2007-08-16T23:32:21Z")

</div>

In a rails application,  
I have a set\_lang() and a write\_to\_log() method in  
app/controllers/application.rb

set\_lang() calls write\_to\_log().  
Nothing happens. I should expect that write\_to\_log is either called or  
an exception is thrown. However, it seems that it is silently ignored.  
To prove this I called write\_to\_log00(), which does not exist. Still  
the same behavior.

Is this normal?  
Is there a workaround?

---

<div class="post-metadata">

**Author:** ![Nikos\_Kanellopoulos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/c5a1d2/32.png) [@Nikos\_Kanellopoulos](https://www.ruby-forum.com/u/Nikos_Kanellopoulos)\
**Post date:** [August 17, 2007, 1:57am UTC](https://www.ruby-forum.com/t/calls-between-methods-of-application-rb/112271/2 "2007-08-17T01:57:44Z")

</div>

Nikos Kanellopoulos wrote:

> In a rails application,  
> I have a set\_lang() and a write\_to\_log() method in  
> app/controllers/application.rb
> 
> set\_lang() calls write\_to\_log().  
> Nothing happens. I should expect that write\_to\_log is either called or  
> an exception is thrown. However, it seems that it is silently ignored.  
> To prove this I called write\_to\_log00(), which does not exist. Still  
> the same behavior.
> 
> Is this normal?  
> Is there a workaround?

You should :

- post your code
- post it to the Ruby On rails forum instead of the Ruby (maybe you’ll  
get more help)

If your code looks like

def write\_to\_log  
#blablabla  
set\_lang = something  
#blablabla  
end

Then it won’t work, because Ruby assumes that set\_lang is a local  
variable.  
Do this instead (add “self.”) :

def write\_to\_log  
#blablabla  
self.set\_lang = something  
#blablabla  
end

Hope this helps. If it doesn’t, I’m sure you’ll get more responses if  
you post your piece of code 🙂
