Sreeraj Chundayil
Sreeraj Chundayil

Reputation: 5859

How to interface html form with rails

Recently I downloaded a html template hoping I might be able to use it with rails. But I am stuck at the form template itself. I know how to use form_for and simple_form_for. But I don't know how to make a nice UI so is using the template.

A part of the form is

<form class="form-signin" action="sessions_path" method="post">

But this gives error saying [GET] "/sessions_path" routes not found. Why is this happening?

But when I use form_tag instead of form the sessions_path works fine.

I googled this ,couldn't find any related posts.

Upvotes: 0

Views: 34

Answers (1)

IngoAlbers
IngoAlbers

Reputation: 5802

It's because form tag can use the rails route, while in pure html you will not have access to it.

Check out http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-form_tag to see what the form_tag function actually generates.

In your case it would should probably be:

<form class="form-signin" action="/sessions" method="post">

Upvotes: 2

Related Questions