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 <[EMAIL PROTECTED]> 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
[email protected]
http://rubyforge.org/mailman/listinfo/camping-list

Reply via email to