starburstgem / starburst

In-app announcements to users in your Rails app
MIT License
257 stars 29 forks source link

How to configure starburst without devise? #50

Closed mabras closed 3 years ago

mabras commented 4 years ago

I am using an open source Rails app. In the

class ApplicationController < ActionController::Base
  def current_user
    #...
    #find the current user form the session.
    #...
    @current_user
  end
  helper_method :current_user
end

The user is keep getting the notification even if he dismiss it. The logs:

Started POST "/starburst/announcements/1/mark_as_read" for ::1 at 2020-04-17 13:26:29 +0300
Processing by Starburst::AnnouncementsController#mark_as_read as JS
  Parameters: {"utf8"=>"✓", "commit"=>"", "id"=>"1"}
  Starburst::Announcement Load (0.3ms)  SELECT  "starburst_announcements".* FROM "starburst_announcements" WHERE "starburst_announcements"."id" = ? LIMIT ?  [["id", 1], ["LIMIT", 1]]
  ↳ /Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/starburst-9dd6d5c77ada/app/controllers/starburst/announcements_controller.rb:6
Completed 422 Unprocessable Entity in 4ms (Views: 0.5ms | ActiveRecord: 0.3ms)

I have tried to specify the current_user in the initializer and get the same results.

Starburst.configuration do |config|
  config.current_user_method = "current_user"
end

Thanks.

erichmachado commented 4 years ago

Hi @mabras, it looks like there was an issue with the inheritance structure of the Starburst::AnnouncementsController. Can you please try again with the em-feat-configuration branch and let me know if it works?