Y
Y
York Cheshire2014-06-03 23:32:42
ruby gems
York Cheshire, 2014-06-03 23:32:42

Where are gem files installed in RoR 4?

Please tell me in which directory the gem files for Ruby on Rails 4 are installed.
The point is to be able to change the code
. For example.
For the will_paginate gem. After adding <%= will_paginate @items %>
to the view (views) , the following html code is generated:

<div class="pagination">
 <a class="previous_page" rel="prev start" href="/items?page=1">← Previous</a>
 <a rel="prev start" href="/items?page=1">1</a>
 <em class="current">2</em>
 <a rel="next" href="/items?page=3">3</a>
 <a class="next_page" rel="next" href="/items?page=3">Next →</a>
</div>

I would like to change it

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimitriy, 2014-06-04
@Kuki_Bulochka

To see where the gem is installed:
to view the sources, (for editing later)
about edits - it is not recommended to change the installed gems, for example, all your edits will be lost when you update the gem
1. expand the library with 'Monkey patch', advantage, you do not edit anything in the source library, shortcomings, fixing errors after the author of the gem has made changes;
2. make a local/remote (fork) copy, and install that version, the advantage of being in control of changes happening to the gem. It looks something like this:

cd <path>
gem unpuck <name_gem> (если без git`a)
git clone --bare <адрес> (если с git)
#... правки gem`a ...
# Вариант 1. Настройки Bundle, говорим, что <name_gem> локальный (главное не забыть об этом)
bundle config local.spree <path>/<name_gem>

# Вариант 2: Gemfile:
gem 'name_gem', path: <path> # локально
gem 'name_gem', :git => '<repo path/url>', :branch => 'you_hack_branch'

Regarding wil-paginate and its View's. When showing pagination, you can specify your own handler.
An example of how this is done: you can see here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question