active_record_model_and_rspec_enhanced_templates 1.0.10 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c897e6f492552d7f3894f100badd99a40e18e0f7
4
- data.tar.gz: 8d97f6959f2c7954955a812b86522db0c23fd9fe
3
+ metadata.gz: a5196015e8f164fa58f456c4ef890b4c46f36ca9
4
+ data.tar.gz: ef89601a3e4acbca3419a3fa590c705f7079dbbf
5
5
  SHA512:
6
- metadata.gz: 9d5b9aafcae26b05929abbcca108562698e6ce52aadce62733cd56eacb570962d8a3f9a6a88668b0123241d39f1c17ea7cf6ea54c510ec43891cfec4646d7f2c
7
- data.tar.gz: 52cc029f7afc11656171f974780930018f55ad6527f7b82ef4921a694b1b2facbf2b10c30b104c11e96dab50fe9a25c732c75871657add4a88f68995d5a582a8
6
+ metadata.gz: 7f3f3fca2964329889c4ff67f4217e2d5a4e70fa91b70e81f1e313658f21e160a7ccbc42acff5623fc5a7ffb1840f3a27d8bce06c04b3a861780375e1f820e18
7
+ data.tar.gz: a5af74602e5290b2b728a693175b5f41c0fe015118dad400f7f768b2fda3a063f76509fc5f36195c80bdeac6b6cd4cd035deca855a453b73f0d6417437a1ac4e
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.10
1
+ 1.1.0
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: active_record_model_and_rspec_enhanced_templates 1.0.10 ruby lib
5
+ # stub: active_record_model_and_rspec_enhanced_templates 1.1.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "active_record_model_and_rspec_enhanced_templates"
9
- s.version = "1.0.10"
9
+ s.version = "1.1.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Dmitri Koulikoff"]
14
- s.date = "2016-08-26"
14
+ s.date = "2016-09-16"
15
15
  s.description = "ActiveRecord generator and RSpec templates that add some basic functionality to the model and its spec"
16
16
  s.email = "dima@koulikoff.ru"
17
17
  s.extra_rdoc_files = [
@@ -2,17 +2,26 @@
2
2
  #
3
3
  <% module_namespacing do -%>
4
4
  class <%= class_name %> < <%= parent_class_name.classify %>
5
+ <% if attributes.any?(&:reference?) -%>
5
6
 
6
7
  <% attributes.select(&:reference?).each do |attribute| -%>
7
- belongs_to :<%= attribute.name %><%= ', polymorphic: true' if attribute.polymorphic? %>
8
+ belongs_to :<%= attribute.name %><%= ', polymorphic: true' if attribute.polymorphic? %><%= ', required: true' if attribute.required? %>
9
+ <% end -%>
10
+ <% end -%>
11
+ <% if attributes.any?(&:token?) -%>
12
+
13
+ <% attributes.select(&:token?).each do |attribute| -%>
14
+ has_secure_token<% if attribute.name != "token" %> :<%= attribute.name %><% end %>
15
+ <% end -%>
8
16
  <% end -%>
9
17
  <% if attributes.any?(&:password_digest?) -%>
18
+
10
19
  has_secure_password
11
20
  <% end -%>
12
21
  <% if attribute = attributes.detect{|a| a.name == 'position'} || attributes.detect{|a| a.name == 'name'} || attributes.detect{|a| a.name == 'title'} || attributes.first -%>
13
22
 
14
23
  scope :ordered, -> { order(:<%=attribute.name %>) }
15
-
16
24
  <% end -%>
25
+
17
26
  end
18
27
  <% end -%>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_model_and_rspec_enhanced_templates
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.10
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitri Koulikoff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-26 00:00:00.000000000 Z
11
+ date: 2016-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec