Beware if you use has_many relationships, JP response will not work.
Extension example:
class City < ActiveRecord::Base
has_many :shops
end
city = City.find(:name => "Portland")
then
city.shops.delete(city.shops[0])
Remove from the database!
Besides
theshops = city.shops
theshops.delete(ss[0])
Will remove from the database
One way to disconnect from the database is to use a compact or other array function, for example:
theshops = city.shops.compact
theshops.delete(ss[0])
, delete_if db:
city.shops.delete_if {|s| s.id == city.shops[0]}
!
: script/console - !