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

Not working for the instances methods defined in modules #12

Open
mohitjain opened this issue Apr 26, 2013 · 9 comments
Open

Not working for the instances methods defined in modules #12

mohitjain opened this issue Apr 26, 2013 · 9 comments
Labels

Comments

@mohitjain
Copy link

Even this

    PerformLater::Plugins.add_finder(CustomMoudule) 

is not helping out..

@KensoDev
Copy link
Owner

Hey @mohitjain,

Can you please provide a better code sample of what you are trying to achieve?
Any sort of sample that I can better understand what's going on would be great!

@mohitjain
Copy link
Author

Think about this simple case:

   class Answer < ActiveRecord::Base
      Include MyCustomModuleDefinedInLibDirectory
      # relationships etc are defined here.
      after_commit :call_to_a_instance_method, :on => :create
  end

How module is defined:

 module MyCustomModuleDefinedInLibDirectory
    def self.included(base)
        base.extend(ClassMethods)
    end

  module ClassMethods
    def any_class_method
      # some class method code
    end
  end


  def call_to_a_instance_method
    # doing some stuff here.. Like sending email or setting up some other things..
  end
  later :call_to_a_instance_method   # this will crash here.. Application will throw a error ie later is not not defined
end

@KensoDev
Copy link
Owner

ah!

gotcha.

A simple fix while I investigate a fix for this will be to have the later calls after the include myCustomLibrary.

I will look into fixing this

@KensoDev
Copy link
Owner

Labeled this as bug.

@mohitjain
Copy link
Author

@KensoDev any updates?

@KensoDev
Copy link
Owner

@mohitjain Sorry for the delay on this, I have been on vacation for the past 10 days, will get to it very soon.

@mohitjain
Copy link
Author

@KensoDev No worries :)

@mohitjain
Copy link
Author

@KensoDev any updates?

@manoj2411
Copy link

Here is a quick hack, you can directly include the Later::Method module in your custom module like:

module MyCustomModuleDefinedInLibDirectory
    include Resque::Plugins::Later::Method
    ...
end

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

No branches or pull requests

3 participants