Save 36% for Black Friday! Learn more

New Discussion

Notifications

You’re not receiving notifications from this thread.

"Undefined method error" while trying to implement In-App Notification.

0
Rails

Hi people! I'm trying to implement this to an app am building (I want to create the notifications for comments where the comment belongs to episode and episode belongs to story and genre)... When i checked out Notification.all in my console it outputted it but when i navigated to http://localhost:3000/notifications.json i got an error telling me that "undefined method `episode_path' for #<#class:0x157f1538:0x15149e68>"

Here is my index.json.jbuilder

json.array! @notifications do |notification|
    json.id notification.id
    # json.recipient notification.recipient
    json.actor notification.actor.user_name
    json.action notification.action
    json.notifiable do #notification.notifiable
        json.type "a #{notification.notifiable.class.to_s.underscore.humanize.downcase}"
    end
    json.url episode_path(notification.notifiable.episode, anchor: dom_id(notification.notifiable))
end

Thank You

Join the discussion
Create an account Log in