nesaulov/surrealist

Unable to override method in 1.2

tycooon opened this issue · 3 comments

gem "surrealist", "1.2.0"
require "surrealist"

class KekSerializer < Surrealist::Serializer
  json_schema do
    {
      kek: String,
      cheburek: String,
    }
  end

  def kek
    "kek"
  end

  def cheburek
    "cheburek"
  end
end

class A
  def kek
    "smth"
  end
end

kek = A.new
p KekSerializer.new(kek).build_schema # => {:kek=>"smth", :cheburek=>"cheburek"}

The output was {:kek=>"kek", :cheburek=>"cheburek"} in version 1.1.2.

Yes that's a bug, thanks for reporting @tycooon

It seems the culprit is from d891ef1

Do you mind if I take a look at that @nesaulov?

@gjhenrique sure, I wanted to fix that but I can't really find the time still. Thank you!