Hi, Before using `gon.variable`, do you call `include_gon` somewhere in your view?
HTH, :eito On Tue, Sep 29, 2015 at 6:01 AM Colin Law <clan...@gmail.com> wrote: > I am developing a rails gem. It uses the gon gem so in the gemspec > file I have included > > spec.add_dependency 'gon' > > Then in the Gemfile for the application using my gem I have put > > gem 'my_gem', :path => '/path/to/dir/containing/my_gem' > > When I run bundle install I see that it includes my gem and also the > gon gem as expected. > From a view helper in the app I am calling helper method in a module > in my gem's lib folder, and in there I have code such as > gon.variable = ... > and that code throws an error > ActionView::Template::Error (undefined method `gon' for > #<PlotValuesController:0x000000067bbc30>) > where PlotValuesController is the controller in the app. If I > explicitly include gon in the Gemfile for the app then all works as > correctly. > > Any suggestions as to why I have to explicitly include gon in the > application's Gemfile, when it is included anyway via the dependency > in my gem? > > Gemfile.lock with and without gon included explicitly can be seen at > http://pastebin.com/vzvNgg3K > > Colin > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-talk@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuh7_ni44oG%3DTu5yVpAd4B16tzFg%2BEY6ewXcKJ2XPWQXQ%40mail.gmail.com > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CA%2BfENYUpf5UNQtd9GX%3DRqRtWP70CSKX5K%2BhFkKaN8sR1RKbyXQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.