Coder Social home page Coder Social logo

Comments (6)

tomkra avatar tomkra commented on May 19, 2024

Hello @Rockster160 , did you resolved your issue? I have no problem with calling fa_icon helper method. Methods provided by this gem will be accessible only in your views and representers. If you want to call it in models or controllers, you will have to include it manually.

from font_awesome5_rails.

Rockster160 avatar Rockster160 commented on May 19, 2024

I was calling the methods within views and never got it working. I eventually defined my own helper that generates the html.

It's possible it's related to the fact that the views were in a namespaced file? So instead of
views/users/index it was in views/v2/users/index - I don't see why that would cause an issue, but that's the only thing I can see that's different.

from font_awesome5_rails.

tomkra avatar tomkra commented on May 19, 2024

No that shouldn't cause any problems. I use this gem in many projects and everything works as expected even in namespaced views. Maybe if you use some gem, that have dependency on older font-awesome gem this could cause problem (but you shouldn't get undefined method).

Try call fa5_icon instead of fa_icon in your view and see if it resolve your issue.

from font_awesome5_rails.

Rockster160 avatar Rockster160 commented on May 19, 2024

fa5_icon has the same issue. When called from a view, an error is raised:

NoMethodError at /.../...
undefined method `fa5_icon' for #<#<Class:0x00007fcefc01b0f8>:0x00007fcefc02a738>

from font_awesome5_rails.

AFlowOfCode avatar AFlowOfCode commented on May 19, 2024

I noticed this on a mailer template, but given the style requirements for an email it doesn't really make sense to use it there.

from font_awesome5_rails.

dedemenezes avatar dedemenezes commented on May 19, 2024

Any solutions on this?

undefined method `fa_icon' for #<ActionView::Base:0x000000000112b0>

rails version 6.1.4.1
ruby version 2.7.4p191 (2021-07-07 revision a21a3b7d23)

from font_awesome5_rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.