Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6614707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:22:18+00:00 2026-05-25T20:22:18+00:00

I am trying to update my photographer model. But how problems with Rails routing

  • 0

I am trying to update my photographer model. But how problems with Rails routing and paperclip wont replace image.

When I submit my form the url is: http://localhost:3000/admin/photographers/save.75 which gives an error. Couldn't find Photographer without an ID

And my image is not updated.

My form:

<%= simple_form_for @photographer, :url => save_admin_photographers_path(@photographer), :html => {:multipart => true, :method => :post} do |f| %>
  <%= javascript_include_tag "tiny_mce/tiny_mce" %>
  <%= javascript_include_tag "init_my_tiny_mce" %>

  <%= f.input :name, :label => 'Name' %>
  <%= f.text_area :text, :label => 'Text', :size => '12x12' %>
  <%= f.file_field :image, :label => 'Image' %>
  <% if @photographer %>
    <% if @photographer.image %>
      <p class="ok">
        <label for="dd">image ok</label>
        <%= image_tag("http://s3-eu-west-1.amazonaws.com/kjacobsen/photographer/image/#{@photographer.id}/#{@photographer["image"]}", :size => "39x22") %>
      </p>
      <p>
        <label for="sdd">&nbsp;</label>
        <%= link_to("remove", {:action => "remove_image", :id => @photographer.id}, {:confirm => "Are your sure?"}) %>
      </p>
    <% else %>
      <p class="current">
        <label for="dd"></label>
        No image uploaded for movie
      </p>
    <% end %>
    <br />
  <% end %>

  <br />
  <%= f.file_field :flv, :label => 'Upload FLV' %>
  <br />
  <% if @photographer %>
    <% if @photographer.flv %>
      <p class="ok">
        <label for="dd">flv: <%= @photographer["flv"] %></label>
        <%= link_to("remove", {:action => "remove_flv", :id => @photographer.id}, {:confirm => "Are your sure?"}) %>
      </p>
    <% else %>
      <p class="current">
        No flv uploaded
        <br /><br />
      </p>
    <% end %>
  <% end %>
  <br />
  <%= f.file_field :quicktime, :label => 'Upload Quicktime' %>
  <br />
  <% if @photographer %>
    <% if @photographer.quicktime %>
      <p class="ok">
        <label for="dd">quicktime:  <%= @photographer["quicktime"] %></label>
        <%= link_to("remove", {:action => "remove_quicktime", :id => @photographer.id}, {:confirm => "Are your sure?"}) %>
      </p>
    <% else %>
      <p class="current">
        <label for="dd"></label>
        No quicktime uploaded
        <br />
      </p>
    <% end %>
  <% end %>


  <%= f.button :submit, :value => 'Create movie' %>
<% end %>

My update controller:

def save            
  @photographer = Photographer.find(params[:id])            
  @photographer.update_attributes(params[:photographer])    

  if !@photographer.save                                
    flash[:notice] = "&nbsp;"
    render_action 'edit'            
  else
    flash[:notice] = "update ok"
    redirect_to :action => 'edit', :id => @photographer.id          
  end       
end 

My routes:

namespace :admin do
  resources :photographers do
    collection do
      post :save
    end
  end
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:22:19+00:00Added an answer on May 25, 2026 at 8:22 pm

    What you’re doing is basically an update action. The update route is automatically created when you do resources :photographers, you can verify this by typing rake routes in the terminal.

    You should rename your controller action from save to update and remove the custom route:

    namespace :admin do
      resources :photographers
    end
    

    Then use the update route in your form:

    :url => admin_photographer_path(@photographer)
    

    You should also change your html method, the update action uses PUT:

    :method => :put
    

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I trying to update a model on a callback but the validation is causing
Im trying to update a simple model in MVC,but its not working,it throws an
Im trying to update some nested params from a form. I can see that
I'm trying to update a model with nested properties after an edit. The update
I'm trying to update my database table with PDO, but to avoid security leaks,
Trying to update a table on a linked server (SQL 2000/2005) but my server
I am trying to update my DataGrid but unfortunately not able to! My application
Trying to update a database records when a user hits a submit button with
Im trying to update details of a single customer and I'm having problems updating
Trying to update a table view using: CREATE OR REPLACE VIEW [vtable] AS SELECT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.