./lib/rack/scaffold/adapters/sequel.rb in rack-scaffold-0.0.3 vs ./lib/rack/scaffold/adapters/sequel.rb in rack-scaffold-0.1.0
- old
+ new
@@ -16,11 +16,10 @@
end
def resources(model, options = {})
model
end
-
end
def singular
@klass.name.demodulize.downcase
end
@@ -31,11 +30,14 @@
def paginate(limit, offset)
@klass.limit(limit, offset)
end
+ def one_to_many_associations
+ @klass.all_association_reflections.select{|association| association[:type] == :one_to_many}.collect{|association| association[:name]}
+ end
+
def timestamps?
defined?(::Sequel::Plugins::Timestamps) and @klass.plugins.include?(::Sequel::Plugins::Timestamps)
end
-
end
end