1

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.

HackerKarma
  • 620
  • 7
  • 18
TlfT
  • 35
  • 3
  • 2
    @product.save returns false, which means there were some errors. Easiest way to see them is to use `@product.save!` - the save! method will raise exception and you will be able to see the problem – lobanovadik Feb 21 '14 at 18:59
  • Need to know more details before we could provide an answer I'm afraid – Richard Peck Feb 22 '14 at 12:34
  • Thank You lobanovadik! with save!, ror-ecommerce gave me a nice explaination of why the product would not activate. It was not the description which it had said it was previously, but rather I needed to update inventory/ could not activate a product not in stock. – TlfT Feb 22 '14 at 16:12
  • I know I'm late but was the error message not showing in the UI? If not I'll try to update – drhenner Jun 29 '16 at 19:20

0 Answers0