Sinatra: Route Handlers Inside a Class - Access other Class Methods?

You just need to inherit from Sinatra::Base : require "sinatra/base" class Example Put shared functionality in model classes and helpers, and run all your apps together with Rack module Helpers def say_hello "" end end class Ru: map "/" do run end map "/admin" do run Admin end Install Thin and run your app with thin start.

You just need to inherit from Sinatra::Base: require "sinatra/base" class Example Put shared functionality in model classes and helpers, and run all your apps together with Rack. Module Helpers def say_hello "" end end class " do @message = say_hello haml :"admin/index" end end config. Ru: map "/" do run end map "/admin" do run and run your app with thin start.

Thanks! My goal is basically to create multiple controllers. I'm not sure how best to do that in this way -- since one class runs as the entire app when using the run method?

Any suggestions? – dbgpyd Jan 25 at 9:05 Just updated my answer to include an example of one way you can split your application into multiple classes. – Todd Yandell Jan 25 at 21:19 Awesome.

Thank you. – dbgpyd Jan 25 at 21:59.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions