beautiful_scaffold 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "beautiful_scaffold"
6
- s.version = "0.1.1"
6
+ s.version = "0.1.2"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.summary = "Beautiful Scaffold generate fully customizable scaffold"
9
9
  s.email = "claudel.sylvain@gmail.com"
@@ -138,6 +138,20 @@ class BeautifulScaffoldGenerator < Rails::Generators::Base
138
138
  copy_file "app/models/pdf_report.rb", "app/models/pdf_report.rb"
139
139
  end
140
140
 
141
+ def add_to_model
142
+ # Add relation and foreign_key in attr_accessible
143
+ myattributes.each{ |attr|
144
+ a,t = attr.split(':')
145
+ if ['references', 'reference'].include?(t) then
146
+ inject_into_file("app/models/#{model}.rb", ":#{a}_id, ", :after => "attr_accessible ")
147
+ begin
148
+ inject_into_file("app/models/#{a}.rb", "\n has_many :#{model_pluralize}, :dependent => :nullify", :after => "ActiveRecord::Base")
149
+ rescue
150
+ end
151
+ end
152
+ }
153
+ end
154
+
141
155
  def generate_controller
142
156
  copy_file "app/controllers/master_base.rb", "app/controllers/beautiful_controller.rb"
143
157
  dirs = ['app', 'controllers', options[:namespace]].compact
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beautiful_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-26 00:00:00.000000000Z
12
+ date: 2012-07-31 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: Beautiful Scaffold generate a complete scaffold (sort, export, paginate
15
15
  and filter data)