record_view_helper 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/lib/record_view_helper/dl.rb +1 -0
- data/lib/record_view_helper/table.rb +1 -0
- data/lib/record_view_helper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d613563d57f181d96b21daee693f428ac5424077
|
4
|
+
data.tar.gz: 1a48fb71c90cd36516e92c14c9465d6b4523f98c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1061d0457c6b9d242e295bc72129db54ab6ce5ed279fa44420457a19996e218b9500c581f2cb781474fe28f6e9e5c727bca7df514496353bc7f544426efb2f8b
|
7
|
+
data.tar.gz: 7c00b6cd33a07215ade4090543c1e60b04b99b9e33010a6b3f10ad1a3426294ae07892372746aed8e7d7ac661be946e10caaa703bbf64b3a3a6ced3d18d35dca
|
data/README.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# [RecordViewHelper](https://github.com/Narazaka/record_view_helper)
|
2
2
|
|
3
|
+
[![Gem](https://img.shields.io/gem/v/record_view_helper.svg)](https://rubygems.org/gems/record_view_helper)
|
4
|
+
[![Gem](https://img.shields.io/gem/dtv/record_view_helper.svg)](https://rubygems.org/gems/record_view_helper)
|
5
|
+
[![Gemnasium](https://gemnasium.com/Narazaka/record_view_helper.svg)](https://gemnasium.com/Narazaka/record_view_helper)
|
6
|
+
[![Inch CI](http://inch-ci.org/github/Narazaka/record_view_helper.svg)](http://inch-ci.org/github/Narazaka/record_view_helper)
|
7
|
+
[![Travis Build Status](https://travis-ci.org/Narazaka/record_view_helper.svg)](https://travis-ci.org/Narazaka/record_view_helper)
|
8
|
+
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/Narazaka/record_view_helper?svg=true)](https://ci.appveyor.com/project/Narazaka/record-view-helper)
|
9
|
+
|
3
10
|
table builder and description list (dl) helper for Rails / ActiveModels
|
4
11
|
|
5
12
|
## Usage
|
@@ -9,6 +9,7 @@ module RecordViewHelper
|
|
9
9
|
# @yieldreturn [void]
|
10
10
|
# @return [ActiveSupport::SafeBuffer] rendered result
|
11
11
|
def dl_for(record, options = {})
|
12
|
+
return if record.nil?
|
12
13
|
setting = RecordValueSetting.build_from_hash!(
|
13
14
|
record.attributes.keys,
|
14
15
|
record.class.name.tableize,
|
@@ -54,6 +54,7 @@ module RecordViewHelper
|
|
54
54
|
# / recommended for complex settings
|
55
55
|
# / see RecordValueSetting for details
|
56
56
|
def table_for(records, options = {})
|
57
|
+
return if records.empty?
|
57
58
|
setting = RecordValueSetting.build_from_hash!(
|
58
59
|
records.first.attributes.keys,
|
59
60
|
records.first.class.name.tableize,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: record_view_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Narazaka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|