-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Comments should work with models with String Ids #34
Comments
Could you please post the entire stacktrace in a gist? |
I see. Active Admin uses a polymorphic relationships in Active Record for comments which usually include an integer id. But of course, Active Record does not require ids to be integers. |
Right. I tried turning off comments and it looks like it still tries to load the comments on the edit screen. Perhaps that shouldn't happen if comments are turned off? I'm loving what you've got here, but we don't use integer id's basically anywhere in our system. Perhaps we just have to punt on this for now. |
Interesting. I'll take a look at this case and see if there is a simple solution. All of the screens should still function without comments enabled. On 2011-05-13, at 2:55 PM, malyk wrote:
|
It just occurred to me that I may not have restarted my server after turning comments off. So that may be why the error is happening when comments are trying to be loaded...because they are still turned on. But I would wager that string id's are fairly common in the real world. |
Did restarting the server turn off comments for all your models? |
Didn't appear too. I was still getting a stack trace trying to load the show page of a model that had a string id. |
I was able to fix this behavior by changing the migrations that were generated (works with both string id's and integer id's). And causes little or no ill that I can tell. I'll leave it up to the crew here to determine if this would be in scope for addition to active_admin... in myapp/db/migrate/...create_admin_notes.rb (remove the commented line below, and add the two lines above it in place of it)
|
That's cool. Don't hesitate to update the migration and create a pull request. |
I'm working this. |
When viewing an entry (e.g.: http://localhost/admin/employees/1) I am getting an error from postgres:
Full gist: https://gist.github.com/1886112 Could it be that commit 00e6b24 introduces the regression? I have replaced in the file: lib/generators/active_admin/install/templates/migrations/1_create_admin_notes.rb the line
with
and for now everything seems to work. |
@jancel Could you have a look at that? |
Sure can. |
This should a. fix issue for new installs, and b. remain compatible with old installs |
Could you please release a patch version with this fix? |
@Magnolia-Fan Only @gregbell can publish a new gem. He's out of town till Tuesday. Please use the master branch on github till then. :) |
Edit: Original title: "Form for tables with string id's throw an exception"
PGError: ERROR: invalid input syntax for integer: "xksS5NjE"
LINE 1: ...admin' AND ("active_admin_comments".resource_id = 'xksS5NjE'..."
Looks like the comments tables expect integer ids on the parent table but this isn't universally true.
The text was updated successfully, but these errors were encountered: