active adminを導入してからタイトルのようなエラーが出ます。
Showing /Users//.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/activeadmin-4f494073c6c0/app/views/active_admin/resource/show.html.arb where line #2 raised: wrong number of arguments (given 1, expected 0) temp_method = "__temp__#{safe_name}" ActiveRecord::AttributeMethods::AttrNames.set_name_cache safe_name, name @module.module_eval method_body(temp_method, safe_name), __FILE__, __LINE__ @module.instance_method temp_method end end
今まではこのようなエラーが出たことがなかったので、どう対処していいのかわかりません。
現状だと
・他のモデルからはデータを登録して、その後showページで確認ができる
・Product modelも投稿画面から新しいデータを作成をできる(しかし、showページが出てくることがなくエラーが出る)
Product モデルのみでこのようなエラーが出るので、モデル周辺に問題があるかと思うのですが、もしわかる方がいらっしゃいましたら、教えていただけると嬉しいです。
こちらがモデルとactive adminのコードです。
admin
1ActiveAdmin.register Product do 2 3 #indexページ 4 index do 5 selectable_column 6 id_column 7 # column :image do |b| 8 # image_tag(b.image.url(:thumb)) 9 # end 10 column :model 11 column :method 12 column :height 13 column :width 14 column :depth 15 column :pitch 16 column :accuracy 17 column :updated_at 18 actions 19 end 20 21 # #showページ 22 show do 23 attributes_table do 24 row :model 25 row :price 26 row :method 27 row :height 28 row :width 29 row :depth 30 row :agency 31 row :pitch 32 row :accuracy 33 row :created_at 34 row :updated_at 35 end 36 end 37 38 #formのコード 39 form do |f| 40 f.inputs 'プリンター' do 41 f.input :model 42 f.input :price 43 f.input :method 44 f.input :height 45 f.input :width 46 f.input :depth 47 f.input :agency 48 f.input :pitch 49 f.input :accuracy 50 f.has_many :product_makers, allow_destroy: true, new_record: true do |t| 51 t.input :maker_id, 52 label: 'メーカー', 53 as: :select, 54 collection: Maker.all 55 end 56 f.has_many :product_uses, allow_destroy: true, new_record: true do |t| 57 t.input :use_id, 58 label: '用途', 59 as: :select, 60 collection: Use.all 61 end 62 f.actions 63 end 64 end 65 permit_params :model, :price, :method, :height, :width, :depth, :agency, :pitch, :accuracy, 66 product_makers_attributes: [:id, :maker_id], 67 product_uses_attributes: [:id, :use_id] 68end 69
product
1 2 3class Product < ActiveRecord::Base 4 has_many :product_uses 5 has_many :uses, :through => :product_uses 6 accepts_nested_attributes_for :product_uses, :allow_destroy => true 7 8 has_many :product_makers 9 has_many :makers, :through => :product_makers 10 accepts_nested_attributes_for :product_makers, :allow_destroy => true 11 12end 13 14
あなたの回答
tips
プレビュー