Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

awesome_nested_set tries to access record with id=1 even when it doesn't exist. #334

Closed
shelvacu opened this issue Apr 7, 2016 · 4 comments
Labels

Comments

@shelvacu
Copy link

shelvacu commented Apr 7, 2016

When trying to use awesome_nested_set on an empty table, it tries to access the very first record and fails.

rails (4.2.6)
activerecord (4.2.6)
awesome_nested_set (3.0.3)

Code to reproduce:

require 'active_record'
require 'awesome_nested_set'
require 'sqlite3'

ActiveRecord::Base.establish_connection(
  adapter: 'sqlite3',
  database: 'testans.db'
)

ActiveRecord::Base.connection.execute("CREATE TABLE IF NOT EXISTS 'nodes' (
id PRIMARY KEY,
name, 
parent_id, 
lft, 
rgt, 
depth)")

class Node < ActiveRecord::Base
  acts_as_nested_set
end

Node.create
@leifcr
Copy link
Contributor

leifcr commented Mar 13, 2019

@shelvacu did you figure out this one? I have the same issue now.

@leifcr
Copy link
Contributor

leifcr commented Mar 14, 2019

Found this to be an issue when using mariadb 10.4 docker image. Does not seem to be a problem with mysql 5.6 or 5.7 docker images.

@leifcr
Copy link
Contributor

leifcr commented Mar 14, 2019

Folow-up on this issue. it is only an issue if you have an existing mysql docker-image and reuse the data_dir with a mariadb docker image. Please close this issue, as latest verison works fine.

@stale
Copy link

stale bot commented Jan 10, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 10, 2021
@stale stale bot closed this as completed Jan 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants