You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
Hi all
Models (Rails 3 application):
class NetworkService < ActiveRecord::Base
has_many :network_classes, :foreign_key => "network_id", :order => :position
end
class NetworkClass < ActiveRecord::Base
belongs_to :class_definition, :foreign_key => "class_id"
belongs_to :network_service, :foreign_key => "network_id"
acts_as_list :scope => :network_id
validates_presence_of :class_id, :network_id
attr_accessible :class_id, :network_id
end
Case:
when I create an element in NetworkClass, no problem it goes straight at the end of the current list.
when I update the "network_id" attribute which holds the "scope", the record is saved with a "position" set to 1, no matter if there are already records with the same "network_id". I would expect that the "position" of the updated record is set to the (last position + 1) of the list corresponding to the new "network_id" value. You then end up with multiple records with the same position in the list.
note: the NetworkClass "belongs to" another "class_definition" table, but not concerned with the list (I guess)
Many thanks for the gem anyway
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi all
Models (Rails 3 application):
class NetworkService < ActiveRecord::Base
has_many :network_classes, :foreign_key => "network_id", :order => :position
end
class NetworkClass < ActiveRecord::Base
belongs_to :class_definition, :foreign_key => "class_id"
belongs_to :network_service, :foreign_key => "network_id"
acts_as_list :scope => :network_id
validates_presence_of :class_id, :network_id
attr_accessible :class_id, :network_id
end
Case:
Many thanks for the gem anyway
The text was updated successfully, but these errors were encountered: