Hi,

In your view (new.html.erb) file

This line <% form_for @photo, :html => { :multipart => true } do |f|
%> should be like below

<% form_for @photo, :url=>{:action=>'ACTIONNAME', }, :html =>
{ :multipart => true } do |f| %>

i.e give more argument :url=>{} to form_for

To overcome "undefined method `photos_path' for #<ActionView::Base:
0x230ee70>"









On Sep 18, 7:36 am, "cherrian harada" <[EMAIL PROTECTED]> wrote:
> Hi!
> I am sorry to hear your difficulties with the tutorial.   I am a beginner in
> this group so I this you need to pose your question to someone who really
> knows what about ROR.
> Good luck!
>
> On Thu, Sep 18, 2008 at 11:30 AM, Rob Scott <
>
>
>
> [EMAIL PROTECTED]> wrote:
>
> > Hello!
>
> > I've been trying today to setup fleximage to handle photo uploads to a
> > RoR application by following the tutorial that is provided
> > (http://github.com/Squeegy/fleximage/wikis/gettingstarted)
>
> > Originally, I just dropped in all of the sample code that they provided,
> > which I copied below this question.
>
> > - When I tried to access "new" to upload a new photo, I received an
> > error of "Called id for nil, which would mistakenly be 4 -- if you
> > really wanted the id of nil, use object_id", which I understood to be
> > caused by the fact that I was using @photo without initializing it in
> > the controller.
>
> > - I added @photo = Photo.new to the controller for "new" but then it
> > returned that it could not find the table Photo.
>
> > - I created a new migration for a photo table, including only the fields
> > for name and author, which are also requested in the provided "new"
> > view.
>
> > - Now, it just returns the error "undefined method `photos_path' for
> > #<ActionView::Base:0x230ee70>"
>
> > Since I'm incredibly new to fleximage, I'm not exactly sure if I'm going
> > in the wrong direction with my troubleshooting, if a table even needed
> > to be created for the photos or what my next step should be.
>
> > If anyone could point me in the right direction, I'd appreciate it. :)
>
> > Model (photo.rb)
> > class Photo < ActiveRecord::Base
> >  acts_as_fleximage :image_directory => 'public/images/uploaded_photos'
> > end
>
> > Controller (photos_controller.rb)
> > class PhotosController < ApplicationController
>
> > def new
>
> > end
>
> > def create
> > [EMAIL PROTECTED] = Photo.new(params[:photo])
> >  if @photo.save
> >    redirect_to photo_url(@photo)
> >  else
> >    flash[:notice] = 'Your photo did not pass validation!'
> >    render :action => 'new'
> >  end
> > end
>
> > end
>
> > View (new.html.erb)
> > <% form_for @photo, :html => { :multipart => true } do |f| %>
> >  <p>
> >    <b>Name</b><br />
> >    <%= f.text_field :name %>
> >  </p>
>
> >  <p>
> >    <b>Author</b><br />
> >    <%= f.text_field :author %>
> >  </p>
>
> >  <p>
> >    <b>Upload Image</b><br />
> >    <%= f.file_field :image_file %><br />
> >    or URL: <%= f.text_field :image_file_url %>
> >  </p>
>
> >  <p>
> >    <%= f.submit "Create" %>
> >  </p>
> > <% end %>
> > --
> > Posted viahttp://www.ruby-forum.com/.- Hide quoted text -
>
> - Show quoted text -

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to