As I plod on in my journey to grasp Rails (and Ruby) I’m often
surprised by the difficulty in figuring out how to do something. Most
of the time the surprise is a pleasant one, in that it’s much easier
than I expected. But then sometimes something that I expect to be
easy leaves me scratching my head.
Today I am trying to retrieve XML data from a remote server, parse
that data into a class, then save it to the database.
I “knew” the XML part would be hard and the saving easy.
Well, retrieving and parsing the data took maybe five minutes to get
working, instead of all day like I expected
But now I can’t properly save it.
The columns always end up filled with nulls. To simply the problem I
eliminated the retrieval part and tried to just create and save, like
#in the account_application controller
account_application = AccountApplication.new
account_application.first_name = “George”
A row gets created, but first_name is null.
In the model file I have
class AccountApplication < ActiveRecord::Base
Surely I’m doing something that’s just plain wrong, but I am stumped.