Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/steveklabnik/ams_208
https://github.com/steveklabnik/ams_208
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/steveklabnik/ams_208
- Owner: steveklabnik
- Created: 2013-03-06T22:16:06.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-03-06T22:18:48.000Z (almost 12 years ago)
- Last Synced: 2024-11-01T01:23:57.021Z (about 2 months ago)
- Language: Ruby
- Size: 125 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rdoc
Awesome Lists containing this project
README
== README
This is intended to reproduce https://github.com/rails-api/active_model_serializers/issues/208
You'll also need to grab https://github.com/steveklabnik/blorgh
Finally, you'll need to change Gemfile references in both the app and the
engine to point at your own copy of rails and blorgh, rather than mine.=== The issue
Basically,
def utt_url
app.routes.url_helpers.root_path
#Blorgh::Engine.routes.url_helpers.root_path
endThis doesn't work. Flip the comments, and it does. This is a bug.
You can find this code in the Blorgh repo, app/serializers/blorgh_serializer.rb
You can get an entry by spinning up a server,
$ bin/rails s
hitting the right page
$ open http://localhost:3000/blog/posts/new
Filling out the form, then hitting create. It should redirect you to
http://localhost:3000/blog/posts/1
Which should give you the serialized json.
If I make a change to Rails:
diff --git a/actionpack/lib/action_controller/railtie.rb b/actionpack/lib/action_controller/railtie.rb
index 5379547..831c007 100644
--- a/actionpack/lib/action_controller/railtie.rb
+++ b/actionpack/lib/action_controller/railtie.rb
@@ -43,8 +43,9 @@ module ActionController
options.relative_url_root ||= app.config.relative_url_root
ActiveSupport.on_load(:action_controller) do
- include app.routes.mounted_helpers
+ include AbstractController::UrlFor
extend ::AbstractController::Railties::RoutesHelpers.with(app.routes)
+ include app.routes.mounted_helpers
extend ::ActionController::Railties::Helpers
options.each do |k,v|It still doesn't actually fix things. Drat.