eiji
March 20th, 2006, 10:53 AM
hi there,
question with selecting in ruby on rails..
how do i get the
select..from.. not in (select table)
this is what i got for now..
@exist_persona_types = Persona.find(:all,
:select => "persona_type_id", #is a foreign of PersonaType
:conditions => [ "member_account_id = ?", session[:loggedin_user_id] ]
)
@remain_persona_types = PersonaType.find(:all,
:conditions => [ "id NOT IN (?)", [1] ] #hard coded
)
@exist_persona_types would get all the persona_type_id that a current user already has then it should exclude it in the @remain_persona_types. the problem is i cant get the array of the @exist_persona_types.persona_type_id. so as of now, i just hard coded the [1].. :(
can someone help
thanks thanks so much
question with selecting in ruby on rails..
how do i get the
select..from.. not in (select table)
this is what i got for now..
@exist_persona_types = Persona.find(:all,
:select => "persona_type_id", #is a foreign of PersonaType
:conditions => [ "member_account_id = ?", session[:loggedin_user_id] ]
)
@remain_persona_types = PersonaType.find(:all,
:conditions => [ "id NOT IN (?)", [1] ] #hard coded
)
@exist_persona_types would get all the persona_type_id that a current user already has then it should exclude it in the @remain_persona_types. the problem is i cant get the array of the @exist_persona_types.persona_type_id. so as of now, i just hard coded the [1].. :(
can someone help
thanks thanks so much