-
Notifications
You must be signed in to change notification settings - Fork 113
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
[add]routes for rails api mode #69
Conversation
Hey @ihatov08! Sorry for the long delay here. I might have a need to use this gem on a side project with Rails API too and I'll give it a shot. I personally think we can just ignore the RESTfulness here. I'm fine with replacing the What do you and @pseudomuto think? |
@fgrehm LetterOpenerWeb::Engine.routes.draw do
delete 'clear' => 'letters#clear', :as => :clear_letters
delete ':id' => 'letters#destroy', :as => :delete_letter
get '/' => 'letters#index', :as => :letters
get ':id(/:style)' => 'letters#show', :as => :letter
get ':id/attachments/:file' => 'letters#attachment'
post 'clear' => 'letters#clear' # same endpoint line:2
post ':id' => 'letters#destroy' # same endpoint line:3
end It would be nice if the following code works regardless of Rails mode LetterOpenerWeb::Engine.routes.draw do
post 'clear' => 'letters#clear'
post ':id' => 'letters#destroy'
get '/' => 'letters#index', :as => :letters
get ':id(/:style)' => 'letters#show', :as => :letter
get ':id/attachments/:file' => 'letters#attachment'
end |
Here's my slightly hacky solution: 793b4e8 |
Just got a pre-release ready to go I'll just ping some folks for testing before a final release and this PR should auto close after code is on master. Thanks for your contribution! |
I tried next branch rails api mode. https://github.com/ihatov08/letter_opener_web_rails_api |
If we want to use letter_opener_web in rails api mode without modifying letter_opener_web, you need the following modifications.
ihatov08/letter_opener_web_rails_api@bbfb9a5
|
Hey @ihatov08 , tks for the feedback. I'll take a look at that sample app and see if we can simplify this before final release and / or document how to integrate with rails-api apps |
This error occurred when using Rails API mode.
Plead add this routes.
related. #42