Skip to content

Instantly share code, notes, and snippets.

@sevenseacat
Created April 19, 2017 06:15
Show Gist options
  • Save sevenseacat/fdf239bdc572a5c29776483f3f71985d to your computer and use it in GitHub Desktop.
Save sevenseacat/fdf239bdc572a5c29776483f3f71985d to your computer and use it in GitHub Desktop.
class Tour < ApplicationRecord
# This is used when generating urls, ie. tour_path(@tour) will give you "/tours/#{@tour.to_param}"
def to_param
tour_id # The field name that gives you 'e4Hqh8jTTcCrvQ3kH26Mtd7a'
end
end
@mikesaltsman
Copy link

mikesaltsman commented Apr 19, 2017

I'm doing that in the tour controller


private
      def to_param
        token
      end
end

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