RailsServices Gem Reaches 3.0.1

So this might be a bit of a late post LOL. Back in December 2021 (see? it’s cool … I’m less than a year off)



There are four primary changes in v3.0.0:

All services have include BaseService The call method is an instance method rather than a class method You may generate a Form model An updated command line interface (see below) Updated command line interface

Previous versions of the gem used plain old arguments to create or destroy the appropriate files. Over time, this became more unwieldy than imagined. From v3.0.0 forward, there are only two arguments: object_name and parent_name. Additionally, the previously available optional argument, instance, was removed (see REMOVALS section, below).

If you would like to add a sub-folder to the service or form, you can now provide the class_option for it: –sub_folder NAME_OF_FOLDER. Similarly, for the form generator, you can pass in an array of attr_accessors with the following: –accessors accessor_1_name accessor_2_name … (use regular strings as these will be ‘converted’ to symbols).


There was one significant removal from the gem:

No more instance argument in the command line interface (see below)

Instance argument dropped

An instance argument was added in v2.0.0 which allowed users to choose what style of service class to create. The gem defaulted to using this new style.

While the v2.x line continued to allow users a choice between the old and new^ styles, the v3.x line removes this choice. All services will be created with the now-not-so-new style. BE AWARE :)!

^The new style creates service classes inherited from a BaseService class; allows for optional instantiation of the service (Service.new(args*).call), and uses an instance method for call.