devnacho / mountain_view

Living styleguide for Rails
MIT License
273 stars 29 forks source link

Problem for execute generator #51

Closed thattimc closed 7 years ago

thattimc commented 7 years ago

Just following the document to run

rails generate mountain_view:component header

It show up

/Users/Tim/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mountain_view-0.12.0/lib/mountain_view/engine.rb:34:in block (2 levels) in <class:Engine>': undefined methodhelper' for ActionController::API:Class (NoMethodError)

kitop commented 7 years ago

Are you using rails --api?

thattimc commented 7 years ago

no, just run this rails generate mountain_view:component header

kitop commented 7 years ago

Mhm, seems like your app is a API-only app, thus not having ActionView and other required modules for displaying views, helpers, etc. Is that the case? Can you give a bit more context on your app?

Frexuz commented 7 years ago

(We're working together) I've found the problem! It's gem 'draper' The generator works after removing draper.

The error also appears when just booting the app with rails server or rails console.

Not sure if this is a mountain_view issue, or a draper one..

kitop commented 7 years ago

Oh, interesting... Seems like draper is doing a bit of monkey patching: https://github.com/drapergem/draper/blob/v3.0.0/lib/draper/railtie.rb#L3-L10

But I can't see how that may be affecting Mountain View's generators... which version of draper are you using?

Frexuz commented 7 years ago

same 3.0.0

kitop commented 7 years ago

Interesting. I can't find any relationship to it though... If you investigate more, would you mind sharing any findings? Is this OK to close?

Frexuz commented 7 years ago

I'll ask over at Draper :)

Frexuz commented 7 years ago

An update:

Test repo: https://github.com/Frexuz/mountain_view_test

ruby '2.3.1'

source 'https://rubygems.org'

gem 'rails', '5.1.0'
gem 'listen', '~> 3.0.5'
gem 'sqlite3'
gem 'puma'

gem 'mountain_view'
gem 'draper'
gem 'activeadmin'

Seems activeadmin is included in the collision.

I'll have to post at active_admin as well :P

kitop commented 7 years ago

Oh wow, thanks for reporting! I can reproduce it now with your repo (https://github.com/Frexuz/mountain_view_test)

Will investigate further this week. Please keep us posted if any news :) Thanks again!

Frexuz commented 7 years ago

Any findings? :D

kitop commented 7 years ago

Hi @Frexuz, @robcole just contributed a PR that should fix this: #53 Just released that in v0.12.1, can you try it?

Frexuz commented 7 years ago

Works! :D <3