Thank you Peter. Let me give you a couple of scenarios. I was also just
reflecting what someone advised me to do in another thread – perhaps it
wasn’t the best advice.
I have a little fishing tournament app with a Catch table where all the
catches go. Each catch has a length, from which points are determined.
Depending on the bait (live, artificial, fly) we give a points
adjustment (eg: 10% for lures, 20% for using fly tackle). So I was
trying to update the points field from the size input by the user.
Initially I was doing this in the Catch controller both in the new catch
method and the update/edit method, and I had a bug due to the fact that
I was referencing the old points in the DB record which hadn’t been
committed yet. I got some advice to try the bfore_save callback and
while that worked, the advisor also said it would be more “proper”
MVC-wise to put the actual code in the controller and invoke it from the
model. Thus, I got into this connundrum of trying to figure out how to
make that work and got into undefined method issues.
As far as syntax styles, deprecated APIs etc, what bites is that EVERY
tutorial and example on RoR uses the “old style” APIs such as find_all
etc rather than find (:all), so there is quite a limited # of examples
using the “proper” API (some Ruby but not RoR). I find it particularly
lacking that the API reference does not show more examples of the syntax
in use. It’s not productive having to learn the same thing 2x, 3x. Now I
have to go recode everything to the proper API