makandra dev
github.com

Katapult 0.3.0 brings Rails 5 and Ruby 2.5 support with a new design, plus a ton of smaller features, fixes and improvements. Features Generating a Rails 5.1.4 app on Ruby...

Issue: You have an app using jsbundling-rails and esbuild. After deploy, the assets built by esbuild are missing in public/assets. Solution: Add app/builds to your git repo (by adding...

If you are using Angular and want something like Rails' simple_format which HTML-formats a plain-text input into paragraphs and line breaks, this directive is for you.

...only want to compile when needed. This card shows what will cause Webpacker (the Rails/Webpack integration) to compile your assets. When you run a dev server While development it is...

...call any helper that accesses asset paths (e.g. javascript_pack_tag or image_tag), Rails will compile your entire assets within its process before that helper returns. This will cause...

Remember how Rails 2 came with an awesome feature that broke all code using Time.now or Time.parse? This behavior is now the default for Rails 3. Disable it by adding...

github.com

Using Scenic, you can bring the power of SQL views to your Rails application without having to switch your schema format to SQL. Scenic provides a convention for versioning views...

makandra dev
github.com

Katapult was an endeavor to dramatically speed up starting a new Rails application. However, it turned out to save less time than expected, while requiring more time for maintenance than...

...code antiquated. Nevertheless, its architecture may remain an inspiration on how to use the Rails generators programmatically...

view_context.helper_method('args') Rails 2 ApplicationController.helpers.helper_method('args') Also see How to use helper methods inside a model...

SSHKit 1.9.0 might fail with the following error, when trying to deploy a Rail application. Upgrading the gem to version 1.21.0 fixed the issue. Traceback (most recent call last...

makandra dev
skillsmatter.com

With Rails 4, Concerns have become the “official” solution to the big-models problem. However, there’s a fair amount of controversy about this topic in the community. Not everyone...

...problem of AR models becoming too big. In this talk we will see what Rails Concerns are and how can we use them to keep our models fit. More interestingly...

ombulabs.com

...49/65) travis-lint... Slow requires: 110.21 render_anywhere 147.33 nokogiri 173.83 haml 179.62 sass-rails 205.04 delayed_job_active_record 286.76 rails 289.36 mail 291.98 capistrano 326.05 delayed_job...

...be updating some of a form's fields via XHR. You can simply use Rails' fields_for to do things like this in your views (HAML here): - fields_for @user...

blog.jayfields.com

...these styles, and system will fail when passing it invalid arguments: system 'bundle exec rails server', '-p 3000' # fails and returns nil This is equivalent to running a command called...

...bundle exec rails" (including spaces in its filename). There is usually no such command anywhere on the $PATH. Note that you should prefer the 2nd approach (list of arguments instead...

Now supports RSpec 3 and Rails 4 Drops support for state_machine, which has some issues with Rails 4 and isn't actively maintained

github.com

When you need to use diff in either some Ruby code or your Rails app, use the differ gem. puts Differ.diff "foo", "boo" # => {"boo" >> "foo"} Usage There are several variants...

[mysqld] sql_mode="" Now restart MySQL: sudo service mysql restart For a single Rails project If you only want to change the SQL mode for one project, you can...

When your Rails controller action responds with only a simple text, render text: 'Hello' may not be what you want. You should not even use it on Rails 4.1+ any...

By default, a "text" response from a Rails controller will still be a sent as text/html: render text: 'Hello' response.body # => "Hello" response.content_type # => "text/html" While this may not be...

stackoverflow.blog

...opensource.zalando.com/restful-api-guidelines https://www.merixstudio.com/blog/best-practices-rest-api-development/ https://www.oreilly.com/library/view/rest-api-design/9781449317904/ More topics in our deck: Rails: Rest API post-mortem analysis InfoQ: How to Design a Good API & Why it Matters

...last_synchronized_at: nil, } } ) def validate_analytic_stats_against_json_schema @schema ||= File.read(File.join(Rails.root, 'app', 'models', 'project', "analytic_stats_schema_v#{analytics_stats_version}.json")) analytic_stats_errors = JSON...

...iconfont-plugin-webpack that automate the font building. If you're still using the Rails asset pipeline, try the half-automatic approach. Webpacker Rails: How to integrate the plugin

Obviously, this leads to problems when comparing strings: "Über".downcase == "über" => false In Rails you can use ActiveSupports' multibyte chars to avoid that problem. It gives you a wrapped...

...cassette for the request that fails Copy the request with all parameters Open a rails console, assign the request to a variable and unescape it: my_project> var = "%5B%7B...

...LIKE only takes a fraction of a second. This means when optimizing a typical Rails action, you should probably look further than the database. A view can easily take many...

...often times the results of such subtractions go into a view. When upgrading a Rails application from Ruby 1.8 to 1.9, this will cause significant pain, and under most circumstances...