Questions tagged [acts-as-list]
ActsAsList is a Rails plugin that provides list abilities to an ActiveRecord model
acts-as-list
74
questions
1
vote
1
answer
1k
views
How to make acts_as_list make the added item have the top position?
I have a group of items which uses the acts_as_list gem. As of now, when a new item is added, acts_as_list will give the item the lowest position, making it show up as the last item on the list. Is ...
1
vote
4
answers
1k
views
Set Position Value from Index for nested model attributes
How can I set a position field in the attributes for a nested model so that my has_many relationship remembers it's sort order?
I want to set the position from the index so that it reflects the order ...
0
votes
1
answer
1k
views
Can I use Single Table Inheritance with has_many to get a collection of multiple types
I have a Citation class and I want each Citation to have many Resources. A resource can be a LocalFile, Link (and maybe something like a dropbox file). Resources will share most functionality and ...
1
vote
0
answers
104
views
rails acts_as_list specific to user and date
I'd like to use acts_as_list in my stock market application but the ordering position should be specific to the user, the ticker and date.
acts_as_list scope: [:user_id, :ticker, :market_date]
So, ...
2
votes
0
answers
257
views
How to update acts_as_list using multiple columns
I have a Rails 3.2 app that uses acts_as_list on two columns in the same model:
This is in the costproject model:
acts_as_list :column => :division_priority, :scope => :client
acts_as_list :...
1
vote
0
answers
55
views
acts_as_list how to add a second list based on related table column
In a Rails 3.2 app I'm trying to add an acts_as_list to the model costproject.
Client model:
belongs_to :department
Costproject model:
belongs_to :client
Both department_priority is in ...
1
vote
0
answers
73
views
acts_as_list wipes out parent model's virtual attribute when calling destroy on child model
I have a Parent model which has_many children and also a virtual attribute:
attr_accessor :new_assocation_model
has_many :children, -> { order("position ASC") }, autosave: true, inverse_of: :...
0
votes
1
answer
429
views
Can I use as act-as-list with a polymorphic association?
I am working on a liquid democracy app. My data model is:
Both Users and Organizations are Voters. A Voter has an ordered list of Delegations. A Delegation consists of a set of Tags and an ordered ...
0
votes
1
answer
145
views
Rails jQuery sortable unable to save
I'm trying to make my table sortable (drag and drop) using jQuery, the problem I'm having is saving the new sorted table and then publishing it to other users or when the browser is refreshed.
I'm ...
0
votes
1
answer
45
views
AR equivalent to these SQL statements or how otherwise to use them in Rails?
I wanted to use the gem acts_as_list to reorder lists.
But it doesn't seem to handle more restricted queries than association-based (I want to order lists based both on an association AND objects ...
1
vote
0
answers
188
views
Restrict scope in acts_as_list
class TodoList < ActiveRecord::Base
has_many :todo_items, -> { order("position ASC") }
end
class TodoItem < ActiveRecord::Base
belongs_to :todo_list
acts_as_list scope: :todo_list
end
...
0
votes
1
answer
234
views
Conditionally activate "acts_on_list" when field is defined
I have a model "entry" and I need it to act like a list when a playlist_id is specified, but if it's not, I need it to not act like a list. (acts_as_list is a gem I'm using)
In my model code I have:
...
0
votes
1
answer
2k
views
Rails 4: acts_as_list with complex scope
My model has a string field, bar, that is either a, b, or c. It uses has_ancestry and acts_as_list. I want the list to be scoped on (1) the ancestry, and (2) bar, but I want a and b to be in the same ...
0
votes
1
answer
2k
views
acts_as_list "NoMethodError (undefined method `position_was' for xxx)"
I'm trying to update the theme_name using Best In Place. At the moment however, it throws an error:
NoMethodError (undefined method `position_was' for #<Fruit:0x000000037e80a8>):
app/...
0
votes
1
answer
512
views
acts_as_list in multi-tenant application - how do I set the scope?
Question
I'm using acts_as_list in a multi-tenant app. I modeled the multi-tenancy using this Railscast: #388 Multitenancy with Scopes (subscription required).
I need to ensure my around_filter ...