-1

I've two controllers:

MainController with pages: index.html.erb
LoginController with pages: login.html.erb, signup.html.erb, pasfor.html.erb

These are my routes

https://gyazo.com/4acf99c74bbb7999d580e32fd1496386

I created

<%= link_to '<li id="login-button"><i class="fa fa-plus"> Create event</i></li>'.html_safe, login_login_path %>

This would redirect from index.html.erb to login.html.erb

I want to set up a button in login.html.erb that's redirect to signup.html.erb. So I did the same thing. The button is there but when I click nothing happens.

<%= link_to '<button type="submit" class="btn btn-default">Register</button>'.html_safe, login_signup_path %>
Laurent S
  • 49
  • 10

1 Answers1

1

It looks like you're using Bootstrap. In Bootstrap, you can create a link that looks like a button with class btn btn-default like this:

<%= link_to 'Register', login_signup_path, class: 'btn btn-default' %>

Bonus: Your first link_to example is a bit off too. You shouldn't really be putting block-level elements like li inside of an inline element like an a.

Consider something like this instead:

<li id="login-button">
  <%# Tip: you can pass a block to `link_to` to nest more complex HTML inside %>
  <%= link_to login_login_path do %>
    <%#
      # Tip: You should close a Font Awesome icon immediately.
      # (Never put content inside of the `i` tag.)
      # %>
    <i class="fa fa-plus"></i> Create event
  <% end %>
</li>
Chris Peters
  • 17,918
  • 6
  • 49
  • 65