Skip to main content
6 events
when toggle format what by license comment
Nov 18, 2015 at 17:17 comment added Flambino @Spike True, but I'd rather have Ruby raise a NoMethodError if I've misspelled, .odd_weks? (sic), than silently hit the else case because I've misspelled the same thing in a string.
Nov 18, 2015 at 16:40 comment added Spike You can test question.frequency in the case statement - it returns the string representation of the value (e.g. "odd_weeks")
Nov 16, 2015 at 20:36 vote accept Sebastian Jennings Almnes
Nov 16, 2015 at 20:31 comment added Flambino @SebastianJenningsAlmnes Well, if the point is that you want to reload the record to make sure it's up to date, then, well, there's the reload method. As for the id check, I'd actually forgotten it was there. It should protect you... however: The question may have been deleted from the database since you got that ID. It's unlikely, but if those question records are manipulated elsewhere it might happen. If you're sure they're there, then ok, but you are doing a check leading me to think you're not sure about that.
Nov 16, 2015 at 20:23 comment added Sebastian Jennings Almnes Hi, thanks for the good reply, the question I get is in-fact a real Question record. I see now that I am over-writing it. On your note about recordnotfound I felt that I avoided that by returning false if it's not present. Is that not optimal, if so how would you do it taking this update into account?
Nov 16, 2015 at 20:08 history answered Flambino CC BY-SA 3.0