ruby on rails - wrong number of arguments (4 for 1..3) -
i'm struggling understand why happen destroy method since on controller , routes ok!
if passed through way please give me hint?
routes
resources :users, :as => "" resources :sections, :only => [:new, :create, :destroy, :index] end
controller
def destroy @section = section.find(params[:id]) @section.destroy redirect_to sections_url flash[:notice] = "section deleted" end
view
<%= render :partial => "section", :collection => @sections %>
partial
<%= link_to section.name, section_path(current_user, section) %> <%= button_to 'remove', current_user, section, :data => { :confirm => 'confirm?' }, :class=> "buttom", method: :delete %>
that error means function takes 1 3 arguments, gave 4 arguments.
please see row number in error , function, open documentation , how use function. functions works differently instance methods , class methods.
Comments
Post a Comment