On Fri, Jun 20, 2008 at 4:00 AM, John Wells <[EMAIL PROTECTED]> wrote:
> On Thu, Jun 19, 2008 at 6:52 PM, _why <[EMAIL PROTECTED]> wrote:
>> On Thu, Jun 19, 2008 at 02:40:42PM -0400, John Wells wrote:
>>> Interesting. So what would be the recommended way of sharing data
>>> between urls? Global variables or something along those lines?
>>
>> Well, sure, any way you'd share data in a program: in global or
>> class variables, in a database, or perhaps in the URL.
This is one way I used:
class SessionShoes < Shoes
@session = {}
class << self
attr_reader :session
end
def session
SessionShoes.session
end
end
class Test < SessionShoes
url "/", :index
url "/show", :show
def index
session["name"] = "value"
button "Do" do
visit "/show"
end
end
def show
alert ("Session value is: #{session['name']}")
end
end
Shoes.app :width => 100, :height => 100, :title => "Title"
Jesus.