Permalink
Browse files

Reverted DataMapper's explicit String to Integer castings. Fixes #1186.

  • Loading branch information...
dariocravero committed Jul 2, 2013
1 parent 0c1317b commit d532d355be983a595359f146428e34cecf601118
@@ -100,8 +100,7 @@ def all
def find(params=nil)
case orm
when :activerecord, :minirecord, :mongomapper, :mongoid then "#{klass_name}.find(#{params})"
when :datamapper then "#{klass_name}.get(#{params}.to_i)"
when :couchrest then "#{klass_name}.get(#{params})"
when :datamapper, :couchrest then "#{klass_name}.get(#{params})"
when :sequel, :ohm then "#{klass_name}[#{params}]"
else raise OrmError, "Adapter #{orm} is not yet supported!"
end
@@ -149,14 +148,6 @@ def find_by_ids(params=nil)
end
end
def parse_many_ids_on_params
base = "params[:#{@name_singular}_ids].split(',').map(&:strip)"
case orm
when :activerecord, :minirecord, :datamapper, :sequel then "#{base}.map(&:to_i)"
else base
end
end
def multiple_destroy(params=nil)
case orm
when :ohm then "#{params}.each(&:delete)"
@@ -76,7 +76,7 @@
flash[:error] = pat(:destroy_many_error, :model => '<%= @orm.name_singular %>')
redirect(url(:<%= @orm.name_plural %>, :index))
end
ids = <%= @orm.parse_many_ids_on_params %>
ids = params[:<%= @orm.name_singular %>_ids].split(',').map(&:strip)
<%= @orm.name_plural %> = <%= @orm.find_by_ids("ids") %>
<% if @orm.name_singular == @admin_model %>
if <%= @orm.name_plural %>.include? current_account

0 comments on commit d532d35

Please sign in to comment.