Closed michaelqz closed 6 years ago
Hello, can you give more information - how is gem mounted in your app ? For example did you put into your Gemfile
gem "mautic", path: "/home/ubuntu/workspace"
or in some other way? For me is confused that error show "workspace" as a main directory of gem.
I'd like to reproduce it. Thank you
Hi,
The reason why it shows workspace as the main directory of the gem may be because I have actually copied over your files manually into my directories - I did not use the gem. I did so as I did not need the views. It may also be because I'm developing on the Cloud 9 workspace instead of my local machine.
your repo -> my directories:
app/models/mautic/
-> app/models/mautic/
app/controllers/concerns/mautic/connections_controller_concern.rb
content into -> app/controllers/connections_controller.rb
lib/mautic/
-> lib/mautic/
lib/mautic.rb
-> lib/mautic.rb
I've also updated the locales text and added the relevant routes into my app:
# routes.rb
namespace :api do
resources :mautic do
member do
get :authorize
get :oauth2
end
end
end
I've also added the autoload path:
# application.rb
config.eager_load_paths << Rails.root.join('lib/mautic')
Thanks very much for your kind assistance.
I think thats a reason, you try to copy some file from engine to your app, but you did not setup it correctly. I suppose that correct eager_load_paths
is just lib
folder.
Anyway I recommend you gem "as is", or fork it, but still use it as a engine. So in your app you can clone whole repositoro lets say to "vendor" directory and to Gemfile put
gem "mautic", path: "./vendor/mautic-rails"
If you need replace views, its no problem, because rails use your app paths firstly instead engine paths, so if you create app/views/mautic/connections/_form.html.erb
, rails should use your view instead of engine.
Another point - I have created controller as a concern, because I also need in my other project overwrite views - you can create own controller, include conecrn and copy (and update) routes in your routes.rb
.
I have intergration with Redmine - you can use it as a working example - https://github.com/luk4s/redmine_mautic .
I hope thats help, of not let me know 🙂
Thanks very much! I will follow your instructions and give it another go. Cheers - closing issue for now.
Hi,
Thanks for putting together this fantastic gem. I have been trying to integrate the gem into my app.
In rails console, I try to run the following command but receive the following error message.
However my
lib/mautic/proxy.rb
file is present in the relevant directory, i.e. this file is present in my directory. Would you know how I should go about trouble-shooting this?