Paperclip和carrierwave - 文件不保存+其他问题

时间:2016-05-17 11:30:33

标签: ruby-on-rails

我对rails app的问题很少: 1.我尝试使用paperclip和carrierwave,但没有一个保存我要附加到指定文件夹的文件。附件应加入用户模型:

public static void main(String... args) {

    RestContext context = new RestContext(8080, "/api");

    context.addEndpoint(new CustomerEndpoint(new CustomerService()));
    context.addEndpoint(new AnotherEndpoint()); // you can add or remove as many as you want.

    context.enableCors();
}

用户控制器:

class UsersController < ApplicationController
    def new
        @users = User.new
    end
    def create
        @user = User.new(user_params)
        if @user.save 
            session[:user_id] = @user.id 
            redirect_to '/' 
        else 
            redirect_to '/signup' 
        end 
    end
    private
        def user_params
        params.require(:user).permit(:first_name, :last_name, :email, :PESEL, :phone, :cv, :password)
        end
end

纸夹:

class UsersController < ApplicationController
        def new
            @users = User.new
        end
        def create
            @user = User.new(user_params)
            if @user.save 
                session[:user_id] = @user.id 
                redirect_to '/' 
            else 
                redirect_to '/signup' 
            end 
        end
        private
            def user_params
            params.require(:user).permit(:first_name, :last_name, :email, :PESEL, :phone, :cv, :password)
            end
    end

任务是什么 - 我想让用户加入&#39;使用附件,然后与jobapps模型结合 - 这样它将创建新的工作应用程序ID,其中empoyee可以决定是否接受。我在附加CV文件时遇到了麻烦。

0 个答案:

没有答案