2014-12-27 1 views
0

devise를 사용하여 인증을 관리하고 사용자가 사진을 업로드 할 수있는 새 페이지를 추가하므로 로그인 할 때 업로드 할 수있는 프로필로 리디렉션됩니다. 사진, 어떻게해야합니까? 이 문제에 대한 새로운 컨트롤러를 만들거나 devise의 컨트롤러를 무시해야합니까?이 문제에 대한 내 경로는 어떻게 생깁니 까? 도움을 많이 주시면 감사하겠습니다.레일즈가 클립 클립을 사용하여 사진을 업로드하고 기기를 작성합니다.

감사

답변

2
나는 당신이 당신은 당신의 Application Controller이 추가 필요

첨부 파일 필드로 User 모델과 image이 있다고 가정하고

:

class ApplicationController < ActionController::Base 

    protect_from_forgery 
    before_filter :configure_permitted_parameters, if: :devise_controller? 

    def after_sign_in_path_for(resource) 
     upload_path 
    end 

    protected 

    def configure_permitted_parameters 
    devise_parameter_sanitizer.for(:user) << :image 
    end 
end 

당신은 upload 페이지를 만들 필요를 및 사용자가 이미지를 업로드하는 해당 .

+0

업로드 작업을 어디에 추가합니까? 어느 컨트롤러에서? –