Hi everyone, I’m developing an application that involves 3 websites: one
for
the clients, one for other companies (kinda like other type of client),
and
one the admin.
I’d like to know how to get information from each an manipulate, for
example: I want to get the number of clicks on a link in the menu of the
clients website, and wanna display this information at the companies
website.
It depends on the architecture of your project. You could have one
database
for the clients app and one for the companies app, and in the companies
app
project you could connect to both databases(companies and clients) and
just
query the clients database for information. That’s one solution, as I
mentioned, It all depends on the architecture
What Sergio is trying to say here is something like this:
You can have 3 different Rails apps for this, with 3 different
databases.
And then for the admin app, you can connect to the client app and
company
app database and pull information from there. For this, you will have to
specify two other databases in your database.yml file, one with
connection
details of client app database and another with connection details for
company app database.
Then either you can direct do sql queries on those databases or define
corresponding models for the related tables in your admin app, and ask
them
to connect to right database. Using something like this in the model -
"establish_connection ‘company_database’ "
Have 3 different Rails apps but use the same database for all three.
Then
you directly have access to all the company and client data in your
admin
app as well.