Topic: RUBY on Rails Bible
Hi !
Im a newbie. A previous post here, posted on 2009-11-19 08:53:19
(
You are not logged in. Please login or register.
Hi !
Im a newbie. A previous post here, posted on 2009-11-19 08:53:19
(
RUBY on Rails Bible" Ch. 7 bookshelf example, Amazon AWS help
Im a newbie. The last post here on the subject, posted on 2009-11-19 08:53:19,
and responses to it, may be out of date: the code there does not work for me,
(it does not seem that my SECRET_KEY is getting through) . Per the book, Im
using Ian Macdonald's Ruby/AWS interface. Also, is it possible that it is
NECESSARY to get an "Associates_ID" in order for one's SECRET_KEY to work,
although this was not necessary before (I have not gotten one ). ?
Essentially Im getting the dreaded HTTP 400 error. From what I can make of
things, my AMAZON secret key is not getting through, from the line:
resp = @request.search(is)
Im getting two kinds of errors.
error 1) "
RuntimeError in BookController#search
ObjectSpace is disabled; each_object will only work with Class, pass -X+O to
enable
"
Well, I did a little homework on this one, and then hesitantly enabled
ObjectSpace by adding these two lines to development.rb:
require 'jruby'
JRuby.objectspace=true
now , i get error 2: "
Amazon::AWS::HTTPError in BookController#search
HTTP response code 400
"
...with the "get_page" and "search" lines being the top two in the trace
report, just as in the previous post mentioned above.
In both error cases, the error report lists an "authenticity_token" that does
not match my secret key (which I put in an Amazonrc.txt file per recent
instructions). And from my testing using rails console, it does seem as though
I get the path to Amazonrc.rb handled appropriately.
anyway , heres my code and some relevant info. Tx in advance for your help !!
Windows XP
Netbeans 6.8 IDE
RUBY/AWS 0.8.1, installed via RubyGem
code:
.../Libs/amazon_interface.rb :
require 'amazon/aws/search'
include Amazon::AWS
include Amazon::AWS::Search
@request = Request.new('MY_KEY_ID')
is = ItemSearch.new('Books', {'Keywords' => "ruby programming" }
is.response_group = ResponseGroup.new( :Medium )
resp = @request.search(is)
products = resp.item_search_response.items.item
../Libs/amazonrc.txt:
# Any line that starts with a hash character is a comment.
key_id = 'MY_KEY_ID'
secret_key_id = 'MY_SECRET_KEY'
cache = false
locale = 'us'
#
#encoding = 'iso-8859-15'
#default encoding is UTF-8, which is the one used here
...and placed in the file .../Configuration/environments/development.rb , is
ENV['AMAZONRCDIR'] = "#{RAILS_ROOT}/Libs/"
Last edited by s2e (2011-10-10 14:44:05)
Hai frinds please help me how to make a connection to MYSQL database....
Are those mandatory to use production and test database?
Following is The our database,yml file
development:
adapter: mysql
database: vikram_development
username: root
password: root
host: localhost
timeout: 5000
# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test:
adapter: mysql
database: vikram_test
username: root
password: root
host: localhost
timeout: 5000
then tell me the steps to make a connections between ruby on rails and mysql
Hosting provided by aTech Media