Questions tagged [acts-as-list]
ActsAsList is a Rails plugin that provides list abilities to an ActiveRecord model
acts-as-list
74
questions
0
votes
2
answers
102
views
Is there a way to use acts_as_list with a single parent but many different children?
I've stumbled upon this Rails - acts_as_list with multiple Models. I'm having a hard time understanding how to fit the solution into my current use case.
In my app, I have a section. The section can ...
1
vote
1
answer
174
views
Is there a way to scope acts_as_list based on column in another table?
TLDR: Is there a way to scope acts_as_list into another table as such
class SprintTodo < ApplicationRecord
belongs_to :sprint
belongs_to :todo
acts_as_list scope: [:sprint, :todo.status]
end
...
0
votes
1
answer
580
views
Error with Rails Sortable - Cannot read properties of undefined (reading 'dataset')
I followed this tutorial to implement drag and drop. https://www.driftingruby.com/episodes/drag-and-drop-with-hotwire
I am getting an error on drop that says Uncaught (in promise) TypeError: Cannot ...
0
votes
1
answer
511
views
Uncaught TypeError: $(...).sortable is not a function in Rails 6
Strugle alot but couldn't solve this problem. It been nightmare for me. I am using rails 6. and jquery ui "jquery-ui": "^1.13.0". I have added gem gem 'acts_as_list' and added ...
1
vote
2
answers
406
views
How to add position column to acts_as_list on existing database records in Rails migration?
I have seen How to change a nullable column to not nullable in a Rails migration? for the problem of adding a non-nullable column to an existing database table with existing records. As such, I am ...
1
vote
1
answer
194
views
Having trouble extending ActiveStorage::Attachment with acts_as_list
Can someone offer best practices for adding acts_as_list to active storage attachments? The gem requires "acts_as_list" added to the model in question. I am hesitant to edit the ...
1
vote
1
answer
246
views
Ruby on Rails - Does ActsAsList have known problem when working with nested_attributes?
I am having a problem when updating acts_as_list positions with nested_attributes, I have worked my way down and noticed the issue is still happening on the model level (as shown below).
The problem ...
0
votes
2
answers
1k
views
How to get the right position with Sortable.js, acts_as_list and Stimulus for nested_attributes
I'm trying to implement the "Drag and Drop Sortable Lists" (https://gorails.com/episodes/rails-drag-and-drop-sortable) with nested_attributes.
Unfortunately, I'm getting the wrong :position. ...
0
votes
1
answer
86
views
Rails Access Geocoder::Calculations
Hi All I have a little app that takes an address on the stop model and geo codes it via geocoder gem
class Stop < ApplicationRecord
belongs_to :trip
acts_as_list scope: :trip
after_validation ...
0
votes
2
answers
1k
views
How to handle drag and drop between multiple lists using SortablejS and acts_as_list gem?
I've been searching for a day and a half for a solution.
I've got several tables (Categories) that allow the user to drag and drop each row (Item) to reorder the position of each item on that table (...
1
vote
1
answer
336
views
acts_as_list on has_many :through and sortablejs
I have a fairly large question that I've been unable to resolve after a full day of reading articles, documentation and other Stack questions. At this point it's just messing with my mind!
I have an ...
0
votes
1
answer
827
views
acts_as_list puts record at wrong position with array scope
I have a model with following setup for acts_as_list gem:
acts_as_list scope: [parent_id: nil], add_new_at: :top, top_of_list: 0
I expect having next array of records:
[Record id: 1, parent_id: nil, ...
2
votes
1
answer
4k
views
Rails gem acts_as_list: How to handle reordering of list items when a list item is destroyed?
I'm using acts_as_list v0.9.17 this way:
class ListItem < ActiveRecord::Base
acts_as_list scope: [:column1_id, :column2_id], :add_new_at => :bottom
end
When a new (scoped) @list_item is ...
0
votes
1
answer
693
views
Rails gem acts_as_list, scoping the position to the user
I am using Rails 4 and the ActsAsList gem to give our Project model a position. Projects can be owned my one user, and collaborated on with many users. When a user re-orders their projects, it affects ...
0
votes
1
answer
238
views
ordering a many_to_many relationship in rails
I would like to implement a drag and drop of a list of items in a playlist. Playlist contents are of different activerecord types. I need to store the position and persist it in the database and ...
1
vote
1
answer
77
views
Stack level too deep when calling remove_from_list from acts_as_list gem
I'm running a test that did not fail before upgrading to rails 5.0, but now I am getting stack level too deep, the test is as follows:
describe "item hierarchy" do
before(:each) do
@...
0
votes
1
answer
453
views
Acts as paranoid gem interferes with acts as list
I use both acts_as_paranoid and acts_as_list for the same model, CheckIn. I have the gem setup as follows:
class CheckIn < ActiveRecord::Base
acts_as_paranoid
belongs_to :client
...
0
votes
1
answer
245
views
How to use remove_from_list method of ActiveRecord with scope as public in the model?
Lets say my model is C . Obj - @c
C has acts_as_list gem defined as
acts_as_list scope: '...'
and scope as :
scope :public -> {where (some_condition)}
When writing rspec for @c.remove_from_list , ...
0
votes
1
answer
135
views
Acts as list with a subgroup
I'm using the popular gem, acts_as_list and I am having issue with getting the scope to work. Basically there're three models, a group, a subgroup, and a thing. A group has many subgroups and a ...
1
vote
2
answers
265
views
acts_as_list upper_limit on position
I am using acts_as_list on my model.I have a position column on that model for which I don't wan't the model object to be saved to the database if the position is more than my upper-limit.(I tried ...
1
vote
1
answer
205
views
added `acts_as_list` to gemfile, rails gives error :`bundler: failed to load command: rails` when running rails s
I added the gem acts_as_listto my gemfile. Now when I run bundle exec rails s the server crashes and gives the error : bundler: failed to load command: rails (/Users/dadi/.rbenv/versions/2.3.1/bin/...
0
votes
1
answer
463
views
acts_as_list with paranoia gem
I have two models. The first ModelA is the parent of ModelB. ie ModelA has_many ModelB. [When modelA is destroyed, all its dependent ModelB's also gets destroyed due to dependent destroy
Now I have ...
0
votes
1
answer
881
views
Using acts_as_list, set scope to string column
Using acts_as_list, I'm trying to set the scope to the where column.
acts_as_list scope: :where
where is the name of a string column in the model.
But when I'm getting this error:
undefined ...
0
votes
1
answer
578
views
multi position column with acts_as_list
How to use multi position columns with acts_as_list gem ?
for sample :
rails g migration AddPositionToTodoList position:integer position2:integer position3:integer
controller:
todo_list = TodoList....
2
votes
0
answers
199
views
'last' method not returning last item in array in RSpec test - Rails4 Ruby 2.1.2
Was working on an RSpec test that copies @protocol to @dest and saw this:
[26] pry(#<RSpec::ExampleGroups::ProtocolsController::ProtocolCopy>)> @protocol.step_items.count
=> 3
[27] pry(#&...
1
vote
0
answers
153
views
Sort collection after associated resource's acts_as_tree/acts_as_list order
I have a SuccessCriterion model that implements both acts_as_tree and acts_as_list so it can be arranged as sorted tree hierarchy. Every success criterion can has many Boilerplate objects.
class ...
0
votes
1
answer
276
views
Ruby gem dependency loading
I'm putting some shared models for a rails app inside it's own gem. It's just models, so I'm not using an engine. Getting it set up seemed to work fine until I added the "acts_as_list" gem.
# gem - ...
0
votes
1
answer
61
views
Maintain order of saved attributes list for model
I have two models with a has_many to has_many relationship through a join table.
class Article < ActiveRecord::Base
has_many :authorings, -> { order(:position) }, :dependent => :destroy
...
2
votes
1
answer
890
views
Rails: How can I incrementally add items to a sorted list in one view
I am trying to create a set list app for musicians. Users can upload their repertoire of songs & pick songs from a list of those songs to populate a set list for a specific performance.
See ...
0
votes
1
answer
754
views
Rails: Ancestry + Acts_as_List Gems Not Working as Expected When Changing Parent Object
I have a Ruby on Rails 3 app which uses the ancestry gem to provide a hierarchical tree structure for a model in combination with the acts_as_list gem to provide explicit positioning within each level ...