undefined method `nil_class_path'

110 views
Skip to first unread message

Darren

unread,
Jun 28, 2009, 11:31:22 PM6/28/09
to Paperclip Plugin
Hi I'm not sure if this is an issue with Paperclip, but since
deploying my app I'm getting this when submitting my form:

ActionView::TemplateError (undefined method `nil_class_path' for
#<ActionView::Base:0xb7625c20>) on line #1 of app/views/photographs/
_form.html.erb:
1: <% form_for @photograph, :html => { :multipart => true } do |f| %>
2: <%= f.error_messages %>
3: <p>
4: <%= f.file_field :photo %>

It works fine locally, any ideas?

Cheers.

Darren

unread,
Jul 1, 2009, 12:48:25 AM7/1/09
to Paperclip Plugin
Okay I've worked out it's getting the error because I don't have an
index action for my photographs controller.

My create action is pretty vanilla:

def create
@photograph = Photograph.new(params[:photograph])
if @photograph.save
flash[:notice] = "Successfully created photograph."
redirect_to new_photograph_path
else
render :action => 'new'
end
end

For some reason, after the form is submitted, the browser gets pointed
to example.com/photographs/ WITH a trailing slash, and the model isn't
created. I even try very small files, same outcome. I'm on mediatemple
gs.

Jonathan Yurek

unread,
Jul 1, 2009, 9:10:37 AM7/1/09
to papercli...@googlegroups.com
Can you post your attachment definition?

Looking at your action, you're rendering the new action at the create
url if something goes wrong. So, from what I can tell, you're not
actually redirecting, you're just rendering "new" because of some
error in saving.
--
Jonathan Yurek, Founder and CTO
thoughtbot, inc.
organic brains. digital solutions.

617.482.1300 x114
http://www.thoughtbot.com/

Reply all
Reply to author
Forward
0 new messages