Note that there are some explanatory texts on larger screens.

plurals
  1. POform_for instance variable wrong number of arguments
    primarykey
    data
    text
    <p>My form_for is not passing as a form. I can usually troubleshoot through problems, but this one I cannot figure out why 2 arguments are being passed from <code>@image</code>. Here is my code</p> <p><strong>Error</strong></p> <pre><code>wrong number of arguments (2 for 1) </code></pre> <p><strong>View</strong></p> <pre><code>&lt;% form_for @image, :action =&gt; "edit" do |f| %&gt; &lt;%= f.text_field :title %&gt; &lt;%= f.submit "Update" %&gt; &lt;% end %&gt; </code></pre> <p><strong>Controller</strong></p> <pre><code>class Admin::ImagesController &lt; ApplicationController respond_to :html, :json def index @album = Album.find(params[:album_id]) @images = Image.all end def new @album = Album.find(params[:album_id]) @image = @album.images.new(params[:image_id]) end def create @album = Album.find(params[:album_id]) @image = @album.images.new(params[:image]) if @image.save flash[:notice] = "Successfully added image!" redirect_to [:admin, @album, :images] else render :action =&gt; 'new' end end def show @album = Album.find(params[:album_id]) @image = @album.images(params[:id]) end def edit @album = Album.find(params[:album_id]) @image = @album.images(params[:id]) end def update @album = Album.find(params[:album_id]) @image = @album.images(params[:id]) if @image.update_attributes(params[:image]) flash[:notice] = "Successfully updated Image" redirect_to @image else render :action =&gt; "edit" end end def destroy @album = Album.find(params[:album_id]) @image = Image.find(params[:id]) @image.destroy redirect_to admin_album_images_path(@album) end end </code></pre> <p><strong>Routes</strong></p> <pre><code>Admin::Application.routes.draw do get "albums/index" get "dashboard/index" namespace :admin do root :to =&gt; "dashboard#index" resources :dashboard resources :albums do resources :images end get "admin/album" end get "logout" =&gt; "sessions#destroy", :as =&gt; "logout" get "login" =&gt; "sessions#new", :as =&gt; "login" get "signup" =&gt; "users#new", :as =&gt; "signup" # resources :users resources :basic root :to =&gt; "basic#index" </code></pre> <p><strong>Model</strong></p> <pre><code>class Image &lt; ActiveRecord::Base attr_accessible :title, :description, :image_name, :image_id, :album_id belongs_to :album accepts_nested_attributes_for :album end </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload