Cookies and Foreign Classes

Hello,

Hello,

Hello,

> Hi guys,
>
> I have a method inside a controller that has many lines of code (some of
> them used to generate/read cookies).
>
> In order to keep the code readable and use the object-oriented power of
> Ruby, I created a foreign class that I call in my method using:
>
> def index
> require('foreign_class')
> f = Foreign.new
> @out = f.foreign_method
> end
>
> The problem is, when the foreign_method tries to create a cookies with
>
> cookies[:c] = 'id'
>
> it says "undefined local variable or method 'cookies'
>
> So... it's not possible to handle cookies in foreign classes. Or it's
> not even supposed to use foreign classes in Ruby?

What's keep you from introducing coookies as a class atttribute in Foreign?

ups, I meant instance attribute.

I mean: f = Foreign.new :cookies => cookies

Sorry,

Keep smiling
yanosz