![](https://secure.gravatar.com/avatar/b5b35f30b6a4da257f9b9edbd22a6bdd.png?default=mp&rating=pg&size=250)
yuvsaha123
Joined
Activity
Posted in update a model attribute with the ujs ?.
Hello,
have a page that displays games(model) with a select box for the game result outcome. Game model has_one :result, autosave: true and
I have a unique id for each row in the table based on the game id and I am using materialize rails which attaches a class of "active selected" to whichever choice is selected in the select dropdown(these correspond to the enum keys. i would like to use ujs to update the result whenever the user selects from the select dropdown. I am haven't done much with ujs in rails but it seems like it should be fairly simple. Can anyone give some guidance on how this would be setup?
result model has:
enum outcome: {
undecided: 0,
white_won: 1,
black_won: 2,
white_forfeit: 3,
black_forfeit: 4,
draw: 5,
}
thanks
yuvsaha