我在我的 rails 3.2 应用程序中使用 quickeebooks gem。在这里,我能够成功地将客户信息推送到 quickbooks。
现在我想在我写的 Rails 应用程序中显示这些记录:
oauth_client = OAuth::AccessToken.new($qb_oauth_consumer, current_login.access_token, current_login.access_secret)
#creating customer in quickbooks
customer_service = Quickeebooks::Online::Service::Customer.new
customer_service.access_token = oauth_client
customer_service.realm_id = current_login.realm_id
customer_service.list
@customer = customer_service.fetch_by_id(12)
并认为:
<%= @customer.name %>
这工作正常。但是,我想显示我在快速手册中推送的所有客户。所以,我写了:
@customers = customer_service.list
鉴于:
<%= @customers.inspect %> is inspecting 3 records from quickbooks
但,
<% @customers.each do |customer| %>
<%= customer.name %>
<% end %>
正在生成
undefined method `each` for #<Quickeebooks::Collection:0xb5288d8>
如何解决这个问题呢。我在这里想念什么?