trailblazer / roar-rails

Use Roar's representers in Rails.
http://roar.apotomo.de
MIT License
235 stars 65 forks source link

generator to create representer with decorator pattern #84

Open amkirwan opened 9 years ago

amkirwan commented 9 years ago

Added an option to the generator to create representers using the decorator pattern

bin/rails g representer -d Singer or bin/rails g representer --decorator Singer generates:

class Singer < Roar::Decorator
end
ianks commented 9 years ago

cool stuff! Unfortunately this will have some serious merge conflicts with the scaffold_controller feature I am pull requesting (https://github.com/apotonick/roar-rails/pull/83).

If @apotonick approves of this, we could implement this feature branch I am working on. That would save some headaches and get this feature in quicker IMO!

apotonick commented 9 years ago

Cool idea, @amkirwan. Also, what if we make Decorator default?

@ianks I'll check out the scaffold PR, then we can coordinate integrating @amkirwan's work.

amkirwan commented 9 years ago

@apotonick I can make the Decorator the default if you think that makes the most sense going forward for the project.

apotonick commented 9 years ago

Well, what do you think? I just like decorator better, it's a tiny little bit faster and does not pollute the model. On the other hand, I guess most people use modules, so maybe keep it.

amkirwan commented 9 years ago

Personally I like the decorator a lot better for all the reasons that you mentioned. I'd say switch it to the default.

apotonick commented 9 years ago

Hmmm.... it's really up to us. Maybe you're right.

ianks commented 9 years ago

I prefer decorator as default as well.

summera commented 9 years ago

:+1: for decorator as default

apotonick commented 9 years ago

Think we got a winner. :wink: