profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/kh0m/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Ken Hom kh0m https://kenhom.medium.com/ passionate software developer who loves working with iOS and rails

kh0m/2048 0

A small clone of 1024 (https://play.google.com/store/apps/details?id=com.veewo.a1024)

kh0m/amethyst-app 0

Practice with Core Data and TableViews

kh0m/amethyst-site 0

practice postgresql with rails app

kh0m/AudioKitSynthOne 0

AudioKit Synth One: Open-Source iOS Synthesizer App

kh0m/Calculator 0

Based on Stanford's cs193p Spring 2016 Course: Developing iOS 9 Apps with Swift

kh0m/campfire 0

Intro to ActionCable from DHH's blog post https://medium.com/@dhh/rails-5-action-cable-demo-8bba4ccfc55e#.cxjxr8vtr

kh0m/ColorMaker 0

color maker app from Udacity's iOS Developer Nanodegree

kh0m/docs 0

Auth0 documentation

kh0m/Exercism-iOS 0

iOS app with GitHub authentication

startedHospitalRun/hospitalrun-frontend

started time in 22 days

issue closedactiveadmin/activeadmin

Associated Sort Not Working

Expected behavior

While clicking the column header to perform an associated sort using the documented syntax, the index table should sort on a column that is not on the resource model but on a model related to it via belongs_to

Actual behavior

The generated sql query looks for the column passed to the sortable: option on the resource model, not the related model.

How to reproduce

Given two models related by belongs_to

class MyModel < ApplicationRecord
end
class MyRelatedModel < ApplicationRecord
  belongs_to :my_model
end

ActiveAdmin.register MyRelatedModel do
  index do
    column :my_model, sortable: :my_model_name
  end
end

Try to click on the my_model_name column header to sort by my_model_name on the my_related_models page

For me this results in ActiveRecord::StatementInvalid and

Java::JavaSql::SQLSyntaxErrorException: ORA-00904: "MY_MODEL_NAME": invalid identifier
: SELECT  "MY_RELATED_MODEL".* FROM "MY_RELATED_MODEL" ORDER BY "MY_MODEL_NAME" desc OFFSET :a1 ROWS FETCH FIRST :a2 ROWS ONLY

The problem is MY_MODEL_NAME is not a column on MY_RELATED_MODEL, it's on MY_MODEL

Here are my relevant Gemfile.lock values, and perhaps this issue is caused by some compatibility mismatch between jruby 9.2.6.0, rails 5.1.7 an activeadmin 1.4.3. Please feel free to reach out if more information is needed for this issue.

GEM
  remote: https://rubygems.org/
  specs:
…
    activeadmin (1.4.3)
      arbre (>= 1.1.1)
      coffee-rails
      formtastic (~> 3.1)
      formtastic_i18n
      inherited_resources (>= 1.9.0)
      jquery-rails (>= 4.2.0)
      kaminari (>= 0.15)
      railties (>= 4.2, < 5.3)
      ransack (>= 1.8.7)
      sass (~> 3.1)
      sprockets (< 4.1)
…
    activerecord-oracle_enhanced-adapter (1.8.2)
      activerecord (~> 5.1.0)
      arel (~> 8.0)
      ruby-plsql (>= 0.6.0)
…
    arbre (1.2.1)
      activesupport (>= 3.0.0)
    arel (8.0.0)
…
    execjs (2.7.0)
…
    formtastic (3.1.5)
      actionpack (>= 3.2.13)
    formtastic_i18n (0.6.0)
…
    inherited_resources (1.11.0)
      actionpack (>= 5.0, < 6.1)
      has_scope (~> 0.6)
      railties (>= 5.0, < 6.1)
      responders (>= 2, < 4)
…
    kaminari (1.1.1)
      activesupport (>= 4.1.0)
      kaminari-actionview (= 1.1.1)
      kaminari-activerecord (= 1.1.1)
      kaminari-core (= 1.1.1)
    kaminari-actionview (1.1.1)
      actionview
      kaminari-core (= 1.1.1)
    kaminari-activerecord (1.1.1)
      activerecord
      kaminari-core (= 1.1.1)
    kaminari-core (1.1.1)
…
    nokogiri (1.10.4-java)
    non-stupid-digest-assets (1.0.9)
      sprockets (>= 2.0)
    parallel (1.17.0)
    parser (2.6.3.0)
      ast (~> 2.4.0)
    pluginator (1.5.0)
    pre-commit (0.39.0)
      pluginator (~> 1.5)
…
    rails (5.1.7)
      actioncable (= 5.1.7)
      actionmailer (= 5.1.7)
      actionpack (= 5.1.7)
      actionview (= 5.1.7)
      activejob (= 5.1.7)
      activemodel (= 5.1.7)
      activerecord (= 5.1.7)
      activesupport (= 5.1.7)
      bundler (>= 1.3.0)
      railties (= 5.1.7)
      sprockets-rails (>= 2.0.0)
…
    railties (5.1.7)
      actionpack (= 5.1.7)
      activesupport (= 5.1.7)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
…
    ransack (2.1.1)
      actionpack (>= 5.0)
      activerecord (>= 5.0)
      activesupport (>= 5.0)
      i18n
…
    therubyrhino (2.1.2)
      therubyrhino_jar (>= 1.7.4, < 1.7.9)
    therubyrhino_jar (1.7.8)
    thor (0.20.3)
    thread_safe (0.3.6-java)
    tilt (2.0.9)
…

PLATFORMS
  java

RUBY VERSION
   ruby 2.5.3p0 (jruby 9.2.6.0)

BUNDLED WITH
   2.0.2

closed time in 22 days

kh0m
PublicEvent

starteddry-rb/dry-struct

started time in 2 months

startedtxus/kleisli

started time in 2 months

startedsameersyd/Wiggles-iOS

started time in 3 months