foxnewsnetwork / American-Lit-315

1 stars 1 forks source link

Get the example code in the wiki working via api calls #46

Closed foxnewsnetwork closed 12 years ago

foxnewsnetwork commented 12 years ago

Just simulated an api call using the example code in the wiki section. The following code is what I ended up getting returned instead of a nice json file:

status: 500 headers: {"content-type":"text/html","content-length":"30284","x-runtime":"0.133223","connection":"keep-alive","server":"thin 1.3.1 codename Triple Espresso"} body:

Action Controller: Exception caught

ActiveRecord::StatementInvalid in ProductsController#random_api

Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0.18505674948030526' at line 1: SELECT  `products`.* FROM `products` LIMIT 1 OFFSET 0.18505674948030526

Rails.root: /root/backend/American-Lit-315

Application Trace | Framework Trace | Full Trace
app/controllers/products_controller.rb:99:in `random_api'

Request

Parameters:

{"token"=>"1234567890",
 "format"=>"json"}

Show session dump

Show env dump

Response

Headers:

None

trevor-umeda commented 12 years ago

What the error says to me is that there is no products yet.

The error is that like the offset is some really bizarre number, if you try to get the offset, for the random call, it'll turn out bad. I've been running everything locally so i've had no problem, but i remember when i didn't have anything in my db, the problem looked like this.

If we fill with some basic products/coupons/whatevs hopefully the problme will be fixed.

SpinnakerSix commented 12 years ago

I've updated the code on gameritser.com 's backend. database should have some products now. I will try to add some more into the seed.rb when I have time.

SpinnakerSix commented 12 years ago

oh and make sure you use the right token.

'12345678' is an example token, not the actual one. If you want one fast, use

cf242dcaf5d0a4a0b0e2949e804dcebf

I just generated it. It's 'Food Fighter's token.

foxnewsnetwork commented 12 years ago

Okay, doing more shop testing. In other news, let's generate an all-purpose game token for future developers too lazy to come to our site to sign up for their own tokens. The general purpose game token can also be used by in-house games. Needless to say, we do not profit share with people who use the general game token