Sha256: 509f16f69dd4988378a9ce47e33c1a3146c07361088689926b07bccecfb0db88

Contents?: true

Size: 750 Bytes

Versions: 5

Compression:

Stored size: 750 Bytes

Contents

module Ixtlan
  module Generators
    module Singleton

      def self.included(base)
        base.class_eval do
          class_option :singleton, :type => :boolean, :default => false

          if self.class.to_s =~  /ScaffoldGenerator$/

            protected
            alias :available_views_old :available_views
            def available_views
              if options[:singleton]
                %w(new create edit show destroy _form)
              else
                available_views_old
              end
            end

          end
        end
      end
    end
  end

  class Railtie < Rails::Railtie
    config.generators do |config|

      config.templates << File.expand_path('../../generators/rails', __FILE__)

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ixtlan-generators-0.1.5 lib/ixtlan/railtie.rb
ixtlan-generators-0.1.4 lib/ixtlan/railtie.rb
ixtlan-generators-0.1.3 lib/ixtlan/railtie.rb
ixtlan-generators-0.1.2 lib/ixtlan/railtie.rb
ixtlan-generators-0.1.1 lib/ixtlan/railtie.rb