form_core 0.0.13 → 0.0.14

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: eb0a7243fa2c84f2517ed634654590a3969b1444
4
- data.tar.gz: 1afaae3ec02223810f1286f9dc7102be4e537e6c
3
+ metadata.gz: c0ff92c104fbdbeb9f7fbd170b34868a2697ea1e
4
+ data.tar.gz: 28003e17cc44fd89b86cb9c2019527332902f081
5
5
  SHA512:
6
- metadata.gz: 6dedc51b8213ed6cd2311949f320ffeff7564f9fb69980e4216d281a40b2695939f1dd49f9ed4216b9c9901b68abcf211c2553fbf859fdfd07142c4a29d6de0a
7
- data.tar.gz: d1c00a4578414c526f277eba176b73d6136905546b923b069f1f59ea3c6b68d6953cc4d97842d8ac1f5f5d3acdc3e64960a249894918f3fb5ab47fd1fad191ed
6
+ metadata.gz: 9c9c08f314a65c66bb211e61855e0f933292897a46231cb07f21e2c637fcb6486efd6f0844759d4a6a8188ecbd874fbab161fb014a632889d2d876b2d9cb058a
7
+ data.tar.gz: b1b79bd8edb0470183f4ec3c616a19d7912ef8e34fdb935e65647d1491348e6f23d86ce0ec8338850d0ab916c4dcb7bf2a40e7e0379765abbb6cb8b283c2dbfb
data/README.md CHANGED
@@ -3,6 +3,11 @@ Form Core
3
3
 
4
4
  A Rails engine providing ability to generate dynamic form.
5
5
 
6
+ ## Requirements
7
+
8
+ - MRI 2.3+
9
+ - Rails 5.0+
10
+
6
11
  ## Usage
7
12
 
8
13
  See demo for now.
@@ -4,6 +4,8 @@ module FormCore
4
4
  class Field < ApplicationRecord
5
5
  include FormCore::Concerns::Models::Field
6
6
 
7
+ self.table_name = "fields"
8
+
7
9
  belongs_to :form, touch: true
8
10
  end
9
11
  end
@@ -4,6 +4,8 @@ module FormCore
4
4
  class Form < ApplicationRecord
5
5
  include FormCore::Concerns::Models::Form
6
6
 
7
+ self.table_name = "forms"
8
+
7
9
  has_many :fields
8
10
  end
9
11
  end
@@ -1,6 +1,6 @@
1
1
  class CreateForms < ActiveRecord::Migration[5.1]
2
2
  def change
3
- create_table :form_core_forms do |t|
3
+ create_table :forms do |t|
4
4
  t.string :type, null: false, index: true
5
5
 
6
6
  t.timestamps
@@ -1,12 +1,12 @@
1
1
  class CreateFields < ActiveRecord::Migration[5.1]
2
2
  def change
3
- create_table :form_core_fields do |t|
3
+ create_table :fields do |t|
4
4
  t.string :name, null: false
5
5
  t.integer :accessibility, null: false
6
6
  t.text :validations
7
7
  t.text :options
8
8
  t.string :type, null: false, index: true
9
- t.references :form, foreign_key: {to_table: :form_core_forms}
9
+ t.references :form, foreign_key: true
10
10
 
11
11
  t.timestamps
12
12
  end
@@ -5,6 +5,8 @@ module FormCore::Concerns
5
5
  module Field
6
6
  extend ActiveSupport::Concern
7
7
 
8
+ NAME_REGEX = /\A[a-z_][a-z_0-9]*\z/
9
+
8
10
  included do
9
11
  enum accessibility: {read_and_write: 0, readonly: 1, hidden: 2},
10
12
  _prefix: :access
@@ -16,7 +18,7 @@ module FormCore::Concerns
16
18
  presence: true,
17
19
  uniqueness: {scope: :form},
18
20
  exclusion: {in: FormCore.reserved_names},
19
- format: {with: /\A[a-z0-9_]+\z/}
21
+ format: {with: NAME_REGEX}
20
22
  validates :accessibility,
21
23
  inclusion: {in: self.accessibilities.keys.map(&:to_sym)}
22
24
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FormCore
4
- VERSION = "0.0.13"
4
+ VERSION = "0.0.14"
5
5
  end
@@ -31,7 +31,6 @@ module FormCore
31
31
  self.class.dump(self)
32
32
  end
33
33
 
34
- public_class_method :define_method
35
34
  class << self
36
35
  def name
37
36
  @_name ||= "Form"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: form_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - jasl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-28 00:00:00.000000000 Z
11
+ date: 2018-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  version: '0'
87
87
  requirements: []
88
88
  rubyforge_project:
89
- rubygems_version: 2.6.12
89
+ rubygems_version: 2.6.13
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: A Rails engine providing ability to generate dynamic form.