nevermind this. i got the answer, i just made it in a query.. ehe
@remain_persona_types = PersonaType.find_by_sql [ "SELECT * FROM
persona_types WHERE id NOT IN(SELECT persona_type_id FROM personas
WHERE member_account_id = ?)", session[:loggedin_user_id] ]
thanks
--- In RubyOnRails@yahoogroups.com, "animerei_12" <animerei_12@...> wrote:
>
> 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 array of [1]..
>
> can someone help
>
> thanks thanks so much
>