ikuseiGmbH/smart-village-app-converter-xml2json

View on GitHub
app/controllers/resources_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
class ResourcesController < ApplicationController

  # GET /resources
  def index
    @resources = Resource.all.sort_by(&:title)
    @resources = @resources.sort_by(&:created_at).reverse if params[:sort_by] == 'created_at'
    @resources = @resources.sort_by(&:title) if params[:sort_by] == 'title' || params[:sort_by].blank?
  end

end