How Rails component works with each other in background?

Hello All,

Please let me know how components works with each other in background?

For e.g How objects are called from controller to view ? what actions are performed in background?

Please help me.

Thanks in advance.

Regards,

Prasad

I suspect that a full answer to that question would necessitate the
writing of several books. I don't fully understand what's going on in
the background but I'll have a go at explaining my take on it.

The Ruby interpreter creates a "runtime environment" in which to hold
the objects.

Since Rails uses MVC architecture, your main components are:

The Model - Database link via ActiveRecord, and ancillaries.

The View - Collection of whatever pages and templates you're using,
requested when necessary by the controller, and associated JS & media).

The Controller - A series of methods interlinked by "routes" which ties
together the view and model and determines the progression of events.

I reserve the right to be wrong!

Prasad Gurjar wrote in post #1125841:

For e.g How objects are called from controller to view ? what actions
are performed in background?

The controller is given a template, either implicitly by the method name
or explicitly in the code.
The template may have multiple extensions, e.g. "template.html.erb".
These show the sequence in which the template is interpreted.

In the above example, the file is treated first as an eRuby file, and
interpreted - "rendered" - as such. Each line is interpreted in its
environment and any return values are left behind as HTML, forming the
document. This is where you'll normally have content from the model
appearing with objects provided by the controller or whatever constants
and variables are available.

The resulting HTML is sent to the client.