After about two Ruby on Rails tutorials, you can finally create a page that you can post and browse based on it.

To create a web service in the future with Ruby on Rails, I want to create a web site with different functions in one site. (I want to pack in one heroku paid plan)

You can link to each website from the home screen and want to display the link to the same home screen at the top of every page. At first glance, it is a different web service, but overall, I'm going to make something that is in one domain.

It seems that various things such as controllers, models, style sheets, layouts files in views, etc. will be messed up, but those who have such experience, those who have been devised for proper use and naming etc. I would like to borrow wisdom.

Also, it would be helpful if you could tell me the advantages and disadvantages of incorporating functions into one application, alternative methods if the idea is wrong, what to study if you have the necessary knowledge, etc. . Thanks for your consideration.

  • Answer # 1

    No, if you just want to stuff into one paid heroku plan, you should n’t make it one site.
    If most of the models are shared, one site may be fine, but if you don't share basically, the prospects will only worsen if you combine them into one. Rather than that, I think that it is better to think about how to save money or something that can be operated with two paid plans.
    On the other hand, there are various ways to make multiple Rails apps look like one site, using reverse proxy. You can use the same domain, but you can also alias the top-level subdomain.

  • Answer # 2

    If there are many common parts, you can use Rails Engine

    However, it is an image that divides functions by one service rather than multiple services
    If there are few common parts, there will be little benefit for trouble, and if there is no common part, there is no meaning of living together

    As a precautionary point, as described in the reference article, it will deviate slightly from the rail, so it will be necessary to devise such as deployment and migrate
    Reference: Recommendation of de-microservices using Rails engine

    *) There are also concerns about what will happen to heroku deployment

  • Answer # 3

    Studying refactoring and object orientation

    Read both a book you can understand and a book that feels a little difficult

    Try writing some dirty code on purpose and refactor it

    Have a third party check the code and design

    Pair programming, code review, etc.

    If you don't have such an environment, do you need to work with your team members and increase the number of people ...

    Make a habit of thinking about cost effectiveness

    Labor costs and time required for function correction

    Profits gained by adding or modifying functions

    I wrote a lot, but there are things I haven't done ... (especially the last one)