ruby-on-railsdatabasehobo

How do I define a database index in HoboFields?


With HoboFields, I can declare fields for my model in its own file, like this:

class User < ActiveRecord::Base

  fields do
    login :string
    persistence_token :string
  end

end

I'd like to know if there's equivalent syntax for the add_index command I can use in vanilla Rails migrations.


Solution

  • class User < ActiveRecord::Base 
    
      fields do 
        login :string 
        persistence_token :string, :index => true
      end 
    
    end