Save 36% for Black Friday! Save 36% on GoRails for Black Friday! Learn more
Activity
And for what you suggest Peter, it works, but I'm getting unexpected redirects I think, becuase I see the flash message "You need to sign in or sign up before continue" and that is because it is redirecting me to a controller that is under authentication, maybe I'm doing something wrong:
Started DELETE "/users/sign_out" for ::1 at 2021-12-28 12:09:59 -0600
Processing by Devise::SessionsController#destroy as TURBO_STREAM
User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 1], ["LIMIT", 1]]
Redirected to http://localhost:3000/
Completed 302 Found in 10ms (ActiveRecord: 0.4ms | Allocations: 5677)
Started DELETE "/" for ::1 at 2021-12-28 12:09:59 -0600
ActionController::RoutingError (No route matches [DELETE] "/"):
Started GET "/dashboard/index" for ::1 at 2021-12-28 12:09:59 -0600
Processing by DashboardController#index as HTML
Completed 401 Unauthorized in 3ms (ActiveRecord: 0.0ms | Allocations: 469)
Started GET "/users/sign_in" for ::1 at 2021-12-28 12:09:59 -0600
Processing by Devise::SessionsController#new as HTML
Rendering layout layouts/landing.html.erb
Rendering devise/sessions/new.html.erb within layouts/landing
Rendered devise/shared/_links.html.erb (Duration: 2.9ms | Allocations: 1300)
Rendered devise/sessions/new.html.erb within layouts/landing (Duration: 10.9ms | Allocations: 4552)
Rendered shared/_notifications.html.erb (Duration: 5.5ms | Allocations: 2748)
Rendered layout layouts/landing.html.erb (Duration: 27.3ms | Allocations: 14853)
Completed 200 OK in 31ms (Views: 29.2ms | ActiveRecord: 0.0ms | Allocations: 16426)
What Tony Serkis suggested really worked for me and my flash messages are being shown correctly on the sign-out action. I have only one question because changing the method to GET request, is there any security concern?
Just wanted to mention that for Rails 7, I also needed to change the logout link from using link_to
to button_to
to make the DELETE request instead of GET.
Hi @pedro these methods are automatically generated by Rails when you set up an association like the belongs_to
so you do not need to create it on any model to make it work with this example.
You can take a look at this reference https://guides.rubyonrails.org/association_basics.html#detailed-association-reference
Posted in ActsAsTenant demo app
I want to follow up on this post because I'm really interested in developing an application like Shopify that could be able to manage tenants pointing their own domains (not subdomains) to its accounts and wildcard them with the SSL to have HTTPS available.
@bradley I'm in the same situation with an app like Shopify, have you found a good resource to tackle it?
Is there any episode showing how to configure it?
Posted in Hotwire Modal Forms Discussion
Yeah, it is not working for me!
Posted in Hotwire Modal Forms Discussion
Instead I would like to have a way to show errors but attached to each input element like the client_side validations
gem does or the optimist
gem. That would be really awesome!
Yes, I created this template for the solution https://railsbytes.com/templates/XbBsG6
I hope it help you too!
I think that this episode can help you or at least give you some guidance!
https://gorails.com/episodes/trix-editor?autoplay=1
This is another video that covers what you need!
https://gorails.com/episodes/multiple-file-uploads-with-shrine?autoplay=1
Does anybody knows how to fix this error in Rails 6.0.3 and TailwindCSS 2.0?
ERROR in ./app/javascript/stylesheets/application.scss (./node_modules/css-loader/dist/cjs.js??ref--7-1!./node_modules/postcss-loader/src??ref--7-2!./node_modules/sass-loader/dist/cjs.js??ref--7-3!./app/javascript/stylesheets/application.scss)
Module build failed (from ./node_modules/postcss-loader/src/index.js):
Error: PostCSS plugin tailwindcss requires PostCSS 8.
Migration guide for end-users:
https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users
at Processor.normalize (/Users/alex/Workspace/virtualfood/node_modules/postcss/lib/processor.js:153:15)
at new Processor (/Users/alex/Workspace/virtualfood/node_modules/postcss/lib/processor.js:56:25)
at postcss (/Users/alex/Workspace/virtualfood/node_modules/postcss/lib/postcss.js:55:10)
at /Users/alex/Workspace/virtualfood/node_modules/postcss-loader/src/index.js:140:12
@ ./app/javascript/stylesheets/application.scss 2:26-228
@ ./app/javascript/packs/application.js
Posted in Symbols vs Strings Discussion
This is a very great episode because help me understand what's happeing under the hood. What I didn't know and I haven't hear before was what you mention at 7:18:
the last set of arguments to any function can be a hash and you don't have to specify the curly braces, they're optional
I have used that in my methods but I've never new that this could be the last argument for any function. Do you have any source to read more about this topic?
Awesome! Thanks for sharing Chris!
Greate episode! If I should get this episode a couple of years ago, that may should saved my life jajaja!
So, this is the same logic you are using here in your post and epdisode comments?