The mount of the Rails engine does not work and the initialized constant (NameError) appears.

Asked 2 years ago, Updated 2 years ago, 74 views

We would like to introduce the following gem.

https://github.com/fnando/coupons


as per README instructions After adding to Gemfile,

$bundle install

Edit config/routes.rb

I did, but

uninitialized constant Coupons::Engine(NameError)

You get the error

I thought it might be a problem with the Rails engine, so I'm looking into it based on the following website, but I don't know the cause, so I'm in trouble.
http://railsguides.jp/engines.html

On the rails console, it's true
The Coupons module is loaded, but
There were no Coupons::Engine modules.

I don't know what steps to take to solve this problem.

I looked for issues and pull requests on github, but there was no solution...

Thank you for your cooperation.

=============Additional information on May 2, 2016 =================

As per user3758624,

gem 'coupons', git: 'https://github.com/fnando/coupons.git'

Then it went well.

But then

http://localhost:3000/coupons

The following error occurs when accessing the :

ActiveRecord::StatementInvalid in Coupons::Coupons#index

SQLite3::SQLException:no such table:coupons:SELECT "coupons".* FROM "coupons" ORDER BY "coupons". "created_at" DESCLIMIT51OFSET0

I think the reason is that the coupon model that should be used in coupon's gem has not been generated.

It looks like the code is like creating a model on the Gem side instead of creating a Coupon model, but it doesn't work.

I'm sorry to bother you again, but could you please lend me your advice again?

ruby-on-rails ruby rubygems

2022-09-29 21:33

1 Answers

gem 'coupons', git:'https://github.com/fnando/coupons.git'
and then bundle again.

The contents of the code that fell in gem 'coupons' were empty.

require 'coupons/version'

module Coupons
  # Your code goes here...
end


2022-09-29 21:34

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.