mardi 15 novembre 2016

Active admin nested form not working Error: too many arguments for format string

Following is my code block of state Model, SatatImage Model and Active Admin Code. In active admin when I try to create a new record or Edit a --record that time I show an error on production server. but works on my localhost in development mode, ---------Error---------------------------

too many arguments for format string

app/admin/state.rb:49:in `block (2 levels) in '

I am using Ruby 1.9, Rails 3,2, activeadmin (0.6.0)

======State Model===============
class State < ActiveRecord::Base

   attr_accessible :name, :code
   validates :code, :uniqueness => true
   has_one :state_image, :dependent => :destroy
   accepts_nested_attributes_for :state_image, :allow_destroy => true
   .......
 end

==============StatImage Model=============

class StateImage < ActiveRecord::Base
  attr_accessible :state_id, :stateimage, :image_name

  belongs_to :state
  mount_uploader :stateimage, StateUploader
end


=======Active Admin part=================

ActiveAdmin.register State do
 .....

 form(html:{multipart:true}) do |f|

   f.inputs "State Form" do
     f.input :name, required:true
     f.input :code, required:true
   end

  #let say its line number 49

   f.inputs "StateImage", for:[:state_image, f.object.state_image ||   StateImage.new] do |p|
     p.input :stateimage, :as => :file, :label => "Image" 

   end
   f.buttons :submit
 end

end

Aucun commentaire:

Enregistrer un commentaire