views:

115

answers:

1
ArgumentError in SourceController#update_source

wrong number of arguments (1 for 0)

I try saving a new Article object into the database by writing:

@article = Article.new(:title => new_a.title,
              :description => new_a.description,
              :source_id => self.id,
              :url => new_a.link,
              :pub_date => new_a.pubDate)
            @article.save

new_a is an array or rss objects from an rss parser that I am 100% positive works fine. self.id refers to the model 'Source' from which this code is pulled from. The 'wrong number of arguments (1 for 0)' doesn't seem to make any sense considering the new method takes a parameter and I know for a fact that each of the attributes that I access from new_a is not nil

A: 

new_a.pubDate is fine if I am just going to spit it out to the view directly, but when trying to store new_a.pubDate into the database where the column takes a varchar(255) - the database spits it back up saying that pubDate is incompatible. It turns our the argument error (1 for 0) was telling me that I was giving it something that shouldn't have been there (even though I thought I was giving it a valid parameter). As it turns out, pubDate from the rss parser is just a time stamp on when the article was parsed so I don't need that considering I have a created_at timestamp that the DB makes for me.

The rollback must have been called when it realized I was giving it a bad parameter.

Thanks for the responses!

scott