Better error issue with Ubuntu VM+ windows7+ Browsing on windows

Working with better_error gem was a great experience

But scratched my head for days with the problem:

Every time after having gem “better_errors” resulted in same default error page. Finally got the solution saying that “You need to be on localhost to use better_errors”

The thing is i had been developing in a Ubuntu VM on a Windows 7 view vm and browsing the site from Windows. Although it’s a security risk, you can allow this by following the instructions here: https://github.com/charliesome/better_errors#security

Or

A variation on the above solution is: To put this in config/environments/development.rb:

$ BetterErrors::Middleware.allow_ip! ‘<IP Address>’

For me i was hosting on xy.xyz.ab.cd(say) but was not working as my env dump was different.
So i assigned to the REMOTE_ADDR(my local system address): “xy.abcd.pqr.z”(say)

Have a look to the default page error at the env dump and know better.

Finally Done!!!

Advertisements

Better Error Handling in rails

  This is a gem which debugs errors very effectively and handles exceptions… we have a gem called: better_errors, add this to your development environment.
 group :development do
    gem ‘better_errors’
end
– Better Errors replaces the standard Rails error page with a much better and more useful error page.
– Even we can have binding_of_caller gem which even shows all the local and instance variables used  in the particular method with an interactive prompt.
– Even this handles ajax exceptions and errors, just run __better_errors at the url localhost:3000/ __better_errors.
– When we click on the link at the top of the page, directly it takes to the particular page.
– If you want to specify the editor then add an intialiser as
$ BetterErrors.editor = :sublime if defined? BetterErrors
with a file name better_error.rb
– for more info you can refer to rails cast 402 episode, and here is the github details: https://github.com/charliesome/better_errors