Date Helpers?

Michael Gorsuch michael.gorsuch at gmail.com
Mon Oct 23 09:05:25 EDT 2006


Thanks, zimbatm.  I'll dig into this later tonight.  I appreciate the
pointer.

On 10/23/06, Jonas Pfenniger <zimba.tm at gmail.com> wrote:
>
> Here is an example :
>
> module DateHelper
>
>   def select_day(date, options={})
>     default_opts = { :name => 'day' }
>     options = default_opts.merge(options)
>     select opts do
>       for each day in month of date "date" do |d| # replace that with
> valid code
>         if d == date.mday
>           option d, :selected=>'selected'
>         else
>           option d
>         end
>     end
>   end
>
> end
>
>
> You can then use that module in your application like that :
>
> Camping.goes :YourApp
>
> module YourApp::Helpers
>   include DateHelpers
> end
>
> And now you have some new methods in your view and controllers.
>
>
> On 23/10/06, Michael Gorsuch <michael.gorsuch at gmail.com> wrote:
> > Does anyone have any ideas off the top of there head how to easily
> construct
> > a date helper as one would see in Rails?
> >
> > Thanks,
> >
> > Michael Gorsuch
> > http://www.styledbits.com
> >
> >
>
>
> --
> Cheers,
>   zimbatm
>
> http://zimbatm.oree.ch
> _______________________________________________
> Camping-list mailing list
> Camping-list at rubyforge.org
> http://rubyforge.org/mailman/listinfo/camping-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/camping-list/attachments/20061023/0c1ac0ee/attachment.html 


More information about the Camping-list mailing list