moexmen / foosball-leaderboard

Who's the best at foosball?
3 stars 2 forks source link

Handle match validation #13

Closed ivantjh closed 8 years ago

ivantjh commented 8 years ago

@moexmen/interns

weiqingtoh commented 8 years ago

Generally speaking you can also make use of ActiveRecord Validations, which floats up errors if you use @match.save or @match.update. For example, given that you did it at the models:

@match = Match.find(:id)
@match.x = 'y' # update some wrong values
@match.save # returns false
@match.errors # outputs all the errors. 

You can give it a go at rails console to try it out.

chesterhow commented 8 years ago

Duplicate player validation not working for latest commit. @moexmen/interns