rails-engine / notifications

🛎 Notifications Center engine like GitHub or other application for any Rails applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

searching the partial in the gems?

dcalixto opened this issue · comments

ActionView::MissingTemplate in Notifications::Notifications#index
Showing /home/daniel/jexts/app/views/notifications/notifications/_notification.html.erb where line #11 raised:

Missing partial notifications/_comment with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :coffee, :jbuilder]}. Searched in:
  * "/home/daniel/jexts/app/views"
  * "/home/daniel/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/kaminari-core-1.1.1/app/views"
  * "/home/daniel/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/notifications-0.6.0/app/views"
  * "/home/daniel/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/mailboxer-0.15.1/app/views"
  * "/home/daniel/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/devise-4.4.1/app/views"

You need add app/views/notifications/_comment.html.erb for write template for comment type/

@huacnlee thank you, just one doubt, i added in right place, but now show Showing

/home/daniel/jexts/app/views/notifications/_comment.html.erb where line #2 raised:
undefined method `user_path' for #<#<Class:

and if i remove the link_to from the partial shows:

/home/daniel/jexts/app/views/notifications/_comment.html.erb:2: syntax error, unexpected ')', expecting '=' ....username, notification.actor );@output_buffer.safe_append='... ... ^ /home/daniel/jexts/app/views/notifications/_comment.html.erb:5: syntax error, unexpected keyword_ensure, expecting ')'

so, i have to change the will_paginate to kaminari?

You can rewrite notifications_controller.rb to use will_paginate

https://github.com/rails-engine/notifications/blob/master/app/controllers/notifications/notifications_controller.rb#L4

# app/controller/notifications_controller.rb
class NotificationsController < Notifications::NotificationsController
  def index
    @notifications = Notification.where(user_id: current_user.id).includes(:actor).order('id desc').paginate(params[:page])

    unread_ids = @notifications.reject(&:read?).select(&:id)
    Notification.read!(unread_ids)

    @notification_groups = @notifications.group_by { |note| note.created_at.to_date }
  end
end

# config/routes.rb
resources :notifications

@huacnlee thank you very much! but if change to will_paginate

shows another issue:

undefined method fetch' for nil:NilClass`

need more details / context of this error message