Skip to content

Please, make single-element list supporting finding record by slugs too, just as .show does #443

Description

Hello,
I use ActiveScaffold with one of my models, which supports finding records by slugs (via friendly_id). And I've noticed some strange behavior:
While .show works pretty well with this:

Started GET "/fremantle/resources/63429" for ::1 at 2015-09-10 23:42:40 +0300
Processing by Fremantle::Guest::ResourcesController#show as HTML
  Parameters: {"id"=>"63429"}
  Fremantle::Resource Load (0.3ms)  SELECT  "fremantle_resources".* FROM "fremantle_resources" WHERE "fremantle_resources"."slug" = ?  ORDER BY "fremantle_resources"."permalink" DESC LIMIT 1  [["slug", "63429"]]

…but .index with id (single-element list) doesn't work (doesn't find the record):

Started GET "/fremantle/resources/63429/list" for ::1 at 2015-09-10 23:43:27 +0300
Processing by Fremantle::Guest::ResourcesController#index as HTML
  Parameters: {"id"=>"63429"}
   (0.3ms)  SELECT COUNT(*) FROM "fremantle_resources" WHERE "fremantle_resources"."id" = ?  [["id", 63429]]

As ActiveScaffold already has some solution (do_show) which works well, may some part of it be ported to do_list ?

P.S. In rails console the difference is in parameter to find method:
Fremantle::Resource.find("63429") works well, while Fremantle::Resource.find(63429) doesn't work.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions