Question

I am using rails 4.0.2 with ruby 1.9.3. When I use rails scaffold generator like this rails g scaffold Person name:string everything works correctly. But i want to use Slim language for templating, so i added gem 'slim' to my Gemfile. Then changed the file _form.html.erb to this:

- form_for(@person) do |f|
  .field
    == f.label :name
    == f.text_field :name

  .actions
    == f.submit

changed the name to _form.html.slim. But now my form and anything else inside is not rendered at all. Meanwhile if i add something else outside of the form_for, they work. What's the problem here?

Était-ce utile?

La solution

It should be the following. Note that you need to render the form, since form is a html element.

= form_for(@person) do |f|
  .field
    == f.label :name
    == f.text_field :name

  .actions
    == f.submit
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top