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

Copyright transfer and readme improv #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2012 Daniel Hahn
Copyright (c) 2012 Daniel Hahn, 2022 gut.org

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
11 changes: 9 additions & 2 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ This is mostly itchy-scratchy-ware. We didn't really want the self-proclaimed "s

So we came up with this little thing, which was a drop-in replacement for us, and does exactly what we need. If you like it take a go, otherwise check out one of the established alternatives or roll your own ;-()

== Usage

Call `SanePermalinks.init` to make `ActiveRecord::Base` extend and include the relevant modules and alias `to_param`.

Let `make_permalink with: :name` define by which `find_by` (here: `find_by_name`) the new `find_by_param` should find the record in your model class.

`find_by_param` can throw a `SanePermalinks::WrongPermalink` error when the "slugs" do not exactly fit.

== Contributing to sane_permalinks

* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
Expand All @@ -19,6 +27,5 @@ So we came up with this little thing, which was a drop-in replacement for us, an

== Copyright

Copyright (c) 2012 Daniel Hahn. See LICENSE.txt for
Copyright (c) 2012 Daniel Hahn, 2022 [gut.org](https://gut.org). See [LICENSE.txt](LICENSE.txt) for
further details.

3 changes: 3 additions & 0 deletions lib/sane_permalinks/class_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ def permalink_options
@permalink_options || {}
end

# supported options:
# - with (str/symbol): define the xyz in `find_by_xyz` from find_by_param
# - prepend_id (bool): if permalinks shall look like 1-the_name_or_title
def make_permalink(options)
@permalink_options = options
end
Expand Down