Skip to content
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

Add custom lexorank column to ActiveRecord #8

Open
richardboehme opened this issue Feb 14, 2022 · 0 comments
Open

Add custom lexorank column to ActiveRecord #8

richardboehme opened this issue Feb 14, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@richardboehme
Copy link
Owner

To avoid confusion with the setup of column collations, that is needed to use this gem, it should be as simple as using

class AddRankToPages < ActiveRecord::Migration[7.0]
  def change
    add_column :pages, :rank, :lexorank
    add_index :pages, :rank, unique: true
  end
end

or

$ rails g migration AddRankTo<insert model name here> rank:lexorank:uniq

This can be achieved by adding a custom column type to ActiveRecord. An example can be found in the Money-Rails gem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant