I'm working on a rails 3 app that I would like to temporarily be blocked by all requests not coming from my IP address. What is the best way to go about that?
I figured I could do something at the controller level, but I'm a newb and was not sure what the best practice is.
Wrap all your routes in a constraints
block:
constraints :ip => "your-ip-goes-here" do
# routes go here
end
Your Rails app will deny all knowledge of routing if other people try to access this.
This method is really handy if you want to constrain based on other things too, like the iPhone example the documentation shows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With