Last active
August 29, 2015 14:05
-
-
Save BenMorganIO/3652d38bb3bbc924b8ae to your computer and use it in GitHub Desktop.
Adding Subtitle to Spree Product Page
This file contains 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
# First you need the migration. Run: | |
# | |
# $ rails g migration add_subtitle_to_spree_product | |
# | |
# And the code is as so: | |
class AddSubtitleToSpreeProduct < ActiveRecord::Migration | |
def up | |
add_column :spree_products, :subtitle, :string | |
end | |
def down | |
remove_column :spree_products, :subtitle | |
end | |
end | |
# Then we have to permt the method in the Spree::Product model: | |
# Not sure how to to do this right now.... | |
# Next you have to use Deface to add the text field on the edit admin product page | |
# Finally, you can now rnder the text in the view using: | |
# | |
# <%= @product.subtitle %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment