Jump to content

The ultimate community for Ruby on Rails developers.


Photo

Carrierwave_Direct's direct_upload_form_for returns undefined method `model_name'

mongoid carrierwave s3 ruby on rails

  • Please log in to reply
No replies to this topic

#1 Psycho

Psycho

    Passenger

  • Members
  • 1 posts

Posted 01 December 2013 - 09:58 AM

I've been struggling with this for a couple of hours now. When using carrierwave_direct's 

direct_upload_form_for

in my view, it returns me this error:

 

xuiLP.png

 

FileUploader Carrierwave Class:

class FileUploader < CarrierWave::Uploader::Base
  include CarrierWaveDirect::Uploader
end

ManualFile Model:

class ManualFile
  include Mongoid::Document
  mount_uploader :file, FileUploader

  field :name, :type => String
end

UploadController:

class UploadController < ApplicationController
  def manual_new
    @uploader = ManualFile.new.file
    @uploader.success_action_redirect = upload_edit_path
  end

  def manual_edit
    @myfile = ManualFile.new(key: params[:key])
  end
end

My View:

<%= direct_upload_form_for @uploader do |f| %>
  <%= f.file_field :file %>
  <%= f.submit %>
<% end %>

I can't understand what I'm doing wrong. I tried to follow this railscast. I'm using Ruby 1.9.3, Rails 3.2.3, Mongoid 3 with carrierwave gems pointing to github master. This is my first time on railsforums, I hope I'm doing this right. Also, crosspost from Stackoverflow.

 







Also tagged with one or more of these keywords: mongoid, carrierwave, s3, ruby on rails

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users