0.0
No commit activity in last 3 years
No release in over 3 years
Rails engine for allowing approvable resource updates that support file uploads
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 4.0.0
>= 4.0.0
 Project Readme

UpdateRequest

Rails engine to provide approvable resource update requests

Installation

Add this line to your application's Gemfile:

gem 'update_request'

And then execute:

$ bundle

Or install it yourself as:

$ gem install update_request

Copy the migrations to your Rails application

rake update_request:install:migrations

Run the migrations

rake db:migrate

Usage

Creating an update request

# User authentication and authorization code

UserRequest::Request.new(
  requester: user,
  updateable: customer, 
  update_schema: { 
    id: 1, 
    name: "New name", 
    orders_attributes: [
      {
        id: 3,
        deliver_notes: "Revised deliver notes"
      }
    ]
  }
)

Applying an update

# Admin user authentication and authorization code

update_request.apply(admin_user)

Retrieve a resource's update requests

class Customer < ActiveRecord::Base
  has_many :update_requests, as: :updateable, class_name: 'UpdateRequest::Request'
end


customer.update_requests