Helper Mixin's

Hey all

Is it possible to create mixins for common functionality that can be
mixed in with other helpers?

I know somone will probally say stick it in the application helper, but
i dont want to include it globally, only in 2 helpers…

Any ideas?

Cheers

Tim

Sure, you can mix-in other mixins. For example:

app/helpers/

  • login_helper.rb
  • emp_login_helper.rb
  • admin_login_helper.rb

emp_login_helper.rb:
require ‘login_helper’
module EmpLoginHelper
include LoginHelper
end

admin_login_helper.rb:
module AdminLoginHelper
include LoginHelper
end

Is that what you’re asking about?

Jason

Ahh yes, i didnt realise you could use include, i had just been trying
require on its own! lol

Many thanks

Tim