I have a Model and a position field with index, I want to sort this list. It worked great on my local machine but it didn't work on heroku until I tried several times and restarted app, it suddenly worked. Should I not have index on position(integer) field?
$redis = if ENV['REDISCLOUD_URL']
Redis.new(url: ENV['REDISCLOUD_URL'])
else
Redis.new(url: ENV['REDIS_URL'])
end
resque.rb
Resque.redis = $redis
Resque.before_fork do
defined?(ActiveRecord::Base) &&
ActiveRecord::Base.connection.disconnect!
end
Resque.after_fork do
defined?(ActiveRecord::Base) &&
ActiveRecord::Base.establish_connection
end
puma.rb
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['MAX_THREADS'] || 5)
threads threads_count, threads_count
preload_app!
rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'
on_worker_boot do
# Worker specific setup for Rails 4.1+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
ActiveRecord::Base.establish_connection
if ENV["REDISCLOUD_URL"]
Redis.current = Redis.new(url: ENV['REDISCLOUD_URL'])
$redis = Redis.current
elsif ENV['REDIS_URL']
Redis.current = Redis.new(url: ENV['REDIS_URL'])
$redis = Redis.current
else
Redis.current.quit
end
if defined?(Resque)
Resque.redis = $redis
end
end
And relevant portion of rails_admin.rb
config.actions do
# root actions
dashboard # mandatory
# collection actions
index # mandatory
new
export
bulk_delete
# member actions
toggle
show
edit
delete
show_in_app
nestable
end
config.model 'State' do
nestable_list true
list do
sort_by :position
field :position do
sortable true
end
field :name
field :state_type do
visible true
searchable false
end
end
end
I have a Model and a position field with index, I want to sort this list. It worked great on my local machine but it didn't work on heroku until I tried several times and restarted app, it suddenly worked. Should I not have index on position(integer) field?
There are lots of memory quota errors
Here are my config files redis.rb
resque.rb
puma.rb
And relevant portion of rails_admin.rb