charlotte-ruby/impressionist

Undefined method `cookie_value' for string in ImpressionistCrontroller

Closed this issue · 8 comments

id = id.cookie_value if Rack::Session::SessionId.const_defined?(:ID_VERSION) && Rack::Session::SessionId::ID_VERSION == 2

This line of code throws an undefined method error since id is already set as a string some lines before.

Hey there. I think I may have fixed your issue in #286

I also have this problem ! How can I pull the solution ? @invalidusrname

@invalidusrname your branch worked for us.
@nans64 assuming you are using bundler, you can specify which Git repository and branch you would like to use:

# Use this branch until upstream (charlotte-ruby) integrates fix for 'undefined method cookie_value'
# See https://github.com/charlotte-ruby/impressionist/issues/285
gem 'impressionist', git: 'https://github.com/invalidusrname/impressionist.git', branch: 'fix-ci-builds'

@consti It worked !!! Thank you I did not know that we could do that :) !

This should be fixed on master now. I don't have the ability to push gem updates at the moment, but you should be able to use this in your Gemfile for now:

gem 'impressionist', git: 'https://github.com/charlotte-ruby/impressionist.git'

Thanks @invalidusrname - will the latest master update work with Rails 5.2.4.3, or should projects using Rails 5 or lower stick to your branch for this issue?

Actually my branch is the same as master in this repo. I'd switch to it.

I'm not sure on your version of Rails, but I did create a sample rails app using 5.2.4.3 and it seems to log impressions

gem install rails --version 5.2.4.3

rails _5.2.4.3_ new sample_app
cd sample_app/
rails _5.2.4.3_ g impressionist
bundle exec rails g scaffold user name
bundle exec rails db:migrate
bundle exec rails s

# add impressionist to Users#show

Seems to look ok to me:

Started GET "/users/1" for ::1 at 2020-07-20 22:22:08 -0400
Impression Create (0.6ms)  INSERT INTO "impressions" ("impressionable_type", "impressionable_id", "controller_name", "action_name", "request_hash", "ip_address", "session_hash", "message", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)  [["impressionable_type", "User"], ["impressionable_id", 1], ["controller_name", "users"], ["action_name", "show"], ["request_hash", "XXX"], ["ip_address", "::1"], ["session_hash", "XXX"], ["message", "test123: 1"], ["created_at", "2020-07-21 02:22:08.514655"], ["updated_at", "2020-07-21 02:22:08.514655"]]
Completed 200 OK in 186ms (Views: 146.9ms | ActiveRecord: 2.5ms)

@invalidusrname thanks for the reply, that's perfect. Can also confirm the latest branch is working with rails 5.2.4.3.