Tags » Rails

Sometimes the asset pipeline isn't flexible enough

In my latest application, I wanted to display full-width and full-height background images randomly from some web source.

I couldn’t find any documentation about how to call a background image from a URL – and it’s true that these things change over time and one day my application my hit a 404.   615 more words

How to pass variable to partials in Rails

Define your partial

_next_prev_nav.erb

<ul class="pager">
  <li class="previous">
    <%= link_to "&larr; Previous".html_safe, prev_url  %>
  </li>
  <li class="next">
    <%= link_to "Next &rarr;".html_safe, next_url  %>
  </li>
</ul>
… 51 more words
Rails

I didn't quit, promise

I’m still here, I promise. Things have been extremely slow in terms of my progress, however. I’d like to take a minute to be honest with myself and everyone about my current struggle. 172 more words

How to list all Rails 4 rake tasks

List all tasks:

$ rake -P

only tasks with descriptions and pattern ( here pattern == “” )

$ rake -T

all task with pattern “ 234 more words

Rails

Fixing "You have already activated rake 10.3.0, but your Gemfile requires rake 10.2.0"

$ bundle update rake # or whatever your gem is called

or

$ bundle update # for update all gems
Rails

Get console input

To get user input from console use gets.chomp

print "Enter something: "
input = gets.chomp
puts "You've entered: '#{input}'"
Enter something: Hi there!
You've entered: 'Hi there!'
Rails