How do you make a rail engine look?

I have rails 4 engine called the_great_library

where it is difficult for me to upload files to upload files.

In the engine, I have a file located in /lib/the_great_library

called book_lookup_service.rb

. The file now contains something like this:

class NoBookMatchingTitle < StandardError;end
module TheGreatLibrary
  class BookLookupService

    def self.find_book name
      if book = Book.find_by_name(name)
        return book
      else
        raise NoBookMatchingTitle.new("The book named #{name} could not be found!")
      end
    end

  end
end

      

Now my problem is that if I start the rails console from a dummy app for example cd spec/dummy & rails c

and type: NoBookMatchingTitle.new

I get:NameError: uninitialized constant NoBookMatchingTitle

How to solve this?

Note: I tried to put config.eager_load_paths += "#{config.root}/lib"

in engine.rb

, but it doesn't help.

+3


source to share





All Articles