title: Why do i get a ActiveRecord::RecordNotFound error with my custom RESTful actions?
body: <p>I have a <em>RecordNotFound</em> error with my custom RESTful actions named <em>increase_order</em> and <em>decrease_order</em> in my <em>Admin::StylesController</em>, however the basic actions work well.  </p>
  
  <p>Ruby version :</p>
  
  <pre><code>ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
  </code></pre>
  
  <p>Rails version :</p>
  
  <pre><code>Rails 4.1.4
  </code></pre>
  
  <p>Here is my error :  </p>
  
  <pre><code>ActiveRecord::RecordNotFound (Couldn't find Style without an ID):
    app/controllers/admin/styles_controller.rb:50:in `set_style'
  </code></pre>
  
  <p>Here is my controller :</p>
  
  <pre><code>class Admin::StylesController &lt; Admin::ApplicationController
  
    before_action :set_style, only: [:show, :edit, :update, :destroy, :increase_order, :decrease_order]
  
    def index
      @styles = Style.all
    end
  
    def new
      @style = Style.new
    end
  
    def edit
    end
  
    def create
      @style = Style.new(style_params)
  
      if @style.save
        redirect_to admin_styles_url, notice: 'Style was successfully created.'
      else
        render action: 'new'
      end
    end
  
    def update
      if @style.update(style_params)
        redirect_to admin_styles_url, notice: 'Style was successfully updated.'
      else
        render action: 'edit'
      end
    end
  
    def destroy
      @style.destroy
      redirect_to admin_styles_url, notice: 'Style was successfully destroyed.'
    end
  
    def increase_order
      @style.update_attribute(:order, @style.order += 1)
      redirect_to admin_styles_url
    end
  
    def decrease_order
      @style.update_attribute(:order, @style.order -= 1)
      redirect_to admin_styles_url
    end
  
    private
      def set_style
        @style = Style.find(params[:id])
      end
  
      def style_params
        params.require(:style).permit(:name, :order, :cover)
      end
  end
  </code></pre>
  
  <p>Here is my view :</p>
  
  <pre><code>%h3 Liste des Styles
  
  %table.table.table-striped.table-condensed
    - @styles.each do |style|
      %tr
        %td= style.name
  
        %td= style.order
  
        %td.btn-group.btn-group-xs  # These two links work well.
          = link_to edit_admin_style_path(style), :class =&gt; 'btn btn-primary' do
            %span.glyphicon.glyphicon-pencil
          = link_to [:admin, style], :method =&gt; :delete, :data =&gt; { :confirm =&gt; 'Voulez-vous supprimer ce style ?' }, :class =&gt; 'btn btn-primary' do
            %span.glyphicon.glyphicon-remove
  
        %td.btn-group.btn-group-xs  # These two links return a RecordNotFound error.
          = link_to admin_style_increase_order_path(style), :class =&gt; 'btn btn-primary' do
            %span.glyphicon.glyphicon-arrow-up
          = link_to admin_style_decrease_order_path(style), :class =&gt; 'btn btn-primary' do
            %span.glyphicon.glyphicon-arrow-down
  
  = link_to new_admin_style_path, :class =&gt; 'btn btn-primary btn-sm' do
    %span.glyphicon.glyphicon-plus
    Nouveau style
  </code></pre>
  
  <p>Here is my routes.rb :</p>
  
  <pre><code>Rails.application.routes.draw do
  
    root 'welcome#index'
  
    namespace :admin do
      root 'dashboard#index'
      resources :styles do
        get 'increase_order'
        get 'decrease_order'
      end
    end
  
  end
  </code></pre>
  
  <p>Thank you in advance for your assistance.</p>