What Sort of Things Would a Programmer Put in the ActiveRecord::Base class? [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 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.

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.

Node.js vs Ruby on Rails [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
Which one is more futureproof at this point?
Which one is better for creating simple web apps in smallest time?
This also might be a question of JS vs Ruby, what do you think of this?
What are the pros and cons of each?
I suggest you do more google on this topic because it is a very general topic. However these articles offer some comprehensive comparisons:
http://ilikekillnerds.com/2014/07/should-i-use-ruby-on-rails-or-node-js-for-my-next-projectstartup/
http://fabianosoriani.wordpress.com/2011/09/11/when-to-ruby-on-rails-when-to-node-js/

what is the Best approach - Single Table Inheritance or Multiple class table inheritance in Rails [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 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)

Safe plugin API for ruby application? [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 4 years ago.
Improve this question
What is the recommended approach building a plugin API for a ruby (rails) application?
How can i prevent developers monkey patching over core types?
You can't prevent developers from monkey-patching your code (or any code, for that matter). This is Ruby!
Why would you want to do that anyway?

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