Hey Travis, thanks a ton for the response. I'm reading up on
ActiveResource now. (like I said, still new to rails)
It still doesn't seem to explain why this doesn't NOT work:
method1 = ShopifyAPI::Asset.find("assets/test.txt",:params =>
{:theme_id => theme_id})
method1.value = "METHOD 1!"
method1.save
while this DOES:
method2 = ShopifyAPI::Asset.all(:params =>
{:theme_id=>theme_id}).find{|asset| asset.attributes[:key] == "assets/
test.txt"}
method2.value = "METHOD 2!"
method2.save
AHA! (writing this as I code)
It looks like my little hack just worked around a bug. I dumped the
two objects that are returned:
METHOD 1:
--- !ruby/object:ShopifyAPI::Asset
attributes:
created_at: 2011-10-05 18:26:54.000000000Z
updated_at: 2011-10-06 04:18:53.000000000Z
public_url:
http://static.shopify.com/s/files/1/0102/3992/t/2/assets/test.txt?398
value: this is a test
key: assets/test.txt
prefix_options: {}
persisted: true
METHOD 2:
--- !ruby/object:ShopifyAPI::Asset
attributes:
created_at: 2011-10-05 18:26:54.000000000Z
updated_at: 2011-10-06 04:18:53.000000000Z
public_url:
http://static.shopify.com/s/files/1/0102/3992/t/2/assets/test.txt?398
key: assets/test.txt
prefix_options:
:theme_id: '1931092'
persisted: true
looks like the "prefix_options" are missing on method1! this works!
method1 = ShopifyAPI::Asset.find("assets/test.txt",:params =>
{:theme_id => theme_id})
method1.value = "METHOD 1!"
method1.prefix_options[:theme_id] = theme_id
method1.save