acts-as-list

acts_as_list with has_and_belongs_to_many relationship

时间秒杀一切 提交于 2019-12-21 03:56:20
问题 I've found an old plugin called acts_as_habtm_list - but it's for Rails 1.0.0. Is this functionality built in acts_as_list now? I can't seem to find any information on it. Basically, I have an artists_events table - no model. The relationship is handled through those two models specifying :has_and_belongs_to_many How can I specify order in this situation? 回答1: I'm assuming that you have two models - Artist and Event. You want to have an habtm relationship between them and you want to be able

Resetting position attribute when using acts_as_list gem? (Rails)

隐身守侯 提交于 2019-12-11 09:36:59
问题 I have a simple Rails 3 app where a Goal has many Objectives. In my views, I allow the user to-reorder the Objectives for any given Goal, and I am using the acts_as_list gem to achieve some of this functionality. Goal model: class Goal < ActiveRecord::Base attr_accessible :name, :description has_many :objectives, :order => :position, :dependent => :destroy end Objective model: class Objective < ActiveRecord::Base attr_accessible :name, :description, :position belongs_to :goal acts_as_list

acts_as_list with has_and_belongs_to_many relationship

喜你入骨 提交于 2019-12-03 12:08:36
I've found an old plugin called acts_as_habtm_list - but it's for Rails 1.0.0. Is this functionality built in acts_as_list now? I can't seem to find any information on it. Basically, I have an artists_events table - no model. The relationship is handled through those two models specifying :has_and_belongs_to_many How can I specify order in this situation? I'm assuming that you have two models - Artist and Event. You want to have an habtm relationship between them and you want to be able to define an order of events for each artist. Here's my solution. I'm writing this code from my head, but