Skip to content

Instantly share code, notes, and snippets.

@BenMorganIO
Last active August 29, 2015 14:05
Show Gist options
  • Save BenMorganIO/3652d38bb3bbc924b8ae to your computer and use it in GitHub Desktop.
Save BenMorganIO/3652d38bb3bbc924b8ae to your computer and use it in GitHub Desktop.
Adding Subtitle to Spree Product Page
# 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