开发者

Unique rails default form syntax to simple_form syntax?

Some time ago I had this form (in slim templating here) that I was unable to make work with simple_form, after 20 minutes I moved on, but I came back today and am curious about how this would translate in simple_form syntax. I use simple_form and I am familiar with the basic syntax, however I could not get this form to work properly.

= form_tag adminsessions_path do
    = text_field_tag :email, params[:email]
    = password_field_tag :password
    = submit_tag "LOG IN"

This the first I used this, idiom for lack of a better word (it is from the Railscasts diy authentication series recently). I'm just putting this out for interest in comments and gain a deeper understandi开发者_JAVA技巧ng. What I have works for now.


Read through the simpleform documentation: https://github.com/plataformatec/simple_form

There you can find the correct syntax for several use cases, like this one:

    <%= simple_form_for @user do |f| %>
      <%= f.input :username %>
      <%= f.input :password %>
      <%= f.button :submit %>
    <% end %>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