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
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:
Have a great week-end, K.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.