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

#to_s on models not working reliably #329

Closed
nextekcarl opened this issue Dec 14, 2015 · 5 comments
Closed

#to_s on models not working reliably #329

nextekcarl opened this issue Dec 14, 2015 · 5 comments

Comments

@nextekcarl
Copy link

I've updated to 1.2.0 and to_s doesn't seem to be reliably working to display titles/names for models:

to_s

There was talking about changing this in another issue, but I don't see anything saying the method changed, and I can't find anything documented anywhere, plus it is still working in at least one area shown.

@c-lliope
Copy link
Contributor

@nextekcarl, we changed up the rendering behavior in #191 - that change went out in version 0.1.1.

You can fix the behavior by adding this to your ProductDashboard:

def display_resource(product)
  product.to_s
end

As for the "Show Shampoo" button that is using #to_s, that was an oversight that was fixed up in #243. If you update to version ~> 0.1.2, that fix should be in place.

If that solves your problem, feel free to close the issue. Cheers!

@nextekcarl
Copy link
Author

Thanks, though I'm already updated to 0.1.2 in that screenshot, so I think that button code must still be using the old code. I had just updated Administrate to 0.1.2 about 20 mins before posting that screenshot.

@nextekcarl
Copy link
Author

And just to verify that I tried to update the gem again (already updated) and then changed the new display_resource method to reverse the text as shown here:

edit oopmahs

The button must still be using the model's #to_s method.

@c-lliope
Copy link
Contributor

Interesting. @nextekcarl, do you have app/views/admin/application/edit.html.erb or app/views/admin/products/edit.html.erb in your application?

@nextekcarl
Copy link
Author

D'Oh! That was it, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants