How to pre-check checkboxes in formtastic
Posted
by trustfundbaby
on Stack Overflow
See other posts from Stack Overflow
or by trustfundbaby
Published on 2010-04-29T05:23:09Z
Indexed on
2010/04/29
5:27 UTC
Read the original article
Hit count: 300
rails
|ruby-on-rails
I have a form I'm trying to set up ... Users can have many posts, and each post can have many people watching it.
The Watch model is set up polymorphically as 'watchable' so it can apply to different types of models. It has a user_id, watchable_id, watchable_type and timestamps as attributes/fields.
This is soley so that when people comment on a post, users watching the post can get an email about it.
What I'm trying to do is show the user a list of users that they can tag on each post, which is not problem. This is what I'm using right now
The problem with this, is that when you go to edit an update/post ... all the checkboxes are prechecked ... I want it to pre-check only users who are currently watching the post.
© Stack Overflow or respective owner