scarfacedeb / rails_admin_globalize_field

Tabbed interface and custom field type for globalize translations for Rails_admin
MIT License
50 stars 60 forks source link

undefined method `[]' for #<RailsAdmin::Adapters::ActiveRecord::Association:0x00000106a022e0> #5

Closed infernalmaster closed 10 years ago

infernalmaster commented 10 years ago

My gemfile:

source 'https://rubygems.org'
ruby '2.1.1'
gem 'rails', '4.0.0'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
gem 'devise'
gem 'haml-rails'
gem 'simple_form'
gem 'therubyracer', :platform=>:ruby
group :development do
  gem 'better_errors'
  gem 'binding_of_caller', :platforms=>[:mri_19, :mri_20, :rbx]
  gem 'html2haml'
  gem 'quiet_assets'
  gem 'rails_layout'
end
group :development, :test do
  gem 'factory_girl_rails'
  gem 'rspec-rails'
  gem 'thin'
end
group :production do
  gem 'unicorn'
end
group :test do
  gem 'capybara'
  gem 'database_cleaner', '1.0.1'
  gem 'email_spec'
end

gem 'rmagick', '~> 2.13.1'
gem 'rails_admin', require: 'rails_admin', github: 'sferik/rails_admin'
gem 'ckeditor'
gem 'carrierwave'
gem 'compass-rails'
gem 'susy', '1.0.9'

gem 'globalize', '~> 4.0.1'
gem 'globalize-accessors'
gem 'rails_admin_globalize_field'

And I found it's because of

properties = parent.abstract_model.associations.detect { |p| name == p[:name] }

'parent.abstract_model.associations' is an array of 'RailsAdmin::Adapters::ActiveRecord::Association', so fast fix is change that to

properties = parent.abstract_model.associations.detect { |p| name == p.name }
Florian95 commented 10 years ago

Same here !

emoreth commented 10 years ago

Same here ! [2]

scarfacedeb commented 10 years ago

I'm really sorry for the delay! Thank you for finding the source of this problem.

It seems to me that this commit caused the issue.

You can update to 0.3.1 version to resolve it.