Calls between methods of application.rb

  • Thread starter Nikos Kanellopoulos
  • Start date
N

Nikos Kanellopoulos

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?
 
A

Arno J.

Nikos said:
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 :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top