Sha256: 051469227a081ee28ab497f104bc7148b7c19831eed2e110a5e6ff6cabc718d3

Contents?: true

Size: 679 Bytes

Versions: 19

Compression:

Stored size: 679 Bytes

Contents

require 'rails/generators/active_record'
module Adminpanel
  class GalleryGenerator < ActiveRecord::Generators::Base
    source_root File.expand_path("../templates", __FILE__)
    desc "Generate the resource files necessary to use a model"

    def generate_model
      template 'gallery_template.rb', "app/models/adminpanel/#{lower_name}.rb"
    end

    def generate_uploader
      template 'uploader.rb', "app/uploaders/adminpanel/#{lower_name}_uploader.rb"
    end

  private
    def reference_name
      name.singularize.downcase
    end

    def lower_name
      "#{reference_name}file"
    end

    def class_name
      "#{reference_name.camelize}file"
    end

  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
adminpanel-3.6.1 lib/generators/adminpanel/gallery/gallery_generator.rb
adminpanel-3.6.0 lib/generators/adminpanel/gallery/gallery_generator.rb
adminpanel-3.5.1 lib/generators/adminpanel/gallery/gallery_generator.rb
adminpanel-3.5.0 lib/generators/adminpanel/gallery/gallery_generator.rb
adminpanel-3.4.7 lib/generators/adminpanel/gallery/gallery_generator.rb
adminpanel-3.4.6 lib/generators/adminpanel/gallery/gallery_generator.rb
adminpanel-3.4.5 lib/generators/adminpanel/gallery/gallery_generator.rb
adminpanel-3.4.4 lib/generators/adminpanel/gallery/gallery_generator.rb
adminpanel-3.4.3 lib/generators/adminpanel/gallery/gallery_generator.rb
adminpanel-3.4.2 lib/generators/adminpanel/gallery/gallery_generator.rb
adminpanel-3.4.1 lib/generators/adminpanel/gallery/gallery_generator.rb
adminpanel-3.4.0 lib/generators/adminpanel/gallery/gallery_generator.rb
adminpanel-3.3.4 lib/generators/adminpanel/gallery/gallery_generator.rb
adminpanel-3.3.3 lib/generators/adminpanel/gallery/gallery_generator.rb
adminpanel-3.3.0 lib/generators/adminpanel/gallery/gallery_generator.rb
adminpanel-3.2.1 lib/generators/adminpanel/gallery/gallery_generator.rb
adminpanel-3.2.0 lib/generators/adminpanel/gallery/gallery_generator.rb
adminpanel-3.1.0 lib/generators/adminpanel/gallery/gallery_generator.rb
adminpanel-3.0.0 lib/generators/adminpanel/gallery/gallery_generator.rb