May 1, 2014
Using SimpleForm for well... simplifying forms
Getting input from users is at the core of any application. This week we're going to play with simple_form as an easy way to build our custom forms.
simple_form lets us clean up the ugly default scaffolded view code in all those _form.html.erb
partials, and replace it with clean semantic code.
Pre-Requisites
We're going to start with https://github.com/rails-school/simple_tracker, which assumes you have ruby-2.1.1 installed (rvm install ruby-2.1.1
). After running the following, you should be able to browse to http://localhost:3000 to see a mostly empty application:
> git clone https://github.com/rails-school/simple_tracker
> cd simple_tracker
> bundle install
> rails server
In case you're interested, this repo was created by:
- following the README on https://github.com/RailsApps/rails_apps_composer to create a new bootstrap+rails+slim app
- adding
gem simple_form
to theGemfile
and runningbundle install
- running
rails g simple_form:install
References
Formtastic, a similar library that you may prefer
2:30pm Pacific - 4:30pm Pacific on May 1, 2014
at
Coshx Labs
3 students were there