我的代码是这个
def footstamp
if current_user
@user = User.find(params[:id])
@tracking = Tracking.where(:user_id => current_user.id, :target_user_id => @user.id)
if @tracking
@tracking.accessed_at = Time.now
@tracking.save
else
@tracking = Tracking.new
@tracking.user_id = current_user.id
@tracking.target_user_id = @user.id
@tracking.accessed_at = Time.now
@tracking.save
end
end
end
然后我得到这个错误
NoMethodError (undefined method `save' for []:ActiveRecord::Relation):