1
votes

Using Rspec/Device/Cucumber template app Upon logging in I wish the user to be redirected to the users#index my routes file

Engage::Application.routes.draw do
  authenticated :user do
    root to: 'users#show'
  end
  root :to => "home#index"
  devise_for :users
  resources :users, only: [:index]
  resources :agendas, only: [:create, :destroy]
end

Upon logging in I get a error

ActiveRecord::RecordNotFound in UsersController#show

Couldn't find User without an ID

My users_controller

class UsersController < ApplicationController
  before_filter :authenticate_user!

  def index
    @user = current_user
    @agendas = @user.agendas
  end
end

I've tried adding "@user = User.find(params[:id])" instead of using the current_user helper method but i'm still having issues

my show view in my users folder under views is

<div class="row">
    <div class="span8">
        <% if @user.agendas.any? %>
            <h2>Agendas (<%= @user.agendas.count %>)</h2>
            <ol class="agendas">
                <%= render @agendas %>
            </ol>
        <% end %>
    </div>
</div>
1

1 Answers