...request and model using implicit and convoluted protocols. We prefer a different approach. We believe that among all the classes in a Rails project, controllers are some of the hardest...

...to test and understand and should receive special care. It is our belief that: Controllers should be short and tidy Controllers should receive the same amount of programming discipline as...

makandra dev

If you are exchanging files with a client via Dropbox you do not need to access the Web page every...

makandra dev

> {% client.global.set("auth_token", response.body.token); %} ### //Accessing a variable GET https://example.com/api Authorization: Bearer {{auth_token}} Complete documentation can be found here: https://www.jetbrains.com/help/idea/http-client-in-product-code-editor.html

...In Rails 3.1+ the asset pipeline will take care of this. Thus you're best off using an uncompressed version of your Javascript in development. Also load the non-minified...

...thing to do with any new U2410 should be to disable the incredibly annoying beep when pressing any monitor button. Here is the fastest way to achieve that:

...Sound”; the “Power Save Audio” entry is usually grayed out, so this is 1 beep less than from above.) Right Down Tick Do it this way or your colleagues will...

makandra dev
stdgems.org

Ruby's standard library is in the process of being gemified. It will soon - Ruby 2.5 - consist of RubyGems, which...

Here are some popular mistakes when using nested forms: You are using fields_for instead of form.fields_for.

Install Ruby from the Ubuntu repository: sudo apt-get install ruby ruby-dev \ ruby is the meta package. If you...

makandra dev

The handy method has_select?(field, :selected => text) does not behave as expected with Cucumber 0.10.2, Capybara 0.4.1.2 and Selenium 0.2.2. It may not recognize a select field if the...

...value. If you don't have the possibility to upgrade these Gems, probably the best way to go is to distinguish the current Capybara driver: Then /^"([^"]*)" should be selected for...

...selectively for your current need of change. For a more detailed example on this behavior compared to the --worktree option you can have a look on the example within the...

...git restore with --source for the usage --staged compared to --worktree To get a better idea, why this behavior might be useful I will add an example for both commands...

kukicola.io

Using ActiveRecord's #signed_id and .find_signed methods you can create URLs that expire after some time. No conditionals...

Your objects are now inspected with pretty colors: Note that if your inspection becomes wider than your terminal, IRB will automatically break it across multiple lines, like you probably...

...doing something like the following. @user = User.something(123) rescue User.new # DON'T or @user = begin User.something(123) rescue # DON'T User.new end This is bad. Do not do that.

...to be raised, you can always rescue for its class. Do that instead. @user = begin User.something(123) rescue ActiveRecord::RecordNotFound User.new end Any unexpected errors will then still be raising...

Makandra cards will auto-detect the language used for syntax highlighting. This auto-detection sometimes fails for short code snippets...

There are many fun Unicode characters like ▲ or ☯. You might be tempted to use them for graphical elements in lieu...

Today, this line made me trouble. Can you spot the mistake? match 'sitemap.xml' => 'feeds#sitemap', :constraints => { :format => 'xml' }, :as => 'sitemap...

...application does not need to support time zones. Disable them like this: config.time_zone = 'Berlin' # Your local time zone config.active_record.default_timezone = :local config.active_record.time_zone_aware_attributes = false

...s Time will use that. In the example above, it should be in the Berlin zone. Using time zones If your application should support time zones, the default ActiveRecord configuration...

You can seriously speed up deployments with Capistrano when using a local git repository on the server you are deploying...

postgresql.org

PostgreSQL's Common Table Expressions (CTEs) can be used to extract sub-queries from bulky SQL statements into a temporary...

Controller responses often include Javascript code that contains values from Ruby variables. E.g. you want to call a Javascript function...

Imagine the following HTML structure, where the scrolling container has overflow-y: scroll: +--scrolling container+-+ | | | +-child element+----+ | | | ++iframe++ | | | | | | | | | | | | | | +-----------------------+ | | | | <-- actually cut...

ignore_rules << (pattern || block) end def mute(&block) @muted = true if block begin block.call ensure unmute end end end def unmute @muted = false end def self.current @current ||= new...

...may feel odd that the SQL statement says "UPDATE new_table". If your migration becomes too complex, you could put your logic into multiple reversible blocks (so they contain only...

end end A word of advice: Depending on your migration, you might be better off just defining 2 separate up and down methods instead of using change...

When you open up a story to only have a look at it, close it by pressing the "Cancel" button...