Code Monkey home page Code Monkey logo

flexible_date's Introduction

FlexibleDate
============

FlexibleDate plugin provides the better handling of date columns.
With flexible_date_select helper, you can receive invalid data such as {:year => '2010', :month => '', :day => '3'} and
validate it automatically, while you can also keep that value for the edit/new view to show the user what is wrong.

You can get the string value such as '2009-01-01' if you specify the options to flexible_date_column.
(But this plugin does not provide the helper for the string.)

This plugin has been tested on Rails 2.3.3.

Example
=======

It your model class which has the target date column, you can write like this;

class YourModel < ActiveRecord::Base

  flexible_date_column :started_on # You have started_on column which represents a date.

end

This will add some methods to you model class, some of them are used as callback methods, so that you can set a hash to started_on.
Note that this hash must be able to respond to symbol keys.

On the view side, you can use flexible_date_select instead of date_select. This helper holds invalid date values so that the user can see what is wrong.
This plugin does not support non-builder type helper now, but there is a plan to add it later (or please add it).

  <% form_for :your_model do |f| %>
    <%= f.flexible_date_select :started_on %>
  <% end %>


Copyright (c) 2010 nay3 (Yasuko Ohba), released under the MIT license

flexible_date's People

Contributors

nay avatar

Stargazers

 avatar Koichiro Ohba avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.