Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8252175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:29:10+00:00 2026-06-08T00:29:10+00:00

This was working, but now i’m getting the below error when calling update_attributes :

  • 0

This was working, but now i’m getting the below error when calling update_attributes :

NoMethodError in SongsController#update

undefined method `name' for nil:NilClass
Rails.root: C:/Sites/music3

Application Trace | Framework Trace | Full Trace
app/controllers/songs_controller.rb:164:in `update'

What is confusing me is that my @song object doesn’t have “name” in it. (see schema below), but the artist does. Songs and Artists are associated through a many to many relationship. Seems like update_attributes is trying to update the artist object as well? Didn’t think it was supposed to do this. Really not sure whats up here any help would be greatly appreciated.

Thanks,

Song Controller
def update
    @artist = Artist.find(params[:artist_id])
    authorize! :update, @artist
    @song = Song.find(params[:form_song_id])
    @song.artists <<  @artist
    @s3_test = params[:s3_name]

    @song.update_attributes(params[:song]) #causing the error  
 end

Schema

create_table "artists", :force => true do |t|
    t.string   "name"
    t.string   "city"
    t.string   "province"
    t.string   "country"
    t.text     "influence"
    t.text     "bio"
    t.text     "contact_info"
    t.date     "date_founded"
    t.date     "created_date"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "url_slug"
    t.string   "pay_pal"
    t.string   "image"
  end

  create_table "songs", :force => true do |t|
    t.string   "song_name"
    t.string   "song_artist"
    t.string   "song_contribute_artist"
    t.string   "song_written"
    t.string   "song_licence_type"
    t.string   "song_url_slug"
    t.date     "song_licence_date"
    t.integer  "song_plays"
    t.text     "lyrics"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "s3_name"
    t.string   "download_link"
    t.string   "torrent_link"
    t.string   "s3_id"
    t.integer  "s_a_id"
  end

Example Params.

{"utf8"=>"✓",
 "_method"=>"put",

 "song"=>{"s3_name"=>#<ActionDispatch::Http::UploadedFile:0x260e908 @original_filename="done good (final final).mp3",
 @content_type="audio/mp3",
 @headers="Content-Disposition: form-data; name=\"song[s3_name]\"; filename=\"done good (final final).mp3\"\r\nContent-Type: audio/mp3\r\n",
 @tempfile=#<File:C:/Users/Ted/AppData/Local/Temp/RackMultipart20120716-1600-ohtooj>>,
 "song_name"=>"Done Good",
 "song_artist"=>"Grimes",
 "song_contribute_artist"=>"",
 "song_written"=>"Ted Kennedy",
 "song_licence_type"=>"copywrite",
 "song_licence_date(1i)"=>"2012",
 "song_licence_date(2i)"=>"7",
 "song_licence_date(3i)"=>"17",
 "song_plays"=>"",
 "song_url_slug"=>"",
 "lyrics"=>"None"},
 "commit"=>"Upload",
 "artist_id"=>"1",
 "form_song_id"=>"5",
 "id"=>"create"}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T00:29:12+00:00Added an answer on June 8, 2026 at 12:29 am

    Try this since those are not in the song class.

    params[:song].delete("@content_type")
    params[:song].delete("@tempfile")
    params[:song].delete("@headers")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this regex working but now need to allow numbers without the decimal
I have this working code, but now i need to be able to change
I'm using this tutorial right now and I got it working perfectly, but my
I currently have this working but it requires me to have a static method
I finally have this working now but would like to know how I can
Weird , i had this working before but stopped out now and doesn't seem
Running PostgreSQL (7.4 and 8.x) and I thought this was working but now I'm
So I had this working perfectly fine, but now for some reason I can't
I've got this working: <Button Content={StaticResource SaveImage} /> But now I want to make
I have a this working countdown timer in jQuery but for now I'm just

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.