# Calls between methods of application.rb

**URL:** <https://www.ruby-forum.com/t/calls-between-methods-of-application-rb/112368>\
**Category:** Rails\
**Created:** [August 17, 2007, 11:49pm UTC](https://www.ruby-forum.com/t/calls-between-methods-of-application-rb/112368 "2007-08-17T23:49:49Z")\
**Posts on this page:** 1\
**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:** [August 17, 2007, 11:49pm UTC](https://www.ruby-forum.com/t/calls-between-methods-of-application-rb/112368/1 "2007-08-17T23:49:49Z")

</div>

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?

To make things more specific, here is my code:

# file: app/controllers/application.rb

def write\_to\_log(msg)  
File.open(“logfile.txt”, “a”) do |file|  
now = DateTime.now  
file.puts("#{now}\t#{msg}")  
end  
end

def set\_lang  
code = params[:id]  
if code != “el” && code != “en” && code != “de”  
code = “el”  
end  
@lang = code

```
write_to_log("set_lang\t" + code)

cookies[:lang] =
  {
    :value => code,
    :expires => Time.now + 1.year,
    :path => '/'
  }
# redisplay the page in the new language
redirect_to request.env["HTTP_REFERER"]

```

end
