local-ch / lhs

⚛️ REST services accelerator: Rails gem providing an easy, active-record-like interface for http (hypermedia) json services
GNU General Public License v3.0
137 stars 3 forks source link

Fix autoloading of inheriting records #397

Closed dimameshcharakou closed 3 years ago

dimameshcharakou commented 3 years ago

Description

The issue i faced during the update of LHS for location_app (some content was stripped on purpose):

# app/models/data_layer/favorites.rb

class DataLayer
  class ListType
    def build
      if favorites?
        'Favorites'
      end
    end
  end
end

such file will be loaded automatically when there is the following class: class Favorite < LHS::Record; end

This PR changes the regexp to more restrict and might match only the whole word(s).

P.S. Not sure how to test this behaviour since the file i put inside spec/dummy/app/models will be loaded when tests are executed.