Your code will improve at once if you read a Ruby book. For example, you confess to being confused in your fueling.rb model file --
<GOBBLEDEGOOK>
-- where you define a class method on the Fueling class, then set an instance variable (@current_id). I believe this will set @current_id in the scope of the Fueling class. Then you define a Fueling instance method (validate) and try to read @current_id inside it -- but it fails, because when you're in an instance method @current_id refers to a variable in some actual Fueling object, not to the @current_id that's in the scope of the Fueling class.
</GOBBLEDEGOOK>
You may have no idea what I just said. Even experts can get lost in Ruby's class hierarchy. So get a Ruby book and it will help you sort out the Ruby approach to OO programming.
People seem to like "Ruby for Rails", and its author is smart. The Pickaxe book ("Programming Ruby") is more famous and I liked that just fine, too. (Don't tell Zed Shaw.) If you're not already intimately familiar with another OO language, you might not want to learn Ruby from _Why the Lucky Stiff's Poignant Guide to Ruby (with cartoon foxes!)... although that's what I did.
P.S. Just today I had my accountant explaining to me the importance of separate tracking for "business" miles that I drive for my company, as well as tracking total miles driven. Food for thought. Just don't offer that feature if you plan to take the service down sometime during a tax year...
I've been finding a bunch of errors[0] in the Pickaxe book lately. If you're using it as a reference, and finding that things don't behave as expected, double check at ruby-doc.org.
[0] or at least differences between Ruby 1.6, which is covered in the book, and 1.8, which most people use.
Your code will improve at once if you read a Ruby book. For example, you confess to being confused in your fueling.rb model file --
<GOBBLEDEGOOK>
-- where you define a class method on the Fueling class, then set an instance variable (@current_id). I believe this will set @current_id in the scope of the Fueling class. Then you define a Fueling instance method (validate) and try to read @current_id inside it -- but it fails, because when you're in an instance method @current_id refers to a variable in some actual Fueling object, not to the @current_id that's in the scope of the Fueling class.
</GOBBLEDEGOOK>
You may have no idea what I just said. Even experts can get lost in Ruby's class hierarchy. So get a Ruby book and it will help you sort out the Ruby approach to OO programming.
People seem to like "Ruby for Rails", and its author is smart. The Pickaxe book ("Programming Ruby") is more famous and I liked that just fine, too. (Don't tell Zed Shaw.) If you're not already intimately familiar with another OO language, you might not want to learn Ruby from _Why the Lucky Stiff's Poignant Guide to Ruby (with cartoon foxes!)... although that's what I did.
P.S. Just today I had my accountant explaining to me the importance of separate tracking for "business" miles that I drive for my company, as well as tracking total miles driven. Food for thought. Just don't offer that feature if you plan to take the service down sometime during a tax year...