Forum: Radiant CMS View helpers in extensions

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Aa66a9785f0aa063cc259cc1327a43d8?d=identicon&s=25 Nathan Wright (Guest)
on 2007-03-15 17:56
(Received via mailing list)
I'm still working on my asset handling plugin and I find myself needing
a
traditional rails helper method; i.e., something that I can call from a
page view and use to dynamically modify/insert stuff into the page. I've
been trying to add this functionality by creating a helper module (let's
call it "assets_helper.rb") to assist my controller (let's call it
"assets_controller.rb").

My helper is found in the following path

      /radiant_app/extensions/assets/app/helpers/assets_helper.rb

but for some reason it doesn't seem to be loaded when the rest of the
radiant app starts ... none of the methods defined in it are available
to
my views.

Is this a known problem, or am I just doing something wrong? Any
guidance
would be greatly appreciated.
48c5df7e9c3b82fc99dfe96d4b6f264e?d=identicon&s=25 Kevin Ansfield (Guest)
on 2007-03-15 18:09
(Received via mailing list)
I ran into a similar issue earlier (I'm porting the Mephisto asset
manager
over to Radiant extensions) and would be very interested in an answer to
the
same question.

Along the same lines, I'd also like to be able to extend the overall
application helper and application.rb from within an extension - is this
possible?

Thanks,
Kevin Ansfield


On 3/15/07, Nathan Wright <nathan.e.wright@gmail.com> wrote:
>       /radiant_app/extensions/assets/app/helpers/assets_helper.rb
> _______________________________________________
> Radiant mailing list
> Post:   Radiant@lists.radiantcms.org
> Search: http://radiantcms.org/mailing-list/search/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>



--
BN23 Search Limited is Registered in England
Company Number: 5323555
VAT registration Number: 896 69 0062

BN23 Search Limited
Temple Grove
Compton Place Road
Eastbourne
East Sussex
BN20 8AD
6ec6f77ea603dd75b3a7a7775b059e79?d=identicon&s=25 John W. Long (Guest)
on 2007-03-15 19:30
(Received via mailing list)
Nathan Wright wrote:
>
> but for some reason it doesn't seem to be loaded when the rest of the
> radiant app starts ... none of the methods defined in it are available to
> my views.

You know, I don't think we are doing anything special right now to
ensure that helpers are loaded. Probably we have to notify Rails of the
new helper directories, but we aren't doing that right now.

Could you investigate a little more and let us know what we need to do?

--
John Long
http://wiseheartdesign.com
8f93a872e399bc1353cc8d4e791d5401?d=identicon&s=25 Mislav MarohniÄ? (mislav)
on 2007-03-15 23:50
(Received via mailing list)
On 3/15/07, John W. Long <ng@johnwlong.com> wrote:
>
> Could you investigate a little more and let us know what we need to do?


"app/helpers" are added to default load paths on app init:
http://dev.rubyonrails.org/browser/trunk/railties/...
http://dev.rubyonrails.org/browser/trunk/railties/...

You should do the same manually with your helpers directory... or teach
Radiant extension system how to do it for you
This topic is locked and can not be replied to.