2

I'm using a codepen frontend template in my Ruby on Rails project so now i'm unable to connect my css file with my login.html.erb, like in this code, for submit button i want to use the "submit" class which i have styled in my css file. Also the final rendered page i not stylised which brought me to the conclusion that css file is not getting connected. Please be precise on your answer as I'm a complete beginner as this is my first RoR project. Codepen Template and My Rails Project and My login.html.erb file.

<h2>Welcome back,</h2>
 <%= form_tag("/create_session", method: :get) do %>
      Username :<%= text_field_tag(:username) %><br>
      Password :<%= password_field_tag(:password) %><br>
    <%= submit_tag(:Login), class => "submit" %>
 <% end %>

I'm getting the following error:-

app/views/sessions/login.html.erb:22: syntax error, unexpected ',', expecting ')'

1 Answer 1

3

If you want to declare a css class for the submit_tag you can do it using :class => "class_name", or better if it would be like class: "class_name".

So you could try with:

<%= submit_tag(:Login), :class => "submit" %>
<%= submit_tag 'Login', class: "submit" %> <!-- recommended way -->
Sign up to request clarification or add additional context in comments.

3 Comments

That worked @Sebastian but what about the css connection, the page is not getting the desired look as the css file is not getting connected to the login page. Expectation vs Reality My login.html.erb file.
I've cloned the repo, but doesn't have such changes, could you update it and to see what's missing?
Now clone again @Sebastian, i've made some changes and committed again as 'Frontend Incomplete'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.