3

I am trying to edit a specific gem: https://github.com/rderoldan1/md_simple_editor

The issue is that the editor does not load without a page refresh first. The issue can be checked here: https://github.com/rderoldan1/md_simple_editor/issues/9

I was able to fix this in my local by editing the file:

/usr/local/rvm/gems/ruby-2.3.4/gems/md_simple_editor-0.3.0/app/assets/javascripts/md_simple_editor.js.coffee

It is fixed by just editing the code as the other users are saying in the issue posted in the gem url above.

I cant find the right place to fix this in production, can someone point me in the right directory path?

Thanks in advance.

Joao Quaresma
  • 41
  • 1
  • 7
  • 1
    What you should do is take that file, put it in your own codebase, and include it. You could also fork the gem, make the changes you need, and point to it within your Gemfile. – Josh Brody Apr 28 '18 at 17:47
  • 1
    You should **never** be editing code directly on production. This is not how you should perform fixes, ever. Fork the gem (or use an existing fork), update the `Gemfile` to use the fixed version (on your machine, not production!), run `bundle`, then if all is well, deploy as normal. – Tom Lord Apr 28 '18 at 18:32

1 Answers1

3

Don't do it that way. Fork the gem, make the changes in the gem code and make sure you write tests that prove your code works as expected. Then push the code to your forked repo on github.

Then make a pull request and support the open source community. In the mean time, you can use your version of the gem by edit your Gemfile like so:

gem 'md_simple_editor', github: 'lacostenycoder/md_simple_editor', branch: 'master'

Of course replace lacostenycoder with your github username.

lacostenycoder
  • 10,623
  • 4
  • 31
  • 48
  • Thank you for the explanation, that really looks the best way of doing this – Joao Quaresma Apr 30 '18 at 21:17
  • @JoaoQuaresma Welcome. Also, when you make your pull request, use a feature branch for the name of the feature your PR is fixing i.e. `bugfix/9-fix-turbo-links-rails-5` and open PR from that. You can merge it to your forked branch of master, or use your feature branch if you prefer in the Gemfile. See https://stackoverflow.com/questions/273695/git-branch-naming-best-practices#6065944 – lacostenycoder May 01 '18 at 02:23