dennismonsewicz
dennismonsewicz

Reputation: 25552

Rails ActiveRecord update_attributes problems

I am trying to run the update_attributes for a particular object, but everytime I try to run my script, I get the following error: TypeError (can't convert String into Integer):

Here is the code I am working with

media = Media.find(params[:media_id])
media.update_attributes({:started_encode => false, :encode_success => false, :akamai => false})

Any idea why this keeps throwing that error?

Upvotes: 1

Views: 1927

Answers (2)

gaizka
gaizka

Reputation: 574

Which are the names of the Media columns table?

You may have found this problem:

http://ethernetflow.blogspot.com/2010/11/rails-typeerror-cant-convert-string.html

Basicaly, you cannot have a column named "HASH" in your table.

Upvotes: 7

sethvargo
sethvargo

Reputation: 26997

You are passing a string to a parameter that is expecting an integer, most likely in `params[:media_id]'. Try:

media = Media.find(params[:media_id].to_i)
...

Upvotes: 0

Related Questions