Kanellopoulos.Nikos-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Aug-17 21:48 UTC
Calls between methods of application.rb
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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---