cookbook 0.1.1 → 0.1.2
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 +4 -4
- data/VERSION +1 -1
- data/app/models/cookbook/use.rb +8 -4
- data/cookbook.gemspec +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3e5ddf2c7e8f42e08fdfe0efa01b04db1692f1a3b7bcaf22bb5b280894b517e6
|
|
4
|
+
data.tar.gz: 714e544111f74044a07b4a8185937a00ac334f06e886140c0dbe7fca361f014c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c8bda17026410a17d057aa27d74a275976848a6be03e85bf34d6edc86e900ca360ad24ba36515f3f6b23e5cbfc4e715c4a6682bd339793c7a28d4a7b650a082c
|
|
7
|
+
data.tar.gz: f486ba4c50eb39296f6518e5804ebbc6d86f20e5b86eeae42b8c644e5181ce2166b4d2bb991bc17b0d9067fb96edff07dcdb94364bb4740675fc948dd9fb3b28
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.2
|
data/app/models/cookbook/use.rb
CHANGED
|
@@ -7,11 +7,14 @@ module Cookbook
|
|
|
7
7
|
belongs_to :use_in, polymorphic: true
|
|
8
8
|
belongs_to :use_of, polymorphic: true
|
|
9
9
|
|
|
10
|
-
# Scopes
|
|
11
|
-
scope :recipe_uses, -> { where use_in_type: 'Recipe' }
|
|
12
|
-
scope :ingredient_uses, -> { where use_of_type: 'Ingredient' }
|
|
13
|
-
|
|
14
10
|
# Methods
|
|
11
|
+
def object_label
|
|
12
|
+
return use_of.name if use_of.respond_to?(:name)
|
|
13
|
+
return use_of.title if use_of.respond_to?(:title)
|
|
14
|
+
|
|
15
|
+
super
|
|
16
|
+
end
|
|
17
|
+
|
|
15
18
|
def quantity_with_unit
|
|
16
19
|
[quantity, unit].compact.join(' ')
|
|
17
20
|
end
|
|
@@ -26,6 +29,7 @@ module Cookbook
|
|
|
26
29
|
if defined?(RailsAdmin)
|
|
27
30
|
rails_admin do
|
|
28
31
|
visible false
|
|
32
|
+
object_label_method { :object_label }
|
|
29
33
|
edit do
|
|
30
34
|
include_all_fields
|
|
31
35
|
field :use_in do
|
data/cookbook.gemspec
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
|
-
# stub: cookbook 0.1.
|
|
5
|
+
# stub: cookbook 0.1.2 ruby lib
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |s|
|
|
8
8
|
s.name = "cookbook".freeze
|
|
9
|
-
s.version = "0.1.
|
|
9
|
+
s.version = "0.1.2"
|
|
10
10
|
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
12
12
|
s.metadata = { "source_code_uri" => "http://github.com/gemvein/cookbook" } if s.respond_to? :metadata=
|