I have some code that is simply formatting and parsing URLs and I really don''t want to associate it with a view or a controller or a model - I just want it to be available as a utility class. Where should this utility class go? I would have to import it into my controller using "require" correct? Thanks, Wes -- Posted via http://www.ruby-forum.com/.
Try putting it in a helper. If you want it to be available for all views put it in application_helper.rb Wes Gamble wrote:> I have some code that is simply formatting and parsing URLs and I really > don''t want to associate it with a view or a controller or a model - I > just want it to be available as a utility class. > > Where should this utility class go? > > I would have to import it into my controller using "require" correct? > > Thanks, > Wes > >-- Sau Sheong http://blog.saush.com http://read.saush.com http://jaccal.sourceforge.net
I don''t want to use it from a view - I want to use it from a controller or model. Chang Sau Sheong wrote:> Try putting it in a helper. If you want it to be available for all views > put it in application_helper.rb > > Wes Gamble wrote: >> >> > > > -- > Sau Sheong > > http://blog.saush.com > http://read.saush.com > http://jaccal.sourceforge.net-- Posted via http://www.ruby-forum.com/.
Chang Sau Sheong
2006-Apr-17 17:44 UTC
[Rails] Re: Best place for generic utility classes?
You can put it as a library, just include it in your controller or model. Alternatively if it''s for controllers only you might want to put it in application.rb which is the base class for all controllers, you don''t need to include a library then. Wes Gamble wrote:> I don''t want to use it from a view - I want to use it from a controller > or model. > > Chang Sau Sheong wrote: > >> Try putting it in a helper. If you want it to be available for all views >> put it in application_helper.rb >> >> Wes Gamble wrote: >> >>> >>> >> -- >> Sau Sheong >> >> http://blog.saush.com >> http://read.saush.com >> http://jaccal.sourceforge.net >> > > >-- Sau Sheong http://blog.saush.com http://read.saush.com http://jaccal.sourceforge.net -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060417/424c0b86/attachment-0001.html
Hi Please advice i have ACR38 and a mcr200and i would like to know how to read and write an Emv ic chip card. i need help with this regard, im willing to pay a price. Thanks Sops -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/e6697ba30b685efc626416c2c732f1c5%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.