background preloader

Ruby Rails

Facebook Twitter

Rails Asset Pipeline on Heroku Cedar. Cedar rails ruby Table of Contents Rails applications running on the Heroku Cedar stack can have the asset pipeline compiled locally, at deploy-time, or at run time.

Rails Asset Pipeline on Heroku Cedar

For new users, we recommend reading Getting Started with Rails 3.x on Heroku before proceeding further. The Rails 4 Asset Pipeline If you are using Rails 4 and the asset pipeline it is recommended to familiarize yourself with the document below. The Rails 3 Asset Pipeline The Rails 3 asset pipeline is supported on Heroku’s Cedar stack. The Rails asset pipeline provides an assets:precompile rake task to allow assets to be compiled and cached up front rather than compiled every time the app boots. There are two ways you can use the asset pipeline on Heroku. Compiling assets locally.Compiling assets during slug compilation. Compiling assets locally If a public/assets/manifest.yml is detected in your app, Heroku will assume you are handling asset compilation yourself and will not attempt to compile your assets. Failed assets:precompile. Is assignment in a conditional clause good ruby style. Ruby - Regex, how to match multiple lines. Ruby Regular Expressions.

A regular expression is a special sequence of characters that helps you match or find other strings or sets of strings using a specialized syntax held in a pattern.

Ruby Regular Expressions

A regular expression literal is a pattern between slashes or between arbitrary delimiters followed by %r as follows: Syntax: /pattern//pattern/im # option can be specified%r! /usr/local! # general delimited regular expression Example: #! This will produce the following result: Line1 contains Cats Regular-expression modifiers: Regular expression literals may include an optional modifier to control various aspects of matching. Like string literals delimited with %Q, Ruby allows you to begin your regular expressions with %r followed by a delimiter of your choice. . # Following matches a single slash character, no escape required%r|/| # Flag characters are allowed with this syntax, too%r[</(.*)>]i.

Rails Troubles: Internationalize Haml-Templates with haml-i18n. Ruby on Rails Quick Tip: passing variables to i18n localized strings. How to use rails-i18n with HAML. Ruby on Rails Quick Tip: passing variables to i18n localized strings. WebSockets on Rails 4 and Ruby 2 - Pogoapp. WebSockets are an exciting new HTML5 technology which has finally begun to pick up enough browser, server and library support to see much wider adoption, potentially driving a move towards a signficantly new kind/kinds of web client/server communication.

WebSockets on Rails 4 and Ruby 2 - Pogoapp

We've been making use of websockets with socket.io and node.js, but good old Rails doesn't need to be left out. We're going to use Dan Knox's slick high-level websocket-rails gem, and actually copy/port over a good bit of code from the slightly outdated example project. But why stop with WebSockets? It's 2013. Let's use Ruby 2 and Rails 4, too. That even means we can skip the step of removing Rack::Lock, because Rails 4 is threadsafe by default. Setup So first we'll install Ruby 2, Rails 4, and setup a new project (this assumes you're using rbenv, YMMV): Ruby Gems Not Installing, Hangs While Getting Gems. Ruby - specs failing in Rails 3.1 - NoMethodError: private method 'rand' called for.

Generating Paperclip image uploads with fake data - Ruby on Rails Populator / Faker Gems. Haml. Ruby - Who is responsible of generating the .idea files in Rails. Install Rubymine 4.5.x on Ubuntu 12.04. Installing Ruby 1.9.2 on Ubuntu 11.10 Oneiric Ocelot without using RVM. Installing Ruby 1.9.2 on Ubuntu 11.10 Oneiric Ocelot without using RVM It seems installing Ruby 1.9 on Ubuntu without the use of RVM isn’t all that trivial.

Installing Ruby 1.9.2 on Ubuntu 11.10 Oneiric Ocelot without using RVM

I had to poke around the system for quite a while before I got it running. Why not RVM? Well, I tried RVM but compiling Ruby took 3 hours on my EC2 micro instance and was eating all my CPU so that my webserver was basically not available anymore. To me that isn't acceptable. Besides I don't really want to use different versions of Ruby at the same time.

The steps. How do I install the latest version of ruby in Ubuntu. Using the Ruby Development Tools plug-in for Eclipse. Editor's note: To learn what's new and changed in RDT since this article was written, read the developerWorks article "Easy Ruby development, the Eclipse way.

Using the Ruby Development Tools plug-in for Eclipse

" Why Ruby? Why would any self-respecting Java developer care about Ruby? Ruby is a general-purpose scripting language created 10 years ago in Japan. Contrary to popular belief, it is a pure object-oriented language. Unlike Java technology, Ruby has no scalars, so everything, including integers, are first-class objects. Ruby is also red-hot right now. The other reason to start playing with Ruby is that all the cool kids are doing it.

One of the main limiting factors to widespread development in Ruby is a good development environment (for those who don't want to learn Emacs). Back to top Setup Before you can start playing with Ruby, you have to install — or verify that you have — the Ruby interpreter and libraries, and the Ruby Development Environment. Getting Ruby If you get a version number, you are ready to go. Rails production 'css isn't precompiled'