bokmann / font-awesome-rails

the font-awesome font bundled as an asset for the rails asset pipeline
http://fortawesome.github.com/Font-Awesome/
MIT License
1.86k stars 244 forks source link

Helper not loading #65

Closed creativetags closed 10 years ago

creativetags commented 10 years ago

I'm getting undefined method `fa_icon' after upgrading to version 4.0.3.0

I'm running rails 4.0.1 ruby 2.0.0

rmm5t commented 10 years ago

What version of font-awesome-rails did you upgrade from? Did you restart your development environment after the bundle update?

I just tried everything against Rails 4.0.1 and Ruby 2.0.0-p247. fa_icon worked as expected.

rmm5t commented 10 years ago

Whoops. Didn't mean to close this out just yet. Sorry.

creativetags commented 10 years ago

Tried restarting the development environment, didn't help.

Had been running 4.0.1.0 fine.

rmm5t commented 10 years ago

What's your bundle list look like?

Please also include a snippet of fa_icon's usage.

I need much more information than this to help. I have font-awesome-rails working on many different projects ranging between Rails 3.2 through 4.0 and between FontAwesome 3 through 4.

rmm5t commented 10 years ago

Also, we have a test suite in this repository and gemfiles to help test against different scenarios. If you could get one of those to fail, that would help a lot.

creativetags commented 10 years ago

I'm using HAML so my view snippet: = fa_icon "trash-o"

Here's my bundle list:

Gems included by the bundle:

rmm5t commented 10 years ago

I don't see anything that immediately jumps out other than I recommend using bootstrap-sass instead of bootstrap-rails (others have had issues magically resolved by doing this), but what else was upgraded at the same time you upgraded font-awesome-rails?

creativetags commented 10 years ago

I tried bootstrap-sass there but still not working. I don't have time to troubleshoot this further. Thanks for your suggestions. Hopefully it's just my setup. I'm just going to avoid the helper methods.

rmm5t commented 10 years ago

I don't have time to troubleshoot this further.

@creativetags Okay. I'm closing this issue out for now.

For anyone else who stumbles upon this, has the same issue, and has more time to help us reproduce, please see our new Contribution Guidelines first.

jamesw commented 10 years ago

I am having this same issue in production environment only. Working fine in local development environment

