Low commit activity in last 3 years
No release in over a year
Set of extensions to core rails libraries.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 6.0.0
>= 6.0.0
 Project Readme

Rails Core Extensions

Build Status Coverage Status Code Climate

DESCRIPTION

Extends the core rails classes with helpful functions

INSTALLATION

Add to your Gemfile: gem 'rails_core_extensions'

This gems contains many extensions including a sort extension:

Sortable

This allows you to sort an entire collection by setting the new position of an item and all other items will reorganise as needed.

app/controllers/types_controller.rb
class TypesController < ActionController::Base
  sortable
end

config/routes.rb

In Rails 6:
resources :types do
  collection
    post :sort
  end
end

You need to submit a collection of objects named the same as the controller.

e.g. for the above the params should be:

types_body[]=1
types_body[]=3

Where the value is the id, and the position of submission is the new order, e.g. In the above, the item of id 3 will be updated to position 2

If you have scoped sorts, e.g. sorts within categories you also need to pass in 2 params:

  • scope (e.g. category_id)
  • a variable by that name, e.g. category_id

So in the above if you want to upgrade category_id 6, you could submit scope=category_id&category_id=6

along with type_body[]=7.. for all the types in category 6

RELEASE

To publish a new version of this gem the following steps must be taken.

  • Update the version in the following files
      CHANGELOG.md
      lib/rails_core_extensions/version.rb
    
  • Create a tag using the format v0.1.0
  • Follow build progress in GitHub actions