How to run a spec / test when there is a time latency or lag involved

10/28/14  Public, Testing / TDD, Gems

For example, if something is supposed to automatically delete every 7 days, how do you test for that?

Two ideas

  1. You can manually changed the created_at data in the database to back date an item, simulating it was created 7 days ago


1 vote - harrylevine

Shortcut for finding recent things you have typed on the command line

10/28/14  Public, Command Line, Shortcuts

  • control + r
  • then start typing part of what you are looking for
  • hit enter to select what you want

1 vote - harrylevine

HTML symbol for creating one blank space

03/22/15  Public, Other Languages


For example, here are two spaces:

<p>Created: <%= @note.created_at.strftime("%b %d, %Y") %> &nbsp; &nbsp; Updated: <%= @note.updated_at.strftime("%b %d, %Y") %></p>

1 vote - harrylevine

Website and way to create a favicon for the browser tab

10/28/14  Public, Online Resources

Simply add this to the <head></head>section of your layouts:
<%= favicon_link_tag 'favicon.ico' %>
Place the favicon.ico image in /app/assets/images/ if you are using the asset pipeline, and in /public/images/ if you are not.
Also, ther...

1 vote - harrylevine

Debugging & learning SQL in the rails console

11/19/15  Public, Databases, Troubleshooting, Other Languages

Sometimes examining the SQL generated by ActiveRecord query and finder methods can be useful in debugging and learning SQL. Rails' ActiveRecord provides the to_sql method to make this easy.

Open up the rails console with rails c or `rails c...

2 votes - eliotsykes

Using your command line's history

11/15/14  Public, Command Line

Your command line remembers everything you've previously typed, and this history is searchable.

Your command line history is useful when you roughly remember the command you want, but can't remember exactly how to type it.

Navigate hist...

2 votes - eliotsykes

Changing a column in the database

10/25/14  Public, Databases

I only recommend doing this if you are rolling back just one migration. If there have been many migrations since the change that you want to make, be aware that there may be data issues depending on what has transpired since that migration.

I ...

1 vote - harrylevine