ActionView::Template::Error (undefined method `fa_icon' for #<#Class:0x00000002d3d9a0:0x000000045e14c0>): 20:

21:
jamesw commented 10 years ago

Scratch that. I had to re-boot the server. Just restarting unicorn and nginx didn;t do the trick for reasons I am not sure of just yet, but all is fine.

TrevorS commented 10 years ago

Also having a similar problem:

ActionView::Template::Error (undefined method `fa_icon' for #<#<Class:0x000000038d21f8>:0x00000003142528>):
    5:     </tr>
    6:     <tr>
    7:       <th class="background" colspan="12">
    8:         <%= link_to (fa_icon "arrow-left"), start_date: (@date.beginning_of_week-1) %>
    9:         &nbsp &nbsp &nbsp
    10:         Week # <%= @current_week %>
    11:         &nbsp &nbsp &nbsp
  app/views/gcdr_counter/_content.html.erb:8:in `_app_views_gcdr_counter__content_html_erb___15887223667734331_24525220'
  app/views/gcdr_counter/index.html.erb:4:in `_app_views_gcdr_counter_index_html_erb__516966300444980038_25823060'

I'm using nginx 1.2.4 and passenger 3.0.18.

I've tried killing passenger and restarting nginx, but I haven't tried restarting the machine. I'd like to try to avoid bringing the whole system down, as other web applications are running on it as well.

Here is my bundle list:

Gems included by the bundle:
  * actionmailer (3.2.15)
  * actionpack (3.2.15)
  * activemodel (3.2.15)
  * activerecord (3.2.15)
  * activeresource (3.2.15)
  * activesupport (3.2.15)
  * arel (3.0.3)
  * bootstrap-sass (3.0.2.1)
  * builder (3.0.4)
  * bundler (1.3.5)
  * capistrano (2.15.5)
  * coffee-rails (3.2.2)
  * coffee-script (2.2.0)
  * coffee-script-source (1.6.3)
  * erubis (2.7.0)
  * execjs (2.0.2)
  * font-awesome-rails (4.0.3.0)
  * highline (1.6.20)
  * hike (1.2.3)
  * i18n (0.6.9)
  * journey (1.0.4)
  * jquery-rails (3.0.4)
  * jquery-ui-rails (4.1.0)
  * json (1.8.1)
  * libv8 (3.16.14.3)
  * mail (2.5.4)
  * mime-types (1.25.1)
  * multi_json (1.8.2)
  * mysql2 (0.3.14)
  * net-scp (1.1.2)
  * net-sftp (2.1.2)
  * net-ssh (2.7.0)
  * net-ssh-gateway (1.2.0)
  * polyglot (0.3.3)
  * rack (1.4.5)
  * rack-cache (1.2)
  * rack-ssl (1.3.3)
  * rack-test (0.6.2)
  * rails (3.2.15)
  * railties (3.2.15)
  * rake (10.1.0)
  * rdoc (3.12.2)
  * ref (1.0.5)
  * sass (3.2.12)
  * sass-rails (3.2.6)
  * sprockets (2.2.2)
  * sqlite3 (1.3.8)
  * therubyracer (0.12.0)
  * thor (0.18.1)
  * tilt (1.4.1)
  * treetop (1.4.15)
  * tzinfo (0.3.38)
  * uglifier (2.3.2)

Note: This error only occurs in production.

Thanks!

TrevorS commented 10 years ago

Just rebooted the web server with no luck.

rmm5t commented 10 years ago

@TrevorS Does this problem only happen in your production environment?

TrevorS commented 10 years ago

Yes, only in production.

rmm5t commented 10 years ago

@TrevorS Hmm. I'm a bit baffled at the moment.

  • How do you bundle your gems in production? Are you using bundle install --deployment?
  • What version of Ruby? How was ruby installed?

More info: http://www.modrails.com/documentation/Users%20guide%20Nginx.html#bundler_support

TrevorS commented 10 years ago

I'm using Ruby v1.9.3-p484 installed using rbenv & the ruby-build plugin.

I'm using Capistrano v2.15.5 to deploy to production and my deploy.rb looks like:

# Mediation-Counters deployment script
#
# rbenv / capistrano settings:
# http://henriksjokvist.net/archive/2012/2/deploying-with-rbenv-and-capistrano/

# bundler will handle the gems
require 'bundler/capistrano'

# set the application name
set :application, 'MedationCounters'

# set the bundle flags we want
set :bundle_flags, '--deployment --quiet --binstubs --shebang ruby-local-exec'
# set the path to the bundle executable
set (:bundle_cmd) { "/home/rails/.rbenv/shims/bundle" }
# add the rbenv shims and bin locations to the path
set :default_environment, {
  'PATH' => "/opt/git/bin:$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH"
}

# set the git repoistory location
set :repository, 'git@github.com:ATNI/mediation-counters.git'
# use git for scm
set :scm, 'git'
# set up forwarding of ssh keys
# not currently being used -^
# set :ssh_options, { forward_agent: true }
# deploy using master branch
set :branch, 'master'

# setup the deployment targets for app/web/db (specific db server will be added)
server 'counters.corp.local', :app, :web, :db
# set the deployment user
set :user, 'rails'
# setup deployment location
set :deploy_to, '/var/rails/mediation-counters'
# turn off sudo
set :use_sudo, false
# prevent a full repo clone every time
set :deploy_via, :remote_cache

# setup phusion passenger auto-restarts
namespace :deploy do
  task :start do ; end
  task :stop do ; end
  task :restart, :roles => :app, :except => { :no_release => true } do
    run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
  end
end
yanivyalda commented 10 years ago

I had the same issue in production make sure you move the gem outside the assets group.

rmm5t commented 10 years ago

@yanivyalda Great point. I added some docs to the contribution guidelines debugging steps to help with that scenario.

TrevorS commented 10 years ago

Excellent! I'll test that out in my next deploy. I appreciate your help @rmm5t and @yanivyalda !