Hi , i have a class "members" it has memberid,firstname,lastname and email and there is another class "risks" in tht memberid is referenced and storing the database table,now i want to show in risks report member name based on the memberid, I am new to Jruby, please help on this. Regards Veerendra Patil
on 2013-07-18 13:03
on 2013-07-19 15:00
Hi Veerendra, do it the same way as in Ruby :) If you're new do that one as well you need to choose an ORM ... assuming you use Rails/ActiveRecord you do something like : class Member < ActiveRecord::Base has_one :risk end class Risk < ActiveRecord::Base belongs_to :member end id = params[:memberid] member = Member.find(id) puts( member.firsname << ' ' << member.lastname << ' ' << member.risk.name ) Next time - maybe with a few details (the more details the better answer) ask this on he Rails user mailing list or start somewhere here: http://guides.rubyonrails.org/association_basics.html Have a great week-end, K.