krhorst / active_admin_importable

CSV imports for Active Admin resources
MIT License
53 stars 55 forks source link

uninitialized constant #10

Closed cmunozgar closed 11 years ago

cmunozgar commented 11 years ago

Hi, I'm trying to import a csv from a model called 'SpotStatus' and I'm getting the current error: NameError (uninitialized constant SpotStatu)

Any chance there's a fix to this?

antonzaytsev commented 11 years ago

Hi cmunozgar,

looks like you did a mistake somewhere, can you please show here your code of active admin controller where you turned on active_admin_importable?

Blue-Dog-Archolite commented 11 years ago

I would be money that the issue is that SpotStatus has issues with pluralization.

1.9.3p194 :003 > "SpotStatus".singularize
=> "SpotStatu"
1.9.3p194 :006 > "SpotStatus".pluralize
=> "SpotStatuses"

Just a thought.

cmunozgar commented 11 years ago

Hi,

Here is my code:

ActiveAdmin.register SpotStatus do active_admin_importable menu :parent => "Spots" end

I'm with Blue-Dog-Archolite that it can be a thing with the pluralization because other Models have worked correctly!

krhorst commented 11 years ago

Just pushed a fix to this.

Added a call to pluralize before constantize to get around the "singularizing the singular" troubles with irregular plurals (https://github.com/rails/rails/pull/8671).