RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Submit a post

You can use basic HTML markup (e.g. <a>) or Markdown.
Note that your post may be edited to suit the format of the site.

As you are not logged in, you will be
directed via GitHub to signup or sign in

Post Preview

Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.

How to Tell the Difference Between a Default and a Provided Value for Optional Argume

It is sometimes required for the methods with optional arguments to be able to differentiate between its default value and the value passed from the caller. Passing nil might initially sound like a good idea since it represents “nothingness”. However, it might turn out that nil is a legit value and there might be cases where it is desirable for the caller to pass nil. In such a case, we cannot use it as a default value if we want to implement a special logic for the case of not providing that value. [more inside]

Programming Crypto Blockchain Contracts (in Ruby) Step-by-Step Guide / Book

Hello, I’ve started a new (free online) step-by-step guide / booklet titled “Programming Crypto Blockchain Contracts (with Ruby) Step-by-Step Book / Guide Let’s Start with P@nzi & Pyr@mid Schemes. Run Your Own Lotteries, G@mbling C@sinos and more on the Blockchain World Computer…”. The first chapter is online with ready-to-run contract scripts in ruby. Don’t Miss the Investment of a Lifetime! May the Brave be Rewared with Riches! Cheers. Prost.

Ruby's p vs puts Method

The puts method in ruby is very popular all over the internet it’s generally used by ruby programmers for debugging purposes and to output the value of certain variables so we can see what’s goin on in our system. However puts can sometimes lead you astray because of how it converts everything into a string. See how p is different from puts

ActiveStorage variants are persisting original image EXIF metadata

Imagine you are using Rails 5.2 ActiveStorage. Now you upload an image, render it with app.url_for my_model.image.variant(resize: '400x300') and discover that it’s rotated 90 deg to you would normally expect. You copy paste the link to the image to the browser and discover the image is rotated correctly. How is that possible? [more inside]

Thank you for this, you’ve saved me hours of debugging

How to neatly organise assets in a Rails app

Rails comes packed with a lot of useful conventions. However, it doesn’t say much about how we should organise our front end assets. Here is a way in which we can leverage the same conventions we use to organise our controllers and views to have a neatly organised assets directory. [more inside]

Loading older posts