Mounting Sinatra app on rails 5

陌路散爱 提交于 2019-12-24 05:45:17

问题


I searched the web and don't know why i am getting this errors...

Im trying to mount a Sinatra app that i have to refactor into a rails app so i can do the transition smoothly, so i created a dummy project to test.

My routes file:

Rails.application.routes.draw do   
  match "/sinatra" => SinatraApp, :anchor => false 
end

Sinatra app:

class SinatraApp < Sinatra::Base
  get "/" do
    "Hello Sinatra World"
  end
end

The Sinatra app is located on the lib directory and it is auto loading correctly, i tried to add the Sinatra gem in the gemfile and i got a

"`require': cannot load such file -- rack/showexceptions (LoadError)"

if i not add the gem on the gemfile, or use "require:nil" that error goes away and i got another one

"/active_support/dependencies.rb:293:in `require': cannot load such file -- rack/showexceptions (LoadError)"

If i require 'sinatra' on the Sinatra app, it crashes again with another load error....

I need to have the Sinatra app running inside the rails app so i can navigate thought the Sinatra app like it was running without rails so i can test functionalities and migrate them to the rails app.


回答1:


I was able to resolve this with a newer version of sinatra.

gem 'sinatra', '2.0.0.beta2'


来源:https://stackoverflow.com/questions/40544893/mounting-sinatra-app-on-rails-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!