-
Notifications
You must be signed in to change notification settings - Fork 40
Closed
Labels
compatibilitycompatibility with dependencies such as Rails, Opal, React, etc. NOT FUNCTIONAL COMPATIBILITYcompatibility with dependencies such as Rails, Opal, React, etc. NOT FUNCTIONAL COMPATIBILITYgood first issueGood for newcomersGood for newcomers
Description
Currently json
and jsonb
rails record attribute types will work, except that the dummy value will not be initialized if the schema specifies a default type. In other words lets say your migration specifies that a json column should have a default value of {abc: 12}
. The HyperModel behavior should load the dummy value while waiting for the server to return with {abc: 12}
instead it loads nil (which is an acceptable value for json and jsonb fields, so its nothing breaks.
To work around this include the following in some client-side file (at the beginning of hyperstack/models/application_record.rb
works fine)
module ReactiveRecord
class Base
class DummyValue < BasicObject
alias build_default_value_for_jsonb build_default_value_for_nil
alias build_default_value_for_json build_default_value_for_nil
end
end
end if RUBY_ENGINE == 'opal' # the guard is important if its a file that is compiled server side!
Metadata
Metadata
Assignees
Labels
compatibilitycompatibility with dependencies such as Rails, Opal, React, etc. NOT FUNCTIONAL COMPATIBILITYcompatibility with dependencies such as Rails, Opal, React, etc. NOT FUNCTIONAL COMPATIBILITYgood first issueGood for newcomersGood for newcomers