RoR e-commerce product description not activating

90 Views Asked by At

new to ROR ecommerce and am having trouble activating a product. I have entered a description which saves and appears in the overview and input box but not in the preview in the description editor. When I go to activate the product I get the flash error: "Please add a description before Activating." My description still appears in the input box but not below it in the preview.

from product_controller:

def activate
  @product = Product.find(params[:id])
  @product.deleted_at = nil
  if @product.save
    redirect_to admin_merchandise_product_url(@product)
  else
    flash[:alert] = "Please add a description before Activating."
    redirect_to edit_admin_merchandise_products_description_url(@product)
  end
end

from product model:

before_save :create_content
...
validates :description_markup,presence: true, length: { maximum: 2255 }, if: :active
...

def create_content 
  self.description = BlueCloth.new(self.description_markup).to_html unless self.description_markup.blank?
end

ruby -v 2.0.0p247

rails -v 4.0.2

bluecloth 2.2.0

the only gem I added was therubyracer

Thank you for reading my post.

0

There are 0 best solutions below