what is the Best approach - Single Table Inheritance or Multiple class table inheritance in Rails [closed] - ruby-on-rails

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
what is the Best approach between Single Table Inheritance and Multiple class table inheritance in Rails?
When to use them and what are the consequence of using each?

Use MTI when :
Your models physically follow inheritance (you should NOT use it
otherwise)
Your models have plenty common attributes but at the same time plenty
uncommon. If it is not the case, you should probably have them in
the same table (use STI)

Related

Model student, subject, marks. Application logic [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have Student that has_many Subjects thas has_one Mark. Where should I write logic to sum all student marks from one subject ? Im beginner so any links to documentation or somewhere else are appreciated.
Almost any time I need to interact with multiple models, I use a plain old Ruby object (aka, a "PORO"). I personally call these 'managers', but I believe it's more common to call them 'service' objects (or some variation). Google 'Rails service objects' and that ought to get you started.

What Sort of Things Would a Programmer Put in the ActiveRecord::Base class? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
So I am new to rails and just started learning it today. I was wondering what sort of code a programmer would put in the ActiveRecord::Base class. I have a general idea about MVC so I want to know specifically about the Base class not about what I would generally find in the Model.
Thanks. :)
The programmers who create Rails put this into ActiveRecord::Base.
An average programmer who uses Rails (i.e. develops a Rails application) would typically not touch it.

How do i look at the relationships being created at Rails boot up? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I would like to see the wiring that is going on behind the scenes and double-check that i have defined my relationships correctly.
It's not really clear what you're looking to do with the relationships, but every ActiveRecord subclass defines a method called "reflections" which you could use to inspect all of these relationships. Each reflection tells you what kind of relationship it is, what options there are, and tons of other info.
MyClass.reflections

Is there much overhead in having many MVC routes? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have an application that now has three Areas and each have around eight different route definitions. In the future I may need to add more.
From a performance point of view is there much overhead to having this number of definitions?
Is there any performance benefit to be gained by having the most common route show up first?
It is normal to have more routes, but you need to know that regexp constraint is working very slow.
You cannot place most common route first because then all other routes will never work.

conventions for rails app documentation? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I known that it's more a state of art than a technical question, but I'm looking for some good templates to document model relation, validations, method for the models and controllers of my rails app.
Are there any conventions/best practice/examples to do that ?
Thanks all for your help
You can use RDoc to self-document your code. It'll take your code comments and make documentation for your project.
http://rdoc.rubyforge.org/
http://en.wikibooks.org/wiki/Ruby_Programming/RubyDoc
It's pretty neat.
I'm not sure there's much use in documenting validations and relations... Your Ruby source code is already incredibly readable in that regard.

Resources