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

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
ActiveAdmin lable name cant be singular
ActiveAdmin not decorating show view

Categories

HOME
php
opengl
mpdf
verification
freeradius
facebook-messenger
yahoo-weather-api
redmine
enums
key
message-queue
stacktrace.js
adobe
mongoid
mathematical-optimization
liferay-7
google-sheets-query
navigation
drag-and-drop
azure-mobile-services
specifications
driver
xamarin-zebble
buffer
sql-injection
async-await
pygobject
robolectric
pickle
varnish-vcl
data-type-conversion
kaggle
multi-upload
cell
mod-wsgi
web-push
data-collection
morris.js
tf-idf
amazon-iam
seafile-server
cucumber-junit
listjs
markov-chains
cmis
restful-architecture
landscape
installanywhere
unification
opal-framework
pyttsx
httphandler
web-inspector
type-inference
zend-form
code-push
docker-ucp
flume-twitter
intellij-lombok-plugin
directwrite
cloudwatch
sony-future-lab-n
ilrepack
phppgadmin
comm
node-apn
extjs4.1
deedle
instafeedjs
finder
oracle-fusion-apps
researchkit
p6spy
nsdata
android-sdcard
maximize
fdt
openmrs
onepage-checkout
cryptojs
android-mapview
http.client
calcite
blank-line
gitlab-omnibus
enaml
sequence-sql
angular-amd
alwayson
relational-model
kefir.js
mathematical-expressions
android-audiomanager
python-c-extension
sql-processor
ecos
hyperloglog
rails-api
thruway
django-sites
assetic
vlab
infinite
boinc
quickgraph
web-frameworks
android-authenticator
significant-digits
handshake
image-formats
monocross
yuidoc
gwt-celltable
sigar
background-repeat
resharper-5.0
getimagesize
spring-modules
twitter-feed
code-camp
rendering-engine
rootkit

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App