Hi there,
is there a way in Rails to use helpers in an Initializer ?
If yes, how ?
If no, where else to put the code needed in the Initializer (as well as
in views) ? In the application_controller.rb ?
Thanks for any hints!
Tom
Hi there,
is there a way in Rails to use helpers in an Initializer ?
If yes, how ?
If no, where else to put the code needed in the Initializer (as well as
in views) ? In the application_controller.rb ?
Thanks for any hints!
Tom
Tom Ha wrote:
Hi there,
is there a way in Rails to use helpers in an Initializer ?
You should never need to. Helpers are only for generating view code,
and you shouldn’t be doing that in initializers.
If yes, how ?
If no, where else to put the code needed in the Initializer (as well as
in views) ? In the application_controller.rb ?Thanks for any hints!
Tom
What are you trying to achieve?
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
Sent from my iPhone
What are you trying to achieve?
Basically, I put some Rufus scheduler code in the Initializer folder so
the scheduler runs fine, even when the hoster needs to reboot the
machine for whatever reason and without my knowledge.
The Rufus scheduler includes some .pdf-generating code (amongst other
features). The .pdf must display numbers in a special format. And until
now, I used helper code to get the numbers into this format, so it would
have been convenient to use the same helper within this Rufus scheduler
initializer…
Thanks!
Tom Ha wrote:
The .pdf must display numbers in a special format. And until now, I
used helper code to get the numbers into this format, so it would
have been convenient to use the same helper within this Rufus
scheduler initializer…
To my casual eye this seems like something that should go in as a
routine a library file and that routine should be called both in your
helper and in your initializer. It just needs a small amount of
refactoring as your needs have changed.
Bob
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs