Maybe I'm just drowning in a glass of water...
I have two models.
class Queue
has_many :slots
endclass Slot
end
Execute this command in rails c
q = Queue.create
s1 = Slot.create
s2 = Slot.create
s3 = Slot.create
q.slots << [ s1, s2, s3, s2, s3 ]
Now I want to delete ONLY the second element from q.slots list, without deleting others s2 elements (as #delete do). Something like q.delete_at(1)
.
Any suggestions?
Thanks.
EDIT:
this is my schema.rb
create_table "steps", force: true do |t|
t.integer value
endcreate_table "queues", force: true do |t|
t.string name
endcreate_table "steps_queues", force: true do |t|
t.integer "step_id"
t.integer "queue_id"
endadd_index "steps_queues", ["step_id"], name: "index_steps_queues_on_step_id"
add_index "steps_queues", ["queue_id"], name: "index_steps_queues_on_queue_id"
EDIT II:
I resolved this problem adopting the has_many {:through}
association. Not very good idea adding an object model to achieve a non business logic purpose. But, hey, it'works.
rails console
session. But the problem still remains. – MinasMazar