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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cef9e0f5b9a834cab185b0710b31ce5ac8b249590a88cb40d28802d1751fb5a
|
4
|
+
data.tar.gz: 8a00fbd3660b97c73b686d4fc086204ba7e7706375cd8c352a4ea81c4818484d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
17
|
-
|
18
|
-
|
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)
|
data/lib/lightek_vpm/version.rb
CHANGED