Hi. I'm new to rails and getting the following error:
NameError in FriendshipsController#create
uninitialized constant FriendshipsController
this also shows up:
{"authenticity_token"=>"eQvv3flATE+P1TEErOWP/6fM8dEOIBxltobCxtM/F18=", "friend_id"=>"32"}
When I click on the "Add Friend" Link on my users show page. I am following the railscast about self referential associations to a T, but I keep getting this error and I can't find any information about it, not even what "uninitialized constant" means. I've gathered from the internet that it MAY be related to the acts_as_authenticated plugin, but I followed the one fix I found and it didn't work.
Here is the code from my user/show.html.erb page:
<%= link_to "Add Friend", friendships_path(:friend_id => @user.id), :method => :post %>
and the code from my friendships controller:
def create
@friendship = current_user.friendships.build(:friend_id => params[:friend_id])
if @friendship.save
flash[:notice] = "Added friend."
redirect_to root_url
else
flash[:error] = "Unable to add friend."
redirect_to root_url
end
end
Where am I going wrong here. I haven't the faintest clue what is causing this. Please let me know if I am missing any needed code.