Sha256: 79a297cb98318c9ea1f27717d6ada9c7bbe893700584475da4f4e0934cc3fbfb
Contents?: true
Size: 1.4 KB
Versions: 4
Compression:
Stored size: 1.4 KB
Contents
h1. About Formidable takes care about your forms. You write a class and * Get logic out of your views. * Get logic out of your controllers (presenter pattern). * Validations will work even if the form can't be mapped directly to the models. * You can unit test your forms directly without touching the template layer at all. * Validations * Coercions Forms contains quite complex logic which definitely shouldn't be in your views h2. Defining Forms h2. Saving Forms h2. Validations h2. Renderers h2. Custom Fields h2. Ideas JS validation plugin h1. Usage h2. Form Definitions <pre> </pre> h2. Controller Code <pre> class Posts def new @form ||= PostForm.new @form.attributes[:method] = "POST" end def edit @form ||= PostForm.new @form.attributes[:method] = "PUT" end def create(raw_data) @form = PostForm.new(nil, raw_data) if @form.save redirect url(:posts) else self.new end end def update(id, raw_data) @form = PostForm.new(nil, raw_data) if @form.update(id) redirect url(:posts) else self.edit end end end </pre> You can find more examples at the @examples@ directory. h1. Links * "Source Code":http://github.com/botanicus/formidable * "Wiki":http://wiki.github.com/botanicus/formidable * "API Docs":http://rdoc.info/projects/botanicus/formidable * "Bug reporting":http://github.com/botanicus/formidable/issues
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
formidable-0.1.2 | README.textile |
formidable-0.1.1 | README.textile |
formidable-0.1 | README.textile |
formidable-0.0.1 | README.textile |