Rails 3, HTTP extensions (WebDAV) and Rack App mounting
And we have a winner.
https://rails.lighthouseapp.com/projects/8994/tickets/5895-allow-mounting-of-rack-apps-that-deal-with-http-extensions
Rails 5: Rack app mounted in routes.rb bypasses Rails middleware?
Found it. Turns out I was mounting one of these apps in config.ru
as well, under the same URL - and then of course the entire Rails stack gets bypassed, as it should be. Lesson learned.
How to create rack application to be used by Rails?
I got my question answered in another question:
How to read POST data in rack request
require 'json'
class Greeter
def call(env)
req = Rack::Request.new(env)
if req.post?
puts req.POST()
end
[200, {"Content-Type" => "application/json"}, [{x:"Hello World!"}.to_json]]
end
end
run Greeter.new
and use JSON.parse( req.body.read )
to parse POST data. reload rails.root/app/resources/* per request
I am currently using the following hack, if anyone has a better solution please do share!
# config/environments/development.rb
root = config.root
config.to_prepare do
load "#{root}/app/resources/file_resource.rb"
end
Related Topics
Error: Spawn Enoent: Missing The SASS Executable
Including Methods to a Controller from a Plugin
In Ruby, Is Truthiness Idiomatic for a Method Name Ending with a Question Mark
How to Mount a Sinatra Application Inside Another Sinatra App
How Can Multiple Trailing Slashes Can Be Removed from a Url in Ruby
Operator Precedence of Unary Operators
If I Have a Stripe Token from a Charge, How to Get Its Charge Id
Error Installing Rdoc Documentation: Incompatible Encoding Regexp Match
Implementing a Lookup Table in Rails
Why Can't Net::Ftp Connect to Server
Capybara & Cucumber | Getting Cookies
Reading Files in a Zip Archive, Without Unzipping The Archive
Running "Bundle Install" Fails and Asks Me to Run "Bundle Install"
Where to Reopen a Class in Ror
How to Use Strong Parameters with an Objects Array in Rails