Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8455871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:23:58+00:00 2026-06-10T12:23:58+00:00

My model, Widget.rb, has include ApplicationHelper and my instance methods have no trouble using

  • 0

My model, Widget.rb, has include ApplicationHelper and my instance methods have no trouble using any method defined in application_helper.rb

However, when I try to use one of the helper methods in any of my class methods such as

def self.send_broadcast(guid)
   track_guids(guid) # defined in application_helper.rb
end

I get No Method error.

Is there some secret handshake to permit use of a ApplicationHelper method inside a class method?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T12:23:59+00:00Added an answer on June 10, 2026 at 12:23 pm

    ApplicationHelper is just a module:

    module ApplicationHelper
      def track_guids(something)
    
      end
    end
    
    class Widget
      extend ApplicationHelper
    
      def self.send_broadcast(guid)
        track_guids(guid)
      end
    end
    

    Now you should have access to the module methods from a class method. I’m not sure if you can both extend and include the same module though… not really sure what that’d do.

    Edit to add:

    I’m not sure what will happen if you try both extending and including the same module into the class. With extend you get the module included at the class-level, with include it is included at the instance-level. It might give you the methods at both class and instance if you do both… or it might die horribly. Give it a try?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this widget: $this->setWidget('slug', new sfWidgetFormDoctrineChoice(array('model' => 'MyTable', 'method' => 'myMethod', 'key_method' =>
Say that I have a data model called Widget . If I pick one
I have a page that has a bunch of widgets on it. Each widget
I have three models: System_Contact System Contact_list The Contact_List model has two fields: contact
In my application, I have a Widget model, a Feature model with a has_many
I have a database that has three columns Maker, Model and Price and I
I have a CGridView widget for Lesson model $this->widget('zii.widgets.grid.CGridView', array( 'id'=>'lesson-grid', 'dataProvider'=>$model->search(), 'filter'=>$model, ...
I have a 'project' model. Each project has a 'gallery' and each gallery has
I have a User model, which :has_many :widgets Here is the 'edit' method: def
I have created a custom widget which has a link to some ajax functionality.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.