undefined method `fa_icon' for #... #86

Closed
matheusvetor opened this Issue Apr 3, 2014 · 10 comments

Comments

Projects
None yet
5 participants
@matheusvetor

Hi, i'm using the font-awesome-rails in my Rails Engine and show this error when i try to use the fa_icon helper in my layout: "undefined method `fa_icon' for #<#Class:0x00000102dff310:0x00000102a97b00>".
Rails Version: 4.0.4

@rmm5t

This comment has been minimized.

Show comment
Hide comment
@rmm5t

rmm5t Apr 3, 2014

Collaborator

Does this issue comment help?
#65 (comment)

In other words, what does your Gemfile look like?

Collaborator

rmm5t commented Apr 3, 2014

Does this issue comment help?
#65 (comment)

In other words, what does your Gemfile look like?

@matheusvetor

This comment has been minimized.

Show comment
Hide comment
@matheusvetor

matheusvetor Apr 4, 2014

gem "rails", "> 4.0.4"
gem 'rails-i18n'
gem 'jquery-rails'
gem 'font-awesome-rails'
gem 'sass-rails', '
> 4.0.2'
gem 'compass-rails'
gem 'uglifier', '>= 1.3.0'
gem 'cancan'
gem 'simple_form'
gem 'carrierwave'
gem 'foreigner'
gem 'friendly_id'
gem 'mini_magick'
gem 'will_paginate', '3.0.5'
gem 'newrelic_rpm'
gem 'cocoon'
gem 'inherited_resources'
gem 'html5shiv-rails'
gem 'slim'
gem "devise"
gem "devise-i18n"

gem "rails", "> 4.0.4"
gem 'rails-i18n'
gem 'jquery-rails'
gem 'font-awesome-rails'
gem 'sass-rails', '
> 4.0.2'
gem 'compass-rails'
gem 'uglifier', '>= 1.3.0'
gem 'cancan'
gem 'simple_form'
gem 'carrierwave'
gem 'foreigner'
gem 'friendly_id'
gem 'mini_magick'
gem 'will_paginate', '3.0.5'
gem 'newrelic_rpm'
gem 'cocoon'
gem 'inherited_resources'
gem 'html5shiv-rails'
gem 'slim'
gem "devise"
gem "devise-i18n"

@rmm5t

This comment has been minimized.

Show comment
Hide comment
@rmm5t

rmm5t Apr 4, 2014

Collaborator

Okay, I was just confirming that font-awesome-rails wasn't in some other bundler group that might not get loaded at runtime.

Sanity check. You also remembed to bundle install and restart your rails environment after adding font-awesome-rails to the Gemfile, correct?

Collaborator

rmm5t commented Apr 4, 2014

Okay, I was just confirming that font-awesome-rails wasn't in some other bundler group that might not get loaded at runtime.

Sanity check. You also remembed to bundle install and restart your rails environment after adding font-awesome-rails to the Gemfile, correct?

@matheusvetor

This comment has been minimized.

Show comment
Hide comment
@matheusvetor

matheusvetor Apr 4, 2014

Ok. This error is on development mode, i have another app which uses this gem in production without problem. Maybe the problem is because it is a mountable engine. I have never worked with a mountable engine. These gems were being called in gemspec but I moved to the Gemfile and did not work.

Ok. This error is on development mode, i have another app which uses this gem in production without problem. Maybe the problem is because it is a mountable engine. I have never worked with a mountable engine. These gems were being called in gemspec but I moved to the Gemfile and did not work.

@rmm5t

This comment has been minimized.

Show comment
Hide comment
@rmm5t

rmm5t Apr 4, 2014

Collaborator

The mountable engine includes font-awesome-rails?

Yeah, I don't think we have an automated test case for that scenario, so I'm interested in what you find.

Collaborator

rmm5t commented Apr 4, 2014

The mountable engine includes font-awesome-rails?

Yeah, I don't think we have an automated test case for that scenario, so I'm interested in what you find.

@matheusvetor

This comment has been minimized.

Show comment
Hide comment
@matheusvetor

matheusvetor Apr 4, 2014

My mountable engine will work like rails_admin. Will be an administrative area to others apps

My mountable engine will work like rails_admin. Will be an administrative area to others apps

@matheusvetor

This comment has been minimized.

Show comment
Hide comment
@matheusvetor

matheusvetor Apr 4, 2014

I solved the problem only by including the FontAwesome::Rails::IconHelper in my helper file.

Thanks, @rmm5t

I solved the problem only by including the FontAwesome::Rails::IconHelper in my helper file.

Thanks, @rmm5t

@jacek213

This comment has been minimized.

Show comment
Hide comment
@jacek213

jacek213 Dec 29, 2014

@matheusvetor, thank you, worked for me too :)

@matheusvetor, thank you, worked for me too :)

@oniofchaos

This comment has been minimized.

Show comment
Hide comment
@oniofchaos

oniofchaos Feb 11, 2015

This worked for me too. I added include FontAwesome::Rails::IconHelper to engine_name/app/helpers/engine_name/application_helper.rb.

This worked for me too. I added include FontAwesome::Rails::IconHelper to engine_name/app/helpers/engine_name/application_helper.rb.

@itskingori

This comment has been minimized.

Show comment
Hide comment
@itskingori

itskingori Jun 17, 2015

This happens if you have include_all_helpers to false.

In previous versions of Rails the controller would include a helper whose name matches that of the controller, e.g., MyController will automatically include MyHelper. In Rails >= 3.1 helpers are available to all views, all the time. So some people set include_all_helpers config to false to return old behavior .

config.action_controller.include_all_helpers = false

In the above case then adding include FontAwesome::Rails::IconHelper fixes the problem.

This happens if you have include_all_helpers to false.

In previous versions of Rails the controller would include a helper whose name matches that of the controller, e.g., MyController will automatically include MyHelper. In Rails >= 3.1 helpers are available to all views, all the time. So some people set include_all_helpers config to false to return old behavior .

config.action_controller.include_all_helpers = false

In the above case then adding include FontAwesome::Rails::IconHelper fixes the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment