2014-12-29 2 views
1

클립 클립으로 활성 관리 대시 보드에 이미지를 업로드하고 싶지만 "새 장소 그림 추가"를 누르면 아무 일도 일어나지 않습니다. 이미지 아래 :/place.rb ActiveAdmin.register 장소 enter image description here레일 4.1 클립 클립이있는 Activeadmin, 이미지 추가 단추 누르기 응답 없음

모델/place.rb

class Place < ActiveRecord::Base 

    has_many :place_pictures,  :dependent => :destroy, 
           :autosave => true 
    accepts_nested_attributes_for :place_pictures, 
           :allow_destroy => true 
end 

모델/place_picture.rb

class PlacePicture < ActiveRecord::Base 
    belongs_to :place 

    attr_accessible :picture, :logo 
    has_attached_file :picture, :styles => { :medium => "300x300>", :thumb => "100x100>" }, 
           :default_url => "/images/:style/missing.png" 
    validates_attachment_content_type :picture, :content_type => /\Aimage\/.*\Z/ 
end 

관리 do

form :html => { :enctype => "multipart/form-data" } do |f| 
     f.inputs "Place details" do 
     f.input :name 
     f.input :about 
     f.has_many :place_pictures do |ff| 
      ff.input :picture, :as => :file, :hint => ff.template.image_tag(ff.object.picture.url(:thumb)) 
      ff.input :logo, as: :boolean, :label => "isLogo" 
     end  
     end 
    f.actions 
    end 

    index do 
     column :id 
     column :name 
     column :city 
     column :about 
     column "Images" do |place| 
      if !(place.place_pictures.empty?) 
      ul do 
       place.place_pictures.each do |img| 
        li do 
        image_tag(img.picture.url(:thumb)) 
        end 
       end 
      end 
      end 
     end 
     actions 
    end 

    show do |ad| 
     attributes_table do 
     row :name 
     row :city 
     row :about 
     row :image do 
      if !(place.place_pictures.empty?) 
      ul do 
      place.place_pictures.each do |img| 
      li do 
      image_tag(img.picture.url(:thumb)) 
      end 
     end 
     end 
     end 
     end 
    end 
    #active_admin_comments 
    end 
end 

Gemfile은 :

gem 'rails'#version 4.1.8 
gem 'activeadmin', github: 'activeadmin' 
gem "paperclip", "~> 4.2" 

그것은 이전에 잘 작동 3.x 및 active_admin 0.6.x. 레일 어떤 도움이 필요합니까? 감사!

업데이트 : 마지막으로 active_admin.js를 아래로 변경하면 작동합니다! 왜 그런지 모르겠다! 이 상황이 있다면 누구든지 도움을 바랍니다.

// = require jquery 
// = require jquery_ujs 
// = require active_admin/base 

답변

0

필드 (has_many)를 추가하는 자바 스크립트가 작동하지 않는 것 같습니다. 시스템에 JavaScript 런타임이 있습니까? 예를 들어 Node.js.

https://github.com/sstephenson/execjs

+0

가 나는 자바 스크립트 런타임 문제를 생각하지 않습니다,하지만 난 여전히 Node.js를, 어떤 도움을 설치했습니다. 고마워. –