...et dolore magna aliqua. Mi eget mauris pharetra et ultrices neque." output_mp3_path = Rails.root.join("tts/ipsum.mp3") new Synthesizer(input_text, output_mp3_path).to_mp3 Code require "ruby-openai"

Rails' ActiveSupport::TimeWithZone objects have both a timezone code and offset, e.g. Thu, 28 Mar 2019 16:00:00 CET +01:00. Ruby's stdlib TZInfo also has time zones...

...chances are you'll end up in the wrong time zone. This is why Rails actually uses a long list of time zone names with have names like "London" or...

Here is how to start your Rails application to accept both HTTP and HTTPS in development. gem install passenger Create a self-signed SSL certificate. Store the generated files in...

...saved to database directly as the the dumped object was not marked dirty, thus rails does not see the need to save it, even if the object is not present...

Webpack is the future. We're using it in our latest Rails applications. For tests, we want to compile assets like for production. For parallel tests, we want to avoid...

...Dir.empty?(public_output_path) end delegate :public_output_path, to: :config private def test? Rails.env.test? end def parallel_tests? test? && !!parallel_tests_number end def parallel_tests_number

apidock.com

...an instance of its subclasses or superclass. This is useful because some parts of Rails reflect on the class of an instance, e.g. to decide which partial to render:

Large Rails projects tend to define multiple custom ways to format Dates or DateTimes. This often leads to duplicated format strings, wrong formats and unnecessary introduction of new formats.

getbootstrap.com

...use SimpleForm in your project, I would suggest to regenerate the configuration file with rails generate simple_form:install --bootstrap and merge it with your own customizations instead of only...

...application server without configuration Usage Install Passenger Standalone with gem install passenger Inside any Rails project, start Passenger Standalone with passenger start Alternatives You can use Puma. It also supports...

...version "3.4.0" resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.4.0.tgz#8de513fa0fa4b2c7d2e48a530e26f0596936efdf" integrity sha512-ggRCXln9zEqv6OqAGXFEcshF5dSBvCkzj6Gm2gzuR5fWawaX8t7cxKVkkygKODrDAzKdoYw3l/e3pm3vlT4IbQ== package.json { "dependencies": { "@rails/webpacker": "4.x", "bootstrap-datepicker": "1.8.0", # the package says it needs "jquery": ">=1.7.1 <4.0.0" as a dependency

...node_modules/jquery node_modules/bootstrap-datepicker/node_modules/jquery Actual issue Within the Rails Webpacker config we now provide a jQuery object to boostrap-datepicker: config/webpack/environment.js environment.plugins.prepend( 'Provide', new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery', 'window.jQuery': 'jquery...

...partial_double_verification. This might be handy in case you are testing helpers in Rails, where you sometimes rely on methods defined in the application controller (e.g. current_user and...

} start your server as usual, but go to https://localhost:3000 bundle exec rails s Accept the certificate in your browser See also Creating a self-signed certificate for...

...deployed to the servers. The gems of these groups might not be loaded by rails, however, the deployment process will take longer as the gems will be downloaded and installed...

stackoverflow.com

...method's source code If your Gemfile comes with method_source (a dependency of Rails 7+), you can can inspect the source code directly using the Method#source method:

linux.die.net

...also use Cookies with cURL. For easily making HTTP requests in an IRB or Rails console, take a look at the HTTP gem. If you prefer a GUI, take a...

haml.info

%span Reference %pre ~ content Reference Hello World Textareas In some versions of Haml + Rails, this may also be an issue for textarea elements. Fix it similarly: # Indented description

makandra dev

...for example, you maintain a gem and want to run automated tests against multiple rails versions. When you need to bundle one of your secondary Gemfiles, the solution above is...

...our output will be more verbose than when we only need support modern browsers. Rails 5.1+ projects often use Webpacker to preconfigure the Webpack pipeline for us. The default configuration...

...Follow the instructions in the README. Most likely you want: to add the Ruby, Rails and RSpec cops to include the unit test 2. Report all existing offenses and exclude...

...So might fix this by adding the following lines to your application.rb: class Application < Rails::Application config.time_zone = 'Berlin' # or whatever your time zone end It seems Date.yesterday uses the...

...add the following tests to test suites: # Make sure to require the previews Dir[Rails.root.join('spec/mailers/previews/*.rb')].each { |file| require(file) } ActionMailer::Preview.all.index_with(&:emails).each do |preview, mails|

github.com

...TILs on many topics that might be interesting for most of us. (e.g. Ruby, Rails, Git, Unix..) Ruby Here is an excerpt of all the Ruby TILs that were new...

makandra dev

...on to the console IRB. console command: Ctrl + C now properly exits a local Rails console rspec and cucumber commands: Run specs even if the automatic chromedriver update fails

github.com

Looks simpler than inaction_mailer: gem install mailcatcher mailcatcher Setup Rails to send mails to 127.0.0.1:1025. Usually you want the following config in config/environments/development.rb and maybe in test.rb or...