title: Rails: form with :url specified can't be used as partial?
body: <p>Hi I'm trying to use a form as a partial for both the new/edit views of my <code>albums</code> controller/model. However, it's giving me the error when I try to edit the album:</p>
  
  <p><code>No route matches [PUT] "/users/22/albums"</code></p>
  
  <p>I think this might have to do with my form's <code>:url</code>. My form works fine when I submit it to create an album, but gets that error when I try to edit it.</p>
  
  <p>I tried taking out the <code>url: user_albums_path</code> in my form, but it would just give me an error when I try to create a new album.</p>
  
  <p><code>No route matches [POST] "/albums"</code></p>
  
  <p>Is there any way to make it so that the form works for both actions? I feel like the :url can't coexist properly in both actions.</p>
  
  <p>_form.html.erb</p>
  
  <pre><code>&lt;%= form_for (@album), url: user_albums_path, :html =&gt; { :id =&gt; "uploadform", :multipart =&gt; true } do |f| %&gt;
  &lt;div class="formholder"&gt;
      &lt;%= f.label :name %&gt;
      &lt;%= f.text_field :name %&gt;
  
  
      &lt;%= f.label :description %&gt;
      &lt;%= f.text_area :description %&gt;
  
      &lt;br&gt;
  
      &lt;%=f.submit %&gt;
  &lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>albums controller</p>
  
  <pre><code>class AlbumsController &lt; ApplicationController
  
  def index
    @user = User.find(params[:user_id])
    @albums = @user.albums.all
  
    respond_to do |format|
      format.html
      format.json { render json: @albums }
    end
  end
  
  def show
    @user = User.find(params[:user_id])
    @album = @user.albums.find(params[:id])
  end
  
  def update
    @user = User.find(params[:user_id])
    @album = @user.albums.find(params[:id])
    respond_to do |format|
      if @album.update_attributes(params[:album])
        format.html { redirect_to user_album_path(@user, @album), notice: 'Album successfully updated' }
      else
        format.html { render 'edit' }
      end
    end
  end
  
  def edit
    @user = User.find(params[:user_id])
    @album = @user.albums.find(params[:id])
  end
  
  def create
    @user = User.find(params[:user_id])
    @album = @user.albums.build(params[:album])
    respond_to do |format|
      if @user.save
        format.html { redirect_to user_album_path(@user, @album), notice: 'Album was successfully created.' }
        format.json { render json: @album, status: :created, location: @album}
      else
        format.html { render action: "new" }
        format.json { render json: @album.errors, status: :unprocessable_entity }
      end
    end 
  end
  
  def new
    @user = User.find(params[:user_id])
    @album = Album.new
  end
  
  def destroy
  end
  </code></pre>
  
  <p>end</p>
  
  <p>please help!</p>
  
  <p>update:</p>
  
  <p>FIXED IT! on my own! the form just needed to be <code>&lt;%= form_for([@user, @album])...</code></p>