https://stackoverflow.com/questions/5123972/ruby-on-rails-password-validation
Arquivo da categoria: Rails
MailCatcher
Catches mail and serves it through a dream.
MailCatcher runs a super simple SMTP server which catches any message sent to it to display in a web interface. Run mailcatcher, set your favourite app to deliver to smtp://127.0.0.1:1025 instead of your default SMTP server, then check out http://127.0.0.1:1080 to see the mail that’s arrived so far.
Rails + Postgres drop error: database is being accessed by other users
Uglifier::Error: Unexpected token: name (indices). To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true)
JavaScript file per view in Rails
Load the main JavaScript in application.js every time. Now create files for different needs. Create a form.js file, a myfancypart.js file etc. Don’t load them in the application.html.erb layout. Load them dynamically when you need them:
application.html.erb:
<%= javascript_include_tag "application" %>
<%= yield :javascript_includes %>
top of your view.html.erb:
<% content_for :javascript_includes do %>
<%= javascript_include_tag "forms.js" %>
<% end %>
Everything in the content_for block will be loaded at yield :javascript_includes.
How to Use Sidekiq in Rails 6
rails link_to download file
<%= link_to "Download", file.file(:original, false), download:true %>