-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rails 7.2.1 issue. ArgumentError: wrong number of arguments #135
Comments
Fixes for Rails 7.2 are not released yet. Please try this:
|
7.2 support now seems to be there but I'm getting issues caused by the precision on timestamp on ReadMark vs datetime on my rails models. This only came to light in dev while immediately marking an issue read under :show in the controller. That creates a timestamp on the read_mark without milliseconds while the datetime column on the model supports milliseconds. This results in the read_mark appearing to be created before the associated record.
My fix was to change the migration adding def self.up
create_table ReadMark, force: true, options: create_options do |t|
t.references :readable, polymorphic: { null: false }
t.references :reader, polymorphic: { null: false }
t.datetime :timestamp, null: false, precision: 6
end
add_index ReadMark, [:reader_id, :reader_type, :readable_type, :readable_id], name: 'read_marks_reader_readable_index', unique: true
end |
If someone is looking for a migration for the solution from @chriswnl: class AddPrecisionToReadMarks < ActiveRecord::Migration[8.0]
def change
change_column :read_marks, :timestamp, :datetime, precision: 6
end
end Maybe unrelated to this, but with Rails 8 I also ran into issues when immediately marking a created entity as read. For now I manually increase the timestamp by 1 second 🫤 current_user.read_marks.where(readable: things).update_all("timestamp = timestamp + interval '1 seconds'") I'm using postgres btw. |
Get error with rails 7.2.1
return to rails 7.1.4 and works good
Diff:
The text was updated successfully, but these errors were encountered: