ixtlan-generators 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ require 'rails/generators/active_record'
3
3
  module ActiveRecord
4
4
  module Generators
5
5
  class ModelGenerator < Base
6
- include ::Ixtlan::Core::Singleton
6
+ include ::Ixtlan::Generators::Singleton
7
7
 
8
8
  argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
9
9
 
@@ -1,9 +1,34 @@
1
1
  module Ixtlan
2
+ module Generators
3
+ module Singleton
4
+
5
+ def self.included(base)
6
+ base.class_eval do
7
+ class_option :singleton, :type => :boolean, :default => false
8
+
9
+ if self.class.to_s =~ /ScaffoldGenerator$/
10
+
11
+ protected
12
+ alias :available_views_old :available_views
13
+ def available_views
14
+ if options[:singleton]
15
+ %w(new create edit show destroy _form)
16
+ else
17
+ available_views_old
18
+ end
19
+ end
20
+
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+
2
27
  class Railtie < Rails::Railtie
3
28
  config.generators do |config|
4
-
29
+
5
30
  config.templates << File.expand_path('../../generators/rails', __FILE__)
6
-
31
+
7
32
  end
8
33
  end
9
34
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ixtlan-generators
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - mkristian