cypriss / mutations

Compose your business logic into commands that sanitize and validate input.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rails Generators

Aboodchei opened this issue · comments

It would be nice if there were rails generators, that automatically generate mutations given inputs along with types, and whether they are optional/required.

I believe such a feature will make it easier to adapt to this gem and increase usability.

Can I start implementing such a feature ? I would like to contribute

I made one a few years ago that I've been using in a project that does exactly this. I just forked the repo and will make a PR for it this weekend.

This feature would be great. The way I interpret the suggestion in that in a scaffold controller the default instance.update etc. calls would be replaced by mutation.run calls, is that correct?

I wrote a separate gem mutations_generator and added a PR #152 here to update README. I'm not sure if putting direct Rails generator code into the mutations framework is the best idea. That would require to load entire Rails dep chain even if you just wanted to use the Command pattern in a Sinatra app. I think a separate gem is a better opp.