Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

check_box_tag default checked for remember me

I am creating a login system and would have a remember me checkbox. I would like to make this checkbox default to checked so that the user can uncheck if they do NOT want to be remembered.

Currently I have

<%= label_tag :remember_me %>
<%= check_box_tag :remember_me, 1, params[:remember_me] %>

How do I add the option to default this to checked?

This seems like it should be simple, but I've tried looking at the api and monkeying with my code to make it work, but no luck! Any help would be greatly appreciated.

like image 885
Rapture Avatar asked Sep 10 '11 13:09

Rapture


1 Answers

This should work.

 <%= check_box_tag :remember_me, :checked => true %>
like image 133
PlankTon Avatar answered Sep 22 '22 06:09

PlankTon