Rails query with more than two join -
i need join , results 3 table in json format
@employee = employee.joins(:salary,:personal_info).select("salary.*,personal_info.*) --> works fine @employee = employee.joins(:salary,:personal_info,:loan).select("salary.*,personal_info.*,loan.*) --> salary , personal_info coming format.json { render json: @employee, serializer: employeeserializer, :root => 'employee'}
try providing raw sql,
@employee = employee.joins('inner join salary on salary.employee_id = employee.id inner join personal_info on personal_info.employee_id = employee.id inner join loan on loan.employee_id = employee.id')
Comments
Post a Comment