I am new to Ruby on Rails. I am trying to develop a website which has the structure as explained below. I have 2 tables (say A and B).A has many B.I have models and controllers for these tables(say A_m,A_c and B_m,B_c). My aim is to have different contorllers and views, for users and administrators. So I have another controller (say X_c).
Will I be able to fetch data into X_C and its associated views from the 2 tables( 2 models)? Or is this structure completely wrong? What materials can I refer to, to be able to acheive this?
You can fetch data from A_m or B_m in the X_C controller. Here is an example:
class XController < ApplicationController
users = AModel.all
other_table_data = BModel.where("field = 'value'")
end
All the models can accessed from any controller.