Skip to content

Userid is coming as 0, 1, 2 etc #304

@brgcy

Description

@brgcy

Hi Folks,

Thanks for creating this wonderful gem.
I am trying to use this gem and almost all my needs are working well.
However, I noticed that the user_id is coming as nil, 0, 1, 2, 3.... etc

See below:

> Impression.last
  Impression Load (1.6ms)  SELECT  "impressions".* FROM "impressions" ORDER BY 
"impressions"."id" DESC LIMIT $1 /*application:Foo*/  [["LIMIT", 1]]
=> #<Impression id: 2256, impressionable_type: "EditablePage", impressionable_id: 39, 
user_id: 5, controller_name: "blog_posts", action_name: "show", view_name: nil, 
request_hash: "fdcb03fdfd...", ip_address: "1xx.xx.xx.76", session_hash: "293e851aec2260bec0b556cf68080e04", 
message: "Getting foo blog post", referrer: "https://example.com/blog/?page=1", 
params: {"slug"=>"foo"}, created_at: "2022-04-07 11:49:33", updated_at: "2022-04-07 11:49:33">

How I am adding

def show
  @blog_post = BlogPost.find_by(slug: params[:slug])
  impressionist(@blog_post, "Hitting #{@blog_post.title}.")
  ...
end

Anything I am missing here?

After changing the migration to create ImpressionTable, I am getting following error:

PG::InvalidTextRepresentation: ERROR: invalid input syntax for type uuid: "0" : 
INSERT INTO "impressions" ("impressionable_type", "impressionable_id", "controller_name", 
"action_name", "request_hash", "ip_address", "session_hash", "message", "params", 
"created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11) 
RETURNING "id" /*application:Foo,controller:blog_posts,action:show*/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions