if @friend
if request.post?
if @user.is_friends_with?(@friend)
- Friend.delete_all "user_id = #{@user.id} AND friend_user_id = #{@friend.id}"
+ Friend.where(:user_id => @user.id, :friend_user_id => @friend.id).delete_all
flash[:notice] = t "user.remove_friend.success", :name => @friend.display_name
else
flash[:error] = t "user.remove_friend.not_a_friend", :name => @friend.display_name
end
def revoke
- UserRole.delete_all(:user_id => @this_user.id, :role => @role)
+ UserRole.where(:user_id => @this_user.id, :role => @role).delete_all
redirect_to :controller => "user", :action => "view", :display_name => @this_user.display_name
end
save!
tags = self.tags
- ChangesetTag.delete_all(:changeset_id => id)
+ ChangesetTag.where(:changeset_id => id).delete_all
tags.each do |k, v|
tag = ChangesetTag.new
# Create a NodeTag
tags = self.tags
- NodeTag.delete_all(:node_id => id)
+ NodeTag.where(:node_id => id).delete_all
tags.each do |k, v|
tag = NodeTag.new
tag.node_id = id
# if there are left-over tags then they are new and will have to
# be added.
tags_changed |= !tags.empty?
- RelationTag.delete_all(:relation_id => id)
+ RelationTag.where(:relation_id => id).delete_all
self.tags.each do |k, v|
tag = RelationTag.new
tag.relation_id = id
# members may be in a different order and i don't feel like implementing
# a longest common subsequence algorithm to optimise this.
members = self.members
- RelationMember.delete_all(:relation_id => id)
+ RelationMember.where(:relation_id => id).delete_all
members.each_with_index do |m, i|
mem = RelationMember.new
mem.relation_id = id
first = true
# If there are any existing points for this trace then delete them
- Tracepoint.delete_all(:gpx_id => id)
+ Tracepoint.where(:gpx_id => id).delete_all
gpx.points do |point|
if first
clone.save!
tags = self.tags
- WayTag.delete_all(:way_id => id)
+ WayTag.where(:way_id => id).delete_all
tags.each do |k, v|
tag = WayTag.new
tag.way_id = id
end
nds = self.nds
- WayNode.delete_all(:way_id => id)
+ WayNode.where(:way_id => id).delete_all
sequence = 1
nds.each do |n|
nd = WayNode.new