Skip to content

Instantly share code, notes, and snippets.

@23inhouse
Created September 2, 2012 06:24
Show Gist options
  • Save 23inhouse/3595332 to your computer and use it in GitHub Desktop.
Save 23inhouse/3595332 to your computer and use it in GitHub Desktop.
Installation

Installation

https://github.com/plataformatec/simple_form

http://railscasts.com/episodes/234-simple-form-revised

# Gemfile

gem 'simple_form'
bundle
rails g simple_form:install --bootstrap

Usage

# app/views/blogs/_form.html.rb

<%= simple_form_for @blog, :html => { :class => 'form-horizontal' } do |f| %>

  <%= f.input :name %>
  <%= f.input :body, :input_html => { :rows => 6 } %>
  <%= f.input :state,
              :as => :radio_buttons,
              :collection => ['SA', 'WA'],
              :item_wrapper_class => 'inline' %>

  <div class="form-actions">
    <%= f.button :submit, :class => 'btn-primary' %>
    <%= link_to t('.cancel', :default => t("helpers.links.cancel")),
                blogs_path, :class => 'btn' %>
  </div>

<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment