dear all, i have a Student
model that i've specified some name_scope
in it, e.g. from_program
, from_year
, from_school
, has_status
, from_course
, etc...
is there anyway that i can chain the different named_scope
together dynamically depending on certain criterias during runtime?
for example, if the user accessing the data is from Finance, i want to be able to chain from_school
and has_status
together only. if the user is the lecturer, i want to be able to chain from_course
, from_school
together, and so on...
should i use named_scope
? or should i just fall back to the good old way of specifying conditions?
thanks for your suggestions in advance! =) btw i'm using rails 2.3