Is there a way change the dataset module as you are joining multiple 
associations and tables?

For example:

class User < Sequel::Model

dataset_module do 
    def with_min_age(min_age, u = Sequel[model.table_name])
      condition = Sequel.lit("? <= current_date - (? || ' 
years')::interval", u[:birth_date], min_age)
      condition = Sequel.|({min_age => nil}, condition) if 
min_age.is_a?(Sequel::SQL::Expression)
      where(condition)
    end
end
end


So I can use this as users_dataset.with_min_age(4).

But I'd like to be able to also do:

books_dataset.association_join(:user).with_min_age(Sequel[:books][:min_age_required],
 
Sequel[:user])

To be able to reuse the methods.

Is something like this possible?

Aryk

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/3e1f1bc7-0e10-4c79-a1ce-7a9a2d719b73%40googlegroups.com.

Reply via email to