All Questions
Tagged with acts-as-list ruby
21
questions
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
...
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
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
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 ...
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 , ...
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
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(#&...
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
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 ...
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 ...
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
766
views
dependent destroy with acts_as_tree and acts_as_list
Currently I upgrade rails 2 application to rails 3.2.13 wich use acts_as_tree and acts_as_list. Before, the upgrade it works well. Since, I have a problem with acts_as_tree and acts_as_list with ...
0
votes
1
answer
511
views
Ordering a has_many list in view
I have a model called Person that the user selects five personality Traits for. However, the order they pick them for matters (they are choosing most descriptive to least descriptive).
I know how to ...