lib/alchemy/resource.rb in alchemy_cms-3.1.0.beta3 vs lib/alchemy/resource.rb in alchemy_cms-3.1.0.beta4
- old
+ new
@@ -116,10 +116,19 @@
namespace_array = namespace_diff
namespace_array.delete(engine_name) if in_engine?
namespace_array
end
+ # Returns an array of underscored association names
+ #
+ def model_association_names
+ return unless model_associations
+ model_associations.map do |assoc|
+ assoc.name.to_sym
+ end
+ end
+
def attributes
@_attributes ||= self.model.columns.collect do |col|
unless self.skipped_attributes.include?(col.name)
{
name: col.name,
@@ -133,10 +142,10 @@
# Returns all columns that are searchable
#
# For now it only uses string type columns
#
def searchable_attributes
- self.attributes.select { |a| a[:type] == :string }
+ self.attributes.select { |a| a[:type].to_sym == :string }
end
def in_engine?
not self.engine_name.nil?
end