All I actually wanted to do was to add some helper methods for my
views.
I kind of "solved" the problem by rethinking my approach, as I could
see I had gone down a "blind alley".
module ApplicationHelper
def self.auth_assist_helpers
include AuthAssistant::ViewHelpers
end
end
module AuthAssistant
module ViewHelpers
include AuthAssistant::ViewHelpers::AuthLink
include AuthAssistant::ViewHelpers::RestLink
include AuthAssistant::ViewHelpers::AuthMenuItem
end
end
--
In my Rails app I can now do the following to have them added. Don't
know how to do a similar feat from my gem, since there is a loading/
timing issue then?
module ApplicationHelper
auth_assist_helpers
end
and all the methods are included into ApplicationHelper and hence
available for my views, and link_to works as expected from within this
context. Not sure if this is the "right" approach however, polluting
the ApplicationHelper seems kind of crude. How is the UrlHelper
integrated and made available for the views I wonder?
I used the previous approach, coz that was what I had seen in code
elsewhere, such as in cancan, devise etc. Adding method to
ActionController and certain methods made available as helper methods
using helper_method :xxxx
Thanks!
> That's because the controller itself has its own implementation of
> url_for, if you attempt to reuse those helpers in the controller it's
> just not going to work. Given that link_to is defined in the same
> module as the view's url_for, you probably won't be able to get this
> working without serious hacks or code duplication. But I'd question
> what you're trying to do here, why are your controllers generating
> html without using views?
>
> --
> Cheers
>
> Koz
>
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.