Felix,

Wow!  Thank you very much for the detail and clear answer.  I knew there was
something wrong when I had to "throw" and "catch."  I read that such
construct is rare.  Following your advices, I have rewritten the whole thing
into validate and before_save, and elevates the "save" operation out of the
model.  The conditional statement that I previously had buried in another
model which was used to "throw" now is in the validation.

I did not expect that the original question would lead me to improve a good
portion of the code following the Rails good practices.  Thanks again.

I still have this nagging question though:  How do I prevent an attribute
from being written to from outside the class?  In other words, how do I make
a setter function private so that only other functions in the class can call
it.

Thanks everyone.  You all have been so helpful.  I am very appreciative of
this community.

LBD
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to