jeudi 4 avril 2019

ActiveRecord::RecordNotFound in StaticPagesController#home

I am getting this error whenever I try to access the application. The error is about the application controller. This is the error. Couldn't find all Private::Conversations with 'id': (17, 38) (found 0 results, but was looking for 2).

The error is explained more in the bash as follows ActiveRecord::RecordNotFound (Couldn't find all Private::Conversations with 'id': (17, 38) (found 0 results, but was looking for 2).):

app/controllers/application_controller.rb:28:in `opened_conversations_windows' I have tried changing the find method but things do not seem to work with methods such as find_by.

def opened_conversations_windows


        if logged_in?

            # opened conversations

            session[:private_conversations] ||= []

            @private_conversations_windows = Private::Conversation.includes(:recipient, :messages)
                                              .find(session[:private_conversations])



          else

            @private_conversations_windows = []


        end
end

I expect that when no conversation is found, the app should render nil conversation windows when a user logs in.

Aucun commentaire:

Enregistrer un commentaire