Created
February 11, 2021 01:40
-
-
Save anitagraham/b8e5fe716b6a9db7253af022fe2ef82d to your computer and use it in GitHub Desktop.
Spina Custom Part
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-# app/views/spina/admin/parts/cards/_form.html.haml | |
.page-form-label= f.object.title | |
.page-form-control | |
# this line, as generated, produces "uninitialized constant Card" | |
.select-dropdown= f.select :card_id, Card.all.pluck(:title, :id) | |
# this line, with the model class in full gets "ActionView::Template::Error (undefined method `all' for Spina::Parts::Card:Class)" | |
.select-dropdown= f.select :card_id, Spina::Parts::Card.all.pluck(:title, :id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Spina | |
module Parts | |
class Card < Base | |
attr_json :card_id, :integer | |
attr_json :card_title, Spina::Parts::Line.to_type | |
attr_json :content, Spina::Parts::Text.to_type | |
attr_json :image, Spina::Parts::Image.to_type | |
attr_json :footer, Spina::Parts::Line.to_type | |
def content | |
Card.find(card_id) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment