hey guys,
I've been working on my first Shopify app and have to say it's gone
mostly pretty smoothly for me. What I wanted to write an app for was
to allow my shop to export all of the orders for the day into a
specially formatted text file. What I've done is set up a rails app
using the shopify gem and the following tutorial:
http://wiki.shopify.com/Creating_an_app_and_deploying_it_to_Heroku.
At first I modified the Home controller to basically perform my
function entirely in the index command to get it working. Everything
seemed to be great so I decided it was time to refactor my action
script into something a little more rubyish and I set up a Reports
model and controller in order to better fragment my code. The problem
in my app occurs when I invoke the create method on a report object
from the Reports controller. The create method resides in the Report
class which is a model. The error I keep getting points me to the
following line:
app/models/report.rb:34:
@orders = ShopifyAPI::Order.find(:all, :params => { :created_at_min =>
"#{@date} 00:00", :created_at_max => "#{@date} 23:59", :order =>
"created_at DESC" })
The error I get is:
Started POST "/reports" for 127.0.0.1 at 2011-08-09 02:51:54 -0400
Processing by ReportsController#create as HTML
Parameters: {"utf8"=>"✓",
"authenticity_token"=>"fCQw3Pegyv069jO0tZ4eY5buslyAM/r8yrG7phyoJqI=",
"id"=>"20110804", "commit"=>"Create"}
Completed 500 Internal Server Error in 9ms
NoMethodError (undefined method `path' for nil:NilClass):
app/models/report.rb:34:in `create'
app/controllers/reports_controller.rb:9:in `create'
It seems like since I moved the call to the ShopifyAPI into my own
class I've prevented it from working properly. Not sure if leaving the
controller that was set-up by the tutorial app means I'm missing some
pieces or not but I figure you guys know exactly what sin I've
committed. Any help is appreciated. I also started a thread on S/O but
am not really getting the right help, there is more of my code posted
though:
http://stackoverflow.com/q/6991675/541005
Thanks