I am building a side project rails app. One feature I am trying to implement is a text_field where a user submits a youtube link, and that creates an embedded video to be displayed on their own page. I am running into the NoMethodError when i go to /users/2 , i was hoping you guys could give a newbie a hand:
/users/show.html.erb
<h1>Users#show</h1>
<p>Find me in app/views/users/show.html.erb</p>
<%= render partial: 'shared/track_form' %>
views/shared/_track_form.html.erb:
<%= form_for(@track) do |f| %>
<div class="field">
<%= f.text_area :content, placeholder: "Upload a youtube song URL..." %>
</div>
<%= f.submit "Post", class: "btn btn-large btn-primary" %>
the error: undefined method 'model_name' for NilClass:Class
track.rb
class Track < ActiveRecord::Base
attr_accessible :content
belongs_to :user
validates :content, presence: true
end
I have a tracks controller, but I think it is trying to use the Users Controller..
anymore code or info that you need let me know, thank you.