templus_models 1.2.3 → 1.2.4

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: 7cda944df741bea2aa0674649c8a5787cc2b6b6a
4
- data.tar.gz: 38c3b388bf0b13e4eaa846c52ab69acfed11248c
3
+ metadata.gz: f40049a130be15773eb9bfbc66db8112331a7397
4
+ data.tar.gz: d5dab79cff5a21238652c28cd5992d933423ce14
5
5
  SHA512:
6
- metadata.gz: 9688c08585b139a407dc4839421b8fd284e1ddab8e07040d1446f9c543b3e9e79857400f61200e7dfdebd07d009c0b1e5feee3b70048bdaa60fed02968f6242e
7
- data.tar.gz: 665088cd90448ebea1709e600e43621a1121cd3b5fe67f2d04f1dd154e0aee61ba42f95c8cf3b4978c24cecc0caf724dceed7d30364ed15ae7c6a23cf285cbe5
6
+ metadata.gz: de03fcada6f4e9008e2d9314beea4aea5c15b3669d6b22e3cfdac8cfc93649267761da68b0fe7c418059e18b295ce67dbf7dcd8d3e8212f3935a490b36be30cb
7
+ data.tar.gz: d2717ff5a912d42edd7e07d14349594df4125201d0eceef951369ab7e78e5f7a46782625270675286458f78e60817a2eaf98e67da3e7861ccdf09fe1ea6e9de4
@@ -131,7 +131,7 @@ module CrudHelper
131
131
  end
132
132
  else
133
133
  if field[:sf][:value] and field[:sf][:value].class == Proc
134
- field[:sf][:input_html] = {}
134
+ field[:sf][:input_html] ||= {}
135
135
  field[:sf][:input_html][:value] = f.instance_eval &field[:sf][:value]
136
136
  end
137
137
  if field[:sf][:collection_if] and field[:sf][:collection_if].class == Proc
@@ -293,7 +293,7 @@ class RaroCrud
293
293
  {campo: :complemento, label: "Complemento"},
294
294
  {campo: :bairro, label: "Bairro"},
295
295
  {campo: :estado, label: "Estado", collection: Estado.order(:sigla).pluck(:sigla)},
296
- {campo: :cidade_id, label: "Cidade", collection_if: Proc.new{|f| f.try(:object).try(:new_record?) ? [] : (f.try(:object).try(:estado).try(:cidades) || [])}}
296
+ {campo: :cidade_id, label: "Cidade", collection_if: Proc.new{|f| f.try(:object).try(:estado).try(:present?) ? (f.try(:object).try(:estado).try(:cidades) || []) : []}}
297
297
  ].each do |field|
298
298
  value = {}
299
299
  field.each do |atr|
@@ -28,9 +28,9 @@
28
28
 
29
29
  <% end %>
30
30
  <%@crud_helper.form_groups.each do |key, groups|%>
31
- <% if [:has_many,:has_and_belongs_to_many].include?(@model.reflect_on_association(key).macro) && @record.new_record? %>
31
+ <% if [:has_many,:has_and_belongs_to_many].include?(@model.reflect_on_association(key).macro) && @record.new_record? && !@record.send(key).present? %>
32
32
  <% @record.send(key).build %>
33
- <% elsif @record.new_record?%>
33
+ <% elsif @record.new_record? && !@record.send(key).present?%>
34
34
  <% @record.send("build_#{key}") %>
35
35
  <% end %>
36
36
  <%= f.simple_fields_for key do |g| %>
@@ -1,3 +1,3 @@
1
1
  module TemplusModels
2
- VERSION = "1.2.3"
2
+ VERSION = "1.2.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: templus_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Sol
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-06-25 00:00:00.000000000 Z
12
+ date: 2015-07-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails