0

I'm learning ruby on rails with railstutorial.org and i have problem with listing 7.15 / 7.16 Soo.. this is repo repo

If i add styles in application.css to form_for in users/new.html.erb i have this enter image description here

We see that custom.css does not stylize the input, textarea, select users/new.html.erb

<% provide(:title, 'Sign up') %>
<h1>Sign up</h1>

<div class="row">
  <div class="col-md-6 col-md-offset-3">
    <%= form_for(@user) do |f| %>
      <%= f.label :name %>
      <%= f.text_field :name %>

      <%= f.label :email %>
      <%= f.email_field :email %>

      <%= f.label :password %>
      <%= f.password_field :password %>

      <%= f.label :password_confirmation, "Confirmation" %>
      <%= f.password_field :password_confirmation %>

      <%= f.submit "Create my account", class: "btn btn-primary" %>
    <% end %>
  </div>
</div>

How fix it?

Baum mit Augen
  • 49,044
  • 25
  • 144
  • 182
Drekoo
  • 43
  • 7
  • Please write what you tried and more detail about the problem, also change the title of this. – asosnovsky Dec 28 '17 at 14:05
  • I think the problem is because you are not adding your custom.scss to your application.css. Ideally, you should convert your application.css to application.scss (sass) and then import the custom.scss in there. You are only including the application.css in your layout file and so your custom.css is not being loaded – Taher Dec 28 '17 at 14:07
  • But before adding styles to the form, everything worked so I do not know if it will help – Drekoo Dec 28 '17 at 14:14

1 Answers1

0

I think your custom css file in not loaded. Use following steps:

Put the CSS files in public/stylesheets and then use:

to link to the stylesheet in your layouts or erb files in your views.

TBI
  • 2,789
  • 1
  • 17
  • 21
  • You can check in https://stackoverflow.com/questions/804961/how-do-i-use-css-with-a-ruby-on-rails-application – TBI Dec 28 '17 at 14:37