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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -