Formtastic: Forms Made Crazy Easy for Rails Developers
Formtastic is a Rails plugin by Justin French that aims to take the headaches out of building forms in Rails views. To build it, Justin wrote down how he'd like a form creation DSL to look and then worked backwards to building the code necessary to implement that DSL. The result is a very obvious and straightforward form creation DSL.
Formtastic doesn't just make it easy to whip up basic forms, though. It has some significant advantages over similar plugins:
- It's Rails 2.3 ready
- It's under active development (the last update was yesterday)
- It supports internationalization
- It has full spec coverage
- It can handle belongs_to, has_many, and has_and_belongs_to_many associations out of the box, rendering multi-selects and radio inputs where necessary!
- It doesn't screw around with the existing Rails form helpers
Here's a large form example straight from Formtastic's documentation (which is pretty thorough, you'll be glad to know):
<% semantic_form_for @article do |form| %> <% form.inputs :name => "Basic" do %>
<%= form.input :title %>
<%= form.input :body %>
<%= form.input :section %>
<%= form.input :publication_state, :as => :radio %>
<%= form.input :category %>
<%= form.input :allow_comments, :label => "Allow commenting on this article" %>
<% end %> <% form.inputs :name => "Advanced" do %>
<%= form.input :keywords, :required => false, :hint => "Example: ruby, rails, forms" %>
<%= form.input :extract, :required => false %>
<%= form.input :description, :required => false %>
<%= form.input :url_title, :required => false %>
<% end %> <% form.inputs :name => "Author", :for => :author do |author_form| %>
<%= author_form.input :first_name %>
<%= author_form.input :last_name %>
<% end %> <% form.buttons do %>
<%= form.commit_button %>
<% end %> <% end %>
The result is a clean bundle of HTML. Groovy, right? So get reading the documentation and give it a try. It's an awesome plugin.
Formtastic: Forms Made Crazy Easy for Rails Developers的更多相关文章
- Ruby on Rails 初次冲浪体验
为了更好的阅读体验,欢迎訪问 作者博客原文 Rails is a web application development framework written in the Ruby language. ...
- Ruby On Rails 常用的精品Gem汇总
首先需要注明一点,本文是原创的并不是从其它地方转载.所有的数据是我从 GitHub 和 RubyGems 上码下来的,数据的截取时间就是本文的发布日期. RubyGems 的下载量可以看到在用这个 g ...
- (转)Ruby On Rails 推荐 Gem 列表
作者:尘缘,QQ:130775,来源:http://www.4wei.cn/archives/1002157 PHP的包管理Composer还在刚刚兴起的阶段,Ruby社区已经有很多成熟的Gem了,R ...
- JavaScript资源大全中文版(Awesome最新版)
Awesome系列的JavaScript资源整理.awesome-javascript是sorrycc发起维护的 JS 资源列表,内容包括:包管理器.加载器.测试框架.运行器.QA.MVC框架和库.模 ...
- Top 22 Free Responsive HTML5 Admin & Dashboard Templates 2018
Top 22 Free Responsive HTML5 Admin & Dashboard Templates 2018 May 18, 2018 Alex Ivanovs Website ...
- How To: Samba4 AD PDC + Windows XP, Vista and 7
dnsmasq If you've been struggling with Samba3 domain controllers and NT4 style domains working with ...
- Knockout 新版应用开发教程之Observable Arrays
假如你想到侦测和相应一个对象的改变,假如你想要侦测和响应一一组合集的改变,就要用observableArray 在许多场景都是很有用的,比如你要在UI上需要显示/编辑的一个列表数据集合,然后对集合进行 ...
- Git工作流指南:Gitflow工作流 Comparing Workflows
Comparing Workflows The array of possible workflows can make it hard to know where to begin when imp ...
- git workflows
https://www.atlassian.com/git/tutorials/comparing-workflows Comparing Workflows The array of possibl ...
随机推荐
- vc6.0 PK vs2010
从VC++6.0不足看VisualC++2010新特性 说起VC,有人想到维生素C(维C),有人想到风险投资(venture capital), 程序员们尤其是做底层开发的程序员或老程序员们第一感觉肯 ...
- Android Studio注释摸版配置
随意创建一个类,就会自动生成注释摸版: 配置后的效果: 以下步骤是配置过程: 1.在创建类的过程中,对类进行自定义摸版,只需在 File->Settins->Editor->File ...
- Oracle 监听服务启动不了
解决方法: 重新生成listener.ora文件 实施步骤 1,打开Net Configuration Assistant 2, 3, 4, 5, 6, 7,
- supervisord 启动失败 Error: Another program is already listening on a port that one of our HTTP serve...
Linux系统中 Supervisor 配置守护进程: 启动Supervisor 服务语句: supervisord -c /etc/supervisor/supervisord.conf 这个过程可 ...
- go语言的null值问题
关于go语言数据库存储和显示null值的问题困扰了我很久,并且也和群友讨论过这个问题,但是都没有得到相对满意和全面的答案.最近FQ找了几篇相对详细和权威的文章,分享给大家,希望和大家一起进步,go g ...
- 900. RLE Iterator
Write an iterator that iterates through a run-length encoded sequence. The iterator is initialized b ...
- zoj2893 Evolution(矩阵快速幂)
题意:就是说物种进化,有N种物种,编号是0——N-1,M次进化后,问你编号为N-1的物种有多少数量:其中要注意的就是i物种进化到j物种的概率是p:(那么剩下的不要忘了):所以单位矩阵初始化对角线的值为 ...
- POJ 1577Falling Leaves(二叉树的建立)
题目链接:http://poj.org/problem?id=1577 解题思路:题目是中文就不翻译了,网上都说这题很水,但本蒟蒻虽然知道是倒过来建立二叉搜索树,可是实现不了,得到小伙伴的关键递归思想 ...
- 深入理解 js this 绑定机制
函数调用位置 与词法作用域相反的是,this的指向由函数运行时决定,它是动态的,随着函数调用位置变化而变化. 要理解 this,首先要理解调用位置:调用位置就是函数在代码中被调用的位置(而 不是声明的 ...
- celery初始化
# 在任务处理者一端加初始化 import os import django os.environ.setdefault("DJANGO_SETTINGS_MODULE", &qu ...