ruby - Best way to reuse variables in different Sinatra Routes -


i have instance variable in sinatra route want use in 2 different routes:

get '/home/:name'     @name = params[:name]     erb :home end   '/define'     user = user.create(name: @name)     erb :define end 

my application doesn't allow me use @name in different route. best way make @name reusable in other routes?


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -