[Rails] Re: Setting model association `source_type` to polymorphic object

2020-02-18 Thread UG
On Tuesday, February 18, 2020 at 6:59:15 PM UTC+1, Momeas Interactive wrote: > > I don't think polymorphism in Rails can work that way > > did you try > > > `has_many :users_following, through: :active_relationships, source: > :followable, source_type: "FollowableUser"` > > `has_many

[Rails] Setting model association `source_type` to polymorphic object

2020-02-10 Thread UG
I am trying to setup a way for my `User` and `Project` model to both be followed through the same `Relationship` model. I also want to be able to get all items the user has followed with this association: `has_many :following, through: :active_relationships, source: :followable, source_type:

[Rails] I have a question about `ActiveRecord.locking_column`.

2018-06-10 Thread UG Muscle
Suppose the User model defines a column like this and does not have lock_version ``` class DeviseCreateUsers < ActiveRecord::Migration[5.1] def change create_table :users do |t| t.string :name # do not have a lock_version and other optimistic locks end end end ```

[Rails] About ActiveRecord#locking_column

2018-03-09 Thread UG Aimerald
I doubt that the model that inherited ActiveRecord will return lock_version even if it does not have locking_column (lock_version etc.). Please let me know if anyone knows why such an implementation is in place. If there is no reason I will make a PR to fix -- You received this message because