Arc Forum | #!/usr/bin/env ruby require "ramaze" class MainController < Ramaze::Co...

11 points by Kashia 6500 days ago | link | parent

 #!/usr/bin/env ruby
 require "ramaze"
 class MainController < Ramaze::Controller
 def index
 if f = session['foo'] then "you said #{f}"
 elsif session['foo'] = request['foo'] then A("click Here", :href => '/')
 else '<form><input name="foo" /><input type="submit"></form>'
 end
 end
 end
 Ramaze.start :port => 7001
 __END__
 
Using Ramaze[http://ramaze.net]. Though I do find it kinda unfair comparing languages over web frameworks... Rails.. shudder


2 points by troelskn 6498 days ago | link

> Though I do find it kinda unfair comparing languages over web frameworks...

My sentiments exactly. This is a demonstration of a library, which handles a certain scenario very well. I'm sure, an equally terse library could be written in most other languages.

Coincidentally, in the few cases, where I need application state stored at the server side, I usually want it to be global. If I have the same site open in multiple tabs, I actually want the shopping cart from window one to reflect the same state as the shopping cart from window two. But then again. I guess that is a matter of me failing to see the point of continuations, and therefore not overly relevant to the topic.

-----

1 point by ix 6497 days ago | link

element http://repo.or.cz/w/element.git :

 case r.qs
 when '': isindex
 when /^@/: r.qs.tail
 else a'follow',:href =>'?@'+r.qs
 end

-----




AltStyle によって変換されたページ (->オリジナル) /