Method: Customs::Statuses#unprocessable

Defined in:
lib/customs/statuses.rb

#unprocessable(*args) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/customs/statuses.rb', line 26

def unprocessable *args
  options = args.extract_options!

  respond_to do |format|
    format.any *navigational_formats do
      action = options.delete(:action)
      action ||= case params[:action]
        when 'update' then 'edit'
        when 'create' then 'new'
        else raise "Unknown unprocessable action"
      end

      render :status => 422, :action => action
    end

    format.all { render :status => 422 }
  end
end