title: Rails update_Attributes(params[:user])
body: <p>I have a User show function that makes an api call and updates the user attributes, but I'm having trouble saving the changes.</p>
  
  <pre><code>def show
    @user = User.find(params[:id])
    ... change attributes of @user ...
    if @user.update_attributes(params[:user])
      p "Saved"
    else
      p "Failed"
    end
  end
  </code></pre>
  
  <p>I'm updated two attributes (:today_steps and :year). Both are accessible in the user.rb. The challenge is that :year is a Serialized Array, but I'm not sure how that changes anything</p>
  
  <p>this setup has returned a 'Failed' every time. i have also tried 'params[:id]' but I receive the error</p>
  
  <pre><code>undefined method `stringify_keys' for "1":String
  </code></pre>
  
  <p>Any ideas on how to solve this? thanks</p>
  
  <p><em><strong>more info</em></strong></p>
  
  <pre><code>def show
  @user = User.find(params[:id])
  if (@user.device != nil)
    @device = @user.device
  
    client = Fitgem::Client.new(
    #api client - haven't figured out my security yet, so I won't post it
    )
    now =  Time.now()
    last = @device.lastUpdated
    while now.to_date &gt; last.to_date
      day = client.activities_on_date last.strftime("%Y-%m-%d")
      break if day['errors'] != nil
      day = day['summary']['steps']
      last = last + 1.days
      @user.year = @user.year.unshift(day)
    end
    day = (client.activities_on_date 'today')
    if day['errors'] == nil
      @user.today_steps = day['summary']['steps']
      if now.day != last.day
        @user.year.unshift(@user.today_steps)
      else
        @user.year[0] = @user.today_steps
      end
    end
  
    @device.lastUpdated = now
    p @user.year
  
    @user.device.save
    if @user.update_attributes(params[:user])
      p "Updated"
    else 
      p "Failed to Update"
    end
  end
  @competitions = @user.competitions.paginate(page: params[:page])
  end
  </code></pre>
  
  <p>_</p>
  
  <pre><code>User.rb
    attr_accessible :email, :name, :password, :password_confirmation, :year, :today_steps
    serialize :year, Array
  </code></pre>
  
  <p><strong>Even More</strong></p>
  
  <p>console, using params[:user]</p>
  
  <pre><code>Started GET "/users/2" for 127.0.0.1 at 2014-02-25 17:15:09 -0800
  Processing by UsersController#show as HTML
    Parameters: {"id"=&gt;"2"}
    User Load (0.1ms)  SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1  [["id", "2"]]
    Device Load (0.1ms)  SELECT "devices".* FROM "devices" WHERE "devices"."user_id" = 2 LIMIT 1
     (0.1ms)  begin transaction
     (0.3ms)  UPDATE "devices" SET "lastUpdated" = '2014-02-26 01:15:09.634622', "updated_at" = '2014-02-26 01:15:10.392810' WHERE "devices"."id" = 3
     (2.3ms)  commit transaction
     (0.1ms)  begin transaction
    User Exists (0.1ms)  SELECT 1 FROM "users" WHERE (LOWER("users"."email") =     LOWER('fire@fox.com') AND "users"."id" != 2) LIMIT 1
     (0.0ms)  rollback transaction
    Rendered users/show.html.erb within layouts/application (0.4ms)
    Rendered layouts/_shim.html.erb (0.0ms)
    User Load (0.1ms)  SELECT "users".* FROM "users" WHERE "users"."remember_token" = '1f47eae1cb002cb1c4e83ce0363fbfb2d33ad8f5' LIMIT 1
    Rendered layouts/_header.html.erb (2.2ms)
    Rendered layouts/_footer.html.erb (0.1ms)
  </code></pre>
  
  <p>console @user after find</p>
  
  <pre><code>#&lt;User id: 1, name: "Marcus", email: "mar@comcast.net", points: nil, created_at: "2014-02-25 21:59:12", updated_at: "2014-02-25 21:59:12", password_digest: "$2aGTx..FbLP...", admin: false, remember_token: "e4bdd9c", year: [], lastUpdate: nil, lastUpdated: nil, today_steps: nil&gt;
  </code></pre>