activeadmin


Sortable for has_many does not sort properly


I have an association of experiences on resume, and create the fields like this:
models/resume.rb
has_many :experiences, -> { order(position: :asc) }
models/experience.rb
belongs_to :resume
acts_as_list scope: :resume
Admin page:
admin/user.rb
inputs "Experience" do
f.semantic_fields_for :resume do |r|
r.has_many :experiences, sortable: :position, allow_destroy: true do |a|
a.input :title
end
end
end
When i save the form, the records are not saved in the correct order, nor the reverse of the correct order. On each save, where there are 3 records in my test, the 1st record goes the the bottom, the middle record goes to the top and the last record goes to the middle.
acts_as_list is 1 based, activeadmin defaults to 0 based lists. adding sortable_start: 1 fixes the issue:
inputs "Experience" do
f.semantic_fields_for :resume do |r|
r.has_many :educations, sortable: :position, sortable_start: 1, allow_destroy: true do |a|
a.input :title
end
end
end

Related Links

rails concerns - superclass mismatch error with active_admin in gems list
How to filter by “is not” in active admin/ransack
Active Admin image upload with refile
AuthorizationAdapter in ActiveAdmin
ActiveAdmin and Rails Engine. How do you keep the path name the same?
Active admin defining scope for custom page
ActiveAdmin: Can I redirect the user to the index after they create/edit something?
Active admin and Pundit
Sortable for has_many does not sort properly
select2 remove tag_list item
Adding Numeric Range Filtering to ActiveAdmin
undefined method `destroy_user_session_path' for active admin with cancancan and sorcery
Active admin not working in production mode
ActiveAdmin cannot authorize in rails-api project
How can I create an ActiveAdmin filter that will show only objects without a value specified?
jQuery, activeadmin: custom filter with ransack. how to alter displayed text in search box

Categories

HOME
opengl
user-interface
knockout.js
libgdx
memory
macos-sierra
key
haproxy
nsview
hyperledger
turbojpeg
tup
getopenfilename
pm2
jquery-file-upload
webstore
mahout-recommender
maven-plugin
coroutine
bosun
hdmi
running-object-table
network-analysis
tortoisehg
ccavenue
audit
es6-modules
sca
microsoft-certifications
gnu-classpath
assertions
bluemixtools
runtimeexception
cordys-opentext
fastlane
sspi
jacoco-maven-plugin
plane
classnotfoundexception
vb.net-to-c#
icepdf
raytracing
robust
dagger
minikube
daz3d
absolute
autorelease
node-apn
word-2007
ptvs
word-2016
adobe-reader
researchkit
yui3
deviare
xcode6.4
openquery
webgrind
cortana
bayesglm
godeps
variable-length-array
whitespace-language
berkeley-db-xml
preorder
accountmanager
iosched
mft
xsd2code
rautomation
ax
statechart
jquery-lazyload
unicoins
rikulo
semicolon
reentrancy
office-app
ckeditor.net
simplecov
audiotoolbox
border-box
taskkill
fbml
delphi-prism
rtd
git-log
hungarian-notation
mygeneration
cleartype
rawcontacts
spring-modules
fxruby
data-retrieval
iphone-sdk-3.1.3

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App