Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined local variable or method `tweet_button' #5

Open
hopewise opened this issue Dec 12, 2012 · 14 comments
Open

undefined local variable or method `tweet_button' #5

hopewise opened this issue Dec 12, 2012 · 14 comments

Comments

@hopewise
Copy link

Hi,

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

undefined local variable or method `tweet_button'

Any idea ?

@kristianmandrup
Copy link
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
Copy link
Author

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
Copy link
Owner

iffyuva commented Dec 19, 2012

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

@hopewise
Copy link
Author

ok, thanks

On Wed, Dec 19, 2012 at 1:42 PM, Yuva notifications@github.com wrote:

hi @hopewise https://github.com/hopewise, i shall look into this issue
this weekend. thanks for reporting.


Reply to this email directly or view it on GitHubhttps://github.com//issues/5#issuecomment-11527231.

Kind Regards,

Samir Sabri
Software Architect& Developer
www.dcaclab.com
Jordan-Middle East

@kristianmandrup
Copy link
Collaborator

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

@phuwanart
Copy link

+1

@kristianmandrup
Copy link
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
Copy link

ldewald commented Feb 9, 2013

Having the same problem but with like_button

@kristianmandrup
Copy link
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
Copy link
Collaborator

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

@iffyuva
Copy link
Owner

iffyuva commented Feb 12, 2013

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

@kristianmandrup
Copy link
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
Copy link

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
Copy link
Collaborator

Hi Matthias, when you find a bug like this, what you do is:

  • fork the project
  • create a new branch for your environment (fx #rails4)
  • debug it locally and fix the bugs (for your environment)
  • make a pull request with said branch

Cheers!

Kristian

On Thu, Apr 3, 2014 at 10:52 AM, Matthias Bellmann <notifications@github.com

wrote:

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.

Reply to this email directly or view it on GitHubhttps://github.com//issues/5#issuecomment-39428381
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants