Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Review Requested] Add scaffold_controller generator #83

Closed
wants to merge 10 commits into from

Conversation

ianks
Copy link

@ianks ianks commented Sep 28, 2014

This is a PR request to integrate Roar with Rails' scaffold_controller functionality. This is a feature in both jbuilder and active_model_serializers that I liked, so I decided to do a Roar-inspired version of it.

When a user executes rails generate scaffold_controller Model, it will now build out the stubbing for Roar including controller methods and Representers.

I am asking for a some feedback on this because I do not know 100% if my default settings would be considered optimal, and I would love feedback to know what would be considered most 'sane' so users can get the best Roar-Rails experience with minimal effort. Please please please let me know if you think things can be done better and I will fix it! I have enjoyed this Gem greatly so glad I can help.

@apotonick
Copy link
Member

That is an awesome idea, @ianks ! ❤️

Should we only provide scaffold_controller, or also provide something like rails g representer?

I will try out your code and let you know, but I think it's a fantastic idea which will help lots of people to quickly get Roar running.

If you want to help on Trailblazer, I need a bunch of generators there as well hint....

@ianks
Copy link
Author

ianks commented Sep 29, 2014

I think there is already a rails g representer in there, but I also added rails g collection_representer.

I'm glad you dig it! I'm sure there is a bunch to be done as this is only the initial idea. 

Also, any idea about why it fails on Rails 3? Travis doesn't seem to like it!

On Sun, Sep 28, 2014 at 8:03 PM, Nick Sutterer [email protected]
wrote:

That is an awesome idea, @ianks ! ❤️
Should we only provide scaffold_controller, or also provide something like rails g representer?
I will try out your code and let you know, but I think it's a fantastic idea which will help lots of people to quickly get Roar running.

If you want to help on Trailblazer, I need a bunch of generators there as well hint....

Reply to this email directly or view it on GitHub:
#83 (comment)

@apotonick
Copy link
Member

You can run the rails 3 test with BUNDLE_GEMFILE=gemfiles/Gemfile.rails3.... bundle exec rake and find it out :)

@ianks
Copy link
Author

ianks commented Sep 29, 2014

@apotonick Fixed the tests.

There seems to be a dependency issue with Minitest and Test::Unit. This PR also fixes that.

Heads up, this generator only works for Rails 4++

@ianks
Copy link
Author

ianks commented Sep 30, 2014

@apotonick How would you feel about deprecating generator support for Rails < 3.0 ?

It is lacking a ton of features for generators (namely, module_namespacing) that is causing some headaches. The only solutions I can think of are a bit hacky, and I think that it might not be justified given that:

  1. It is a non-critical feature
  2. Only a small minority of the users use Rails 3.0

Thoughts?

@apotonick
Copy link
Member

Absolutely, I don't even know if roar-rails works with Rails < 3? I don't think so!

BTW, long-term we won't need roar-rails anymore as this is all way cleaner and simpler in Trailblazer. What I'm trying to say is, don't spend toooo much time on this, we're either moving away from Rails or Rails moves with us..... 😜

@ianks
Copy link
Author

ianks commented Sep 30, 2014

Sounds good man. I removed testing for Rails generatators for versions less than 3.2 😈

@ianks
Copy link
Author

ianks commented Oct 21, 2014

@apotonick Any word on this?

@apotonick
Copy link
Member

I'll try to merge it tomorrow, thanks again! 🍺

@ianks
Copy link
Author

ianks commented Nov 29, 2014

paging @apotonick

We should get this merged in. As a bonus, all tests will be fixed for incoming PRs 😉 🍻

def index
@<%= plural_table_name %> = <%= orm_class.all(class_name) %>

respond_with @<%= plural_table_name %>, :represent_with => <%= controller_class_name %>Representer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we go the Controller::represents way here and set this on the class level instead of using :represent_with in every action? This option was meant to be a work-around if you need to customise an edge case.

Do you use ::represents at all?

@ianks
Copy link
Author

ianks commented Nov 30, 2014

Ah, never even knew it existed :) I can change that up.

@apotonick
Copy link
Member

WHADAYAMEAN? It's the 2nd paragraph in the README: https://github.com/apotonick/roar-rails#represents-configuration!!!!! 😜

@ianks ianks closed this Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants