Sha256: cded8e50b98c0f85f91e8289be31826cdde411f650f32b026af545dbce691bf3
Contents?: true
Size: 759 Bytes
Versions: 2
Compression:
Stored size: 759 Bytes
Contents
module Adminos::Generators class SearchGenerator < Rails::Generators::NamedBase desc 'Helps you setup your search.' def configure_model inject_into_class model_path, model do <<~MODEL.indent(2) include Adminos::Searchable searchable MODEL end end def add_partial insert_into_file partial_path, after: /collection_header\n/ do <<~SLIM = render 'shared/admin/search_form' SLIM end end private def model_path "app/models/#{model.underscore}.rb" end def partial_path "app/views/admin/#{model.underscore.pluralize}/index.slim" end def model "#{file_path.tr('/', '_').singularize.classify}" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
adminos-1.0.0.pre.rc.5 | lib/generators/adminos/search_generator.rb |
adminos-1.0.0.pre.rc.4 | lib/generators/adminos/search_generator.rb |