Project

General

Profile

Actions

action #2496

closed

Rename the current models and roles to fit with the newly introduced ones

Added by ancorgs about 10 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
2014-05-14
Due date:
% Done:

100%

Estimated time:
10.00 h

Description

Request and Reimbursement are not enough anymore, since the plan is to support different kind of requests, reimbursements and similar processes. Request should become TravelRequest, and so on.

Same apply to roles, with more players coming into play.

Actions #1

Updated by ancorgs about 10 years ago

  • Status changed from New to In Progress

Renaming Request to TravelRequest. Still a WIP (some pending issues with inherited resources and CanCanCan).

Actions #2

Updated by ancorgs about 10 years ago

Further analysis of the upcoming needs. Designing a slightly different approach that will allow to introduce the changes WE (in the team) need without such a big refactoring.

Actions #3

Updated by ancorgs almost 10 years ago

The current approach uses names for the models that suck but that have allowed us to move forward without needing too much refactoring:

  • Request: Any request that needs a reimbursement (currently travel support, shortly also local reimbursement of merchandising).
  • Reimbursement: Associated to a request of any type.
  • Shipment: For the booth boxes, that doesn't need reimbursement.

But those convenient but counter-intuituve names should not be exposed in the interface. I18n files should be updated with proper names.

Actions #4

Updated by ancorgs almost 10 years ago

Changed the i18n to make the texts displayed to the user a little bit more intuitive. Quite some time adapting the tests.

Actions #5

Updated by ancorgs almost 10 years ago

Request will be renamed to TravelRequest. Shipment should probably be renamed to ShipmentRequest.

There will be no Request base class. The behaviour will be implemented including two concerns: HasStates and HasComments.

RequestExpense will be renamed to Expense and Reimbursement will remain as it is. Both will be reused for any kind of request that needs to go through a reimbursement process (not only TravelRequest). For sharing the Reimbursement and Expense associations there are two options:

  1. Implementing a Reimbursable concern and making the associations in Expense and Reimbursement polymorphic.
  2. Implementing a ReimbursableRequest base class with the associations, instead of a concern.
Actions #6

Updated by ancorgs almost 10 years ago

RequestExpense renamed to Expense and first steps implementing the first alternative described in the previous comment (using concerns and polymorphic associations).

Actions #7

Updated by ancorgs almost 10 years ago

Discarding the work done before (lesson learned: don't forget to use branches) and implementing the second alternative (with a Request base class for everything since it sounds more coherent).

Actions #8

Updated by ancorgs almost 10 years ago

  • % Done changed from 0 to 20

Working on it. Renaming and reorganizing models in Rails is always a lot of work (specially with STI involved).

Actions #9

Updated by ancorgs almost 10 years ago

rake spec:models already working after the whole refactoring/renaming (and that's 623 checks).

Actions #10

Updated by ancorgs almost 10 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 20 to 100

Now we have two abstract classes: Request and ReimbursableRequest.
Request becomes TravelSponsorship < ReimbursableRequest
Shipment becomes Shipment < Request
RequestExpense and Reimbursement are now attached to ReimbursableRequest instead of Request.

Actions #11

Updated by ancorgs almost 10 years ago

Some routes introduced for backwards compatibility. /requests and /requests/XX

Actions

Also available in: Atom PDF