Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote_table in spree 0.70.7 controller: #<TypeError: Zip is not a module> #17

Open
bsa7 opened this issue Jun 25, 2014 · 4 comments
Open

Comments

@bsa7
Copy link

bsa7 commented Jun 25, 2014

Hi!
I'm include gem 'remote_table' in my Gemfile (Rails 3.1.12)
In spree admin i'd create new controller:

class Admin::XlsPriceLoadsController < Admin::BaseController
  def upload
    source_xls = RemoteTable.new(filename)
    source_xls.each do |row|
      ....
    end
  end
end

but when this action fired, i'm see the next:

TypeError (Zip is not a module):
app/controllers/admin/xls_price_loads_controller.rb:26:in `upload'
...

when i'm explore the source_xls object, a frozen? property of them is true.

So, can any soul write me, why the parsed object is frozed?
And, if i run this code

 source_xls = RemoteTable.new(filename)
    source_xls.each do |row|
      ....
    end

from lib/tasks as rake task - all work fine!
All wo
Thanks for all advice!

@seamusabshere
Copy link
Owner

hi @r72cccp !

TypeError (Zip is not a module):
app/controllers/admin/xls_price_loads_controller.rb:26:in `upload'

what is the whole error message? thanks!

@bsa7
Copy link
Author

bsa7 commented Jun 26, 2014

All error message is:

Completed 500 Internal Server Error in 464ms

TypeError (Zip is not a module):
  app/helpers/prices_helper.rb:25:in `xls_read'
  app/controllers/admin/xls_price_loads_controller.rb:26:in `upload'
  app/middlewares/empty_session_cookie_cleaner.rb:12:in `call'
  app/middlewares/accept_header_corrector.rb:9:in `call'
  app/middlewares/redirect_old_product_url.rb:13:in `call'
  config/initializers/clean_cookies.rb:51:in `call'
  config/initializers/sanitize_env.rb:19:in `call'

Rendered /home/slon/.rvm/gems/ruby-2.1.1/gems/actionpack-3.1.12/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.2ms)
Rendered /home/slon/.rvm/gems/ruby-2.1.1/gems/actionpack-3.1.12/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.0ms)
Rendered /home/slon/.rvm/gems/ruby-2.1.1/gems/actionpack-3.1.12/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (3.7ms)

@seamusabshere
Copy link
Owner

grep -R Zip .

@bsa7
Copy link
Author

bsa7 commented Jun 26, 2014

And i get:

./models/zip.rb:class Zip < ActiveRecord::Base
./helpers/admin/zips_helper.rb:module Admin::ZipsHelper
./controllers/admin/zips_controller.rb:class Admin::ZipsController < Admin::ResourceController

So, if i'm understand right - the module Zip in somewhere which used my remote_table was oberrided with class Zip in models/zip.rb. So, what ca i do? Rename class Zip in model and their descendands?

P.S.

I overwrited class in model from Zip to ZipCode and ... tadam!!!
All work fine

Thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants