Cannot activate a product

44 views
Skip to first unread message

Harris Robin Kalash

unread,
Jan 8, 2014, 9:35:39 PM1/8/14
to ror_ec...@googlegroups.com
Hi,

I am logged in as super admin and yet when I click on "not active" to activate it and click "OK" it does nothing and the product remains "Not active".

I did an autotest and this is what i get 

Finished in 1 minute 40.01 seconds
811 examples, 1 failure, 15 pending
Failed examples:
rspec ./spec/models/product_spec.rb:196 # Product class methods #admin_grid(params = {}, active_state = nil) should return deleted Products 

Seems to be related since my problem is with products.


Any ideas ? 

David Henner

unread,
Jan 9, 2014, 10:52:04 AM1/9/14
to ror_ec...@googlegroups.com
I'll take a look.   I have to run to work so It might be until the end of day



--
You received this message because you are subscribed to the Google Groups "ror_ecommerce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ror_ecommerc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

David

unread,
Jan 9, 2014, 11:50:25 AM1/9/14
to ror_ec...@googlegroups.com
Is this an issue for all products?  I can't repeat the problem on the demo  site. 



Sent from my iPhone
--

David

unread,
Jan 9, 2014, 12:02:49 PM1/9/14
to ror_ec...@googlegroups.com, ror_ec...@googlegroups.com
Can you post your log files?  I think the product must be in an invalid state but I don't know how that could happen

Might be good to go into the rails console and do:

Product.valid?
Product.errors.full_messages

Sent from my iPhone

On Jan 8, 2014, at 6:35 PM, Harris Robin Kalash <harrisro...@gmail.com> wrote:

--

Harris Robin Kalash

unread,
Jan 11, 2014, 5:02:09 AM1/11/14
to ror_ec...@googlegroups.com
Sorry for the late reply. I went to rails console and wrote what you mentioned and it returned the following. 

Is this a problem with dalli_store ? my database ? (sqlite3). This is probably a noob mistake, im a rookie sorry.

2.0.0p247 :001 > Product.valid?

NoMethodError: undefined method `valid?' for Product(no database connection):Class

from /Users/harrisrobin/.rvm/gems/ruby-2.0.0-p247@ror_ecommerce/gems/activerecord-4.0.1/lib/active_record/dynamic_matchers.rb:22:in `method_missing'

from (irb):1

from /Users/harrisrobin/.rvm/gems/ruby-2.0.0-p247@ror_ecommerce/gems/railties-4.0.1/lib/rails/commands/console.rb:90:in `start'

from /Users/harrisrobin/.rvm/gems/ruby-2.0.0-p247@ror_ecommerce/gems/railties-4.0.1/lib/rails/commands/console.rb:9:in `start'

from /Users/harrisrobin/.rvm/gems/ruby-2.0.0-p247@ror_ecommerce/gems/railties-4.0.1/lib/rails/commands.rb:62:in `<top (required)>'

from bin/rails:4:in `require'

from bin/rails:4:in `<main>'

2.0.0p247 :002 > 

2.0.0p247 :002 > Product.errors.full_messages

NoMethodError: undefined method `errors' for Product(no database connection):ClassNoMethodError: undefined method `errors' for Product(no database connection):Classfrom /Users/harrisrobin/.rvm/gems/ruby-2.0.0-p247@ror_ecommerce/gems/activerecord-4.0.1/lib/active_record/dynamic_matchers.rb:22:in `method_missing'from (irb):2 from /Users/harrisrobin/.rvm/gems/ruby-2.0.0-p247@ror_ecommerce/gems/railties-4.0.1/lib/rails/commands/console.rb:90:in `start' from /Users/harrisrobin/.rvm/gems/ruby-2.0.0-p247@ror_ecommerce/gems/railties-4.0.1/lib/rails/commands/console.rb:9:in `start' from /Users/harrisrobin/.rvm/gems/ruby-2.0.0-p247@ror_ecommerce/gems/railties-4.0.1/lib/rails/commands.rb:62:in `<top (required)>' from bin/rails:4:in `require' from bin/rails:4:in `<main>'  

David Henner

unread,
Jan 11, 2014, 11:53:57 AM1/11/14
to ror_ec...@googlegroups.com
product needs to be a variable not a class

product = Product.find(id_of_the_product)
product.valid?
product.errors.full_messages


--

Harris Robin Kalash

unread,
Jan 12, 2014, 4:24:38 PM1/12/14
to ror_ec...@googlegroups.com
Thanks Dave!

I tested it with product ID 1:

2.0.0p247 :002 > product = Product.find(1)
  Product Load (3.5ms)  SELECT "products".* FROM "products" WHERE "products"."id" = ? LIMIT 1  [["id", 1]]
 => #<Product id: 1, name: "Cute Polo", description: "<p>This shirt is made for developers.</p>\n\n<pre><co...", product_keywords: ["polo", "shirt"], product_type_id: 2, prototype_id: 1, shipping_category_id: 1, permalink: "cute-polo-shirt", available_at: "2011-11-05 18:30:29", deleted_at: "2014-01-09 02:09:23", meta_keywords: "polo shirt", meta_description: "polo shirt for your wearing pleasure", featured: false, created_at: "2014-01-09 02:09:23", updated_at: "2014-01-09 02:09:23", description_markup: "This shirt is made for developers.\n\n      ---------...", brand_id: 1> 
2.0.0p247 :003 > product.valid?
  Product Exists (0.7ms)  SELECT 1 AS one FROM "products" WHERE ("products"."permalink" = 'cute-polo-shirt' AND "products"."id" != 1) LIMIT 1
 => true 
2.0.0p247 :004 > product.errors.full_messages
 => [] 
2.0.0p247 :005 > 


Intuitively, everything seems right. What am I missing ? 

I will work on it again tonight and see if i can solve it by starting my project from scratch using your videos and yard docs!

Thanks,
Harris

David Henner

unread,
Jan 12, 2014, 10:19:00 PM1/12/14
to ror_ec...@googlegroups.com
The videos are very old....  I should make new videos if I have time one of these days.

Good luck.  BTW images and stack traces are the best way to give me info

Dave

Harris Robin Kalash

unread,
Jan 13, 2014, 8:14:51 PM1/13/14
to ror_ec...@googlegroups.com
Will keep that in mind! and yeah, new videos would be great :) I wish I could help. 
Reply all
Reply to author
Forward
0 new messages