lightek_vpm 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f822d40932a408a0e06ae5fc973840af2baa01dc24a57667e097bd0b8533660c
4
- data.tar.gz: 1d3df8921c6b0e4bc65a22c005c7ae88e8ea6383992dd20b3d481506e486d11b
3
+ metadata.gz: 1cef9e0f5b9a834cab185b0710b31ce5ac8b249590a88cb40d28802d1751fb5a
4
+ data.tar.gz: 8a00fbd3660b97c73b686d4fc086204ba7e7706375cd8c352a4ea81c4818484d
5
5
  SHA512:
6
- metadata.gz: 35cb44cdb32421d5311c330d2fd4358762a0067704547572b97f309a6eff0cfed7b2b261ec83194d70b23600c0dd5045319ecc2f16f9fee3ec1eca8893c1f27a
7
- data.tar.gz: af7f97717a5322e75c5709d99cb6683f3963ba78de394bc54f5ebaecb78a10085887e4671f6386162067c2829295c972ec4971bb1d2f0f9f8f24801690eabf7a
6
+ metadata.gz: 9afa936e042e525b62f646ef733d3bf8a44d5ea9ea31441b370fd2254175f262c4ae57e8943a3583e49aa9989ecc08486ac2d390c451504e7de3011589dd3194
7
+ data.tar.gz: 0d399b1fab0d122291fb598ee447b3a2d4c97f2fdb2114cc0515d407f53bdd5e35153cd1a1a0f6c53d42318e1074d5ec82400627dea05623e98ea3c589b625fb
@@ -7,9 +7,11 @@ module LightekVpm
7
7
  class ControllerGenerator < Rails::Generators::NamedBase
8
8
  source_root File.expand_path('../templates', __FILE__)
9
9
  include Rails::Generators::ResourceHelpers
10
+ include GeneratorHelpers # Include the GeneratorHelpers module
11
+
10
12
  class_option :skip_show, type: :boolean, default: false, desc: 'Skip "show" action'
11
13
 
12
- desc 'Generates controller, controller_spec and views for the model with the given NAME.'
14
+ desc 'Generates controller, controller_spec, and views for the model with the given NAME.'
13
15
 
14
16
  def copy_controller_and_spec_files
15
17
  template 'controller.rb', File.join('app/controllers', "#{controller_file_name}_controller.rb")
@@ -31,7 +33,7 @@ module LightekVpm
31
33
  end
32
34
 
33
35
  def add_abilities
34
- ability_string = "n can :manage, #{class_name}, user_id: user.id"
36
+ ability_string = "\n can :manage, #{class_name}, user_id: user.id"
35
37
  inject_into_file "#{Rails.root}/app/models/ability.rb", ability_string, after: /def initialize[a-z()]+/i
36
38
  end
37
39
 
@@ -13,11 +13,14 @@ attr_accessor :options, :attributes
13
13
  end
14
14
  end
15
15
 
16
- def editable_attributes
17
- attributes ||= model_columns_for_attributes.map do |column|
18
- Rails::Generators::GeneratedAttribute.new(column.name.to_s, column.type.to_s)
16
+ def editable_attributes
17
+ model_columns = class_name.constantize.columns
18
+ model_columns.reject { |c| %w[id created_at updated_at].include?(c.name) }
19
+ end
20
+
21
+ def editable_attribute_names
22
+ editable_attributes.map(&:name).map { |attr| ":#{attr}" }.join(', ')
19
23
  end
20
- end
21
24
 
22
25
  def view_files
23
26
  actions = %w(index new edit _form)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LightekVpm
4
- VERSION = "0.4.1"
4
+ VERSION = "0.4.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lightek_vpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marlon Henry