2011-12-15 3 views
0

3.1 오류 그래서 나는 여기의 지시에 따랐습니다 : 내 프로필 모델에서 http://doganberktas.com/2010/09/14/amazon-s3-and-paperclip-rails-3/종이 클립은 루트

내가 가진 내 경로에 프로파일 :

attr_accessor :pic_file_name (this was requested on first attempt) 
    has_attached_file :pic, 
     :styles => { 
     :thumb=> "100x100#", 
     :small => "400x400>" }, 
    :storage => :s3, 
    :s3_credentials => "#{Rails.root}/config/s3.yml", 
    :path => "/:style/:id/:filename" 

나는 자원을 가지고있다. 내가 페이지를 볼 때

<%= form_for :profile, @profile, :url => profile_path, :html => { :multipart => true } do |f| %> 
<%= f.file_field :pic %> 
<%= f.submit :class => "button-style", :value => "Upload File" %> 
<% end %> 

, 나는이 오류가 :

내보기는 다음이 없습니다 어떤 경로 일치 {: 행동 => "쇼": 컨트롤러 => "프로파일"}. 비록 내가 당신을 확신시킬 수는 있지만, 쇼 액션을 가진 프로필 컨트롤러가 있습니다. 내가

<%= form_for :profile, @profile, :url => @profile, :html => { :multipart => true } do |f| %> 
<%= f.file_field :pic %> 
<%= f.submit :class => "button-style", :value => "Upload File" %> 
<% end %> 

에보기를 변경하는 경우

은 내가 인수의 잘못된 번호 (2 3) 그런 다음

내가

<%= form_for @profile, :url => profile_path, :html => { :multipart => true } do |f| %> 
<%= f.file_field :pic %> 
<%= f.submit :class => "button-style", :value => "Upload File" %> 
<% end %> 

에보기를 변경하는 경우를 알려줍니다 페이지가로드되고 이미지를 업로드 할 수 있습니다.

<퍼센트 = current_user.profile.pic %> 나 제공 : 그러나 사용하여 나중에 인쇄하려고 /pics/original/missing.png을 (처럼 profile.pic.url가)

답변

2

이 바보 넘어 보인다 (위의 이전과 나를 위해 일했다) - 그러나 이것은 그것을 고정 : 솔루션에 대한

<%= form_for(@profile, :html => { :multipart => true }) do |f| %> 
0

감사 :

는에보기를 변경. 덧붙여,

<%= form_for (@profile, :html => { :multipart => true }) do |f| %> 

은 나를 위해 작동하지 않았지만,

<%= form_for(@profile, :html => { :multipart => true }) do |f| %> 

작업을했다. form_for 이후 내가 가지고 있었던 그 공간은 물건을 부수는 것처럼 보이고, 나의 문제의 원인 이었을지 모른다.

+0

이 함수는'm (a, b)'라는 두 개의 인수로'm'을 호출합니다. 이것은 괄호가 'a, b'를 하나의 (잘못된) 표현으로 그룹화하는 것으로 간주되기 때문에 구문 오류입니다 :'m (a, b)'. –

관련 문제