[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Calls between methods of application.rb

Nikos Kanellopoulos

8/16/2007 9:31:00 PM

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?

1 Answer

Arno J.

8/16/2007 11:58:00 PM

0

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 :)
--
Posted via http://www.ruby-....