Sha256: edaf36e577b2eb181cefdc977b719b17e81b76d5f4b9298c82aeeae2a0b7c599
Contents?: true
Size: 625 Bytes
Versions: 1
Compression:
Stored size: 625 Bytes
Contents
class <%= migration_class_name %> < ActiveRecord::Migration def up execute <<-EOS -- DELETE from <%=search_context %>; INSERT into <%=search_context %>(name, count,created_at, updated_at) SELECT word, ndoc as count, now() as created_at, now() as updated_at FROM ts_stat( 'SELECT to_tsvector(''simple'', <% sep='';columns.each do |column| -%> <%=sep%>coalesce(<%=column %>,'''') <%sep=" || '' '' ||" -%> <% end -%> ) FROM <%=table_name %> ') EOS end def down execute %Q{DELETE from <%=search_context %>} end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
search_steroids-0.0.1 | lib/generators/enable_tsearch/templates/populate_search_terms_migration.rb |