Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

undefined local variable or method `tweet_button' #5

Open
hopewise opened this Issue · 14 comments

6 participants

@hopewise

Hi,

I tried to use this gem, but I got this error:

undefined local variable or method `tweet_button'

Any idea ?

@kristianmandrup
Collaborator

If you look at https://github.com/iffyuva/social-buttons/blob/master/lib/social_buttons/view_helpers/tweet.rb
You will se that tweet_button is indeed defined. So I guess for some reason, this module is not included correctly into the ActionView::Base class in order to be available to any view that inherits from this base class.

https://github.com/iffyuva/social-buttons/blob/master/lib/social_buttons/engine.rb

Perhaps your view doesn't inherit from this base class for some reason? If so, you can include it manually...

https://github.com/iffyuva/social-buttons/blob/master/lib/social_buttons/view_helper.rb

Try running the specs and see what you get. Could also be an autoload issue. Are you using JRuby by any chance?

@hopewise

I am using it in a haml file, how would a haml file inherits from ActionView::Base class ?

I tried to include it like this

module ApplicationHelper
include SocialButtons
end

But I got uninitialized constant ActionView::Base::SocialButtons

I really I appreciate your help, as I am from a C#, .NET background, and I am still need a hand, I am using Ruby in RubyMine, I am not using JRuby ..

@iffyuva
Owner

hi @hopewise, i shall look into this issue this weekend. thanks for reporting.

@hopewise
@kristianmandrup
Collaborator

Try fx ActionView::Base.methods.sort or ActionView::Base.methods.grep(/twitter/).sort

@neokain

+1

@kristianmandrup
Collaborator

Does it work without HAML?

http://haml.info/docs/yardoc/ActionView/Base.html

Looks like HAML extends ActionView::Base with haml compile/template/ render methods. I don't think using HAML is the problem...?

@ldewald

Having the same problem but with like_button

@kristianmandrup
Collaborator

Someone please debug and fix this! Should not be that hard. Simply clone it to your own repo, then reference your local clone in your Gemfile and debug from there ;) Have fun!!

@kristianmandrup
Collaborator

Looks like there is a branch minor-fixes that needs to be merged. I'm on it ;)

@iffyuva
Owner

@kristianmandrup, there are some changes on master branch of your social-button version. can you open a PR? Thanks.

@kristianmandrup
Collaborator

Released a new version where all specs pass on my side. Does it work for you now? I'm sorry, I have to go in 5 mins. Just had a few mins to spare...

@matthias9999

Still does not work // undefined method, at least not on Rails 4.
It seems that it installs in the bundle, but it doesnt. config/initializers, etc. are missing.

@kristianmandrup
Collaborator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.