I guess it will return all the objects whose parent_id is assigned. But
get only an object.
I have to do like these
@parent_id = params[:parent_id] if @parent_id.nil? conditions = ["parent_id is null"] else conditions = ["parent_id = ?", @parent_id] end @categories = Category.find(:all, :conditions => conditions)
But I expected that can be done like this
@categories = Category.find_by_parent_id(params[:parent_id]) #
Does anybody have good idea?