0

I would like to use gems 'better_errors' and 'binding_of_caller' for my debugging in rails app, but i DON'T want to include those in Gemfile. Is it possible to do? My first thought was to simply

gem install better_errors
gem install binding_of_caller

but it doesnt work, i mean installation finishes without problems, but thats it, gem doesnt seem to work at all when i run my app on localhost. Do I need some kind of config set, anybody?

Leo
  • 2,061
  • 4
  • 30
  • 58

2 Answers2

1

but i DON'T want to include those in Gemfile. Is it possible to do?

Yes, it is possible. You can just download the respective directories in desire folder (ex. lib) and add that gem class in your initializer so it will be loaded at the time of starting. Configuration varies as per gem.

My first thought was to simply .... but it doesnt work,

Ofcourse, it wont. How can your rails app magically detects without knowing it that you have better way to show error. It is simply saying like you have cancer formula and doctors automatically applied that formula to there patient without you telling them. There should be some commucaition between two parties rails-app and gem so they can coordinate and work better.

Do I need some kind of config set, anybody?

Yes, explained above.

i dont want to force those gems on my coworkers. KRUKUSA any more details? // said in comment

Yes, including this gems in your rails app can do this job. This extension will be available automatically to your worked. (no force applied :P)

it looks like all you want to not show those gems to other co-worker, if so, you can use this trick with .

To achieve this thing, first simply add the gems in your gemfile, run bundle and then make it untrackable with git. You can put Gemfile and Gemfile.lock in your .gitignore file. or you can add the first add the gems and mark it ignore with below command. Read more here

 git update-index --assume-unchanged Gemfile Gemfile.lock 
Community
  • 1
  • 1
Paritosh Piplewar
  • 7,982
  • 5
  • 26
  • 41
0

Another possibility would be to create your own environment and use it accordingly.

  1. Have your own configuration for myenv:

    $ cp config/environments/{development,myenv}.rb
    
  2. In config/database.yml, add the environment myenv and use the same config as development:

    development: &development
      <rest of the code you have on config/databases.yml>
      ...
    
    myenv:
      << *development
    
  3. In Gemfile add your custom gems to use on your mydev group:

    group :myenv do gem 'better_errors' gem 'binder_of_caller' end

  4. Run rails and rake with RAILS_ENV like this: RAILS_ENV=myenv rails c

The advantage of this approach is that you still get the updates from Gemfile from the repo, and if you need to add a gem in the Gemfile for everybody to see, you still can.

Also, nobody will see the gems you installed inside the myenv group in your Gemfile.

raviolicode
  • 2,155
  • 21
  • 22