I've been trying to understand how to setup systems from
the ground up on Ubuntu. I just installed redis
onto
the box and here's how I did it and some things to look
out for.
To install:
class Longtail | |
attr_accessor :model | |
attr_accessor :field | |
def initialize(options) | |
@model = options[:model] | |
@field = options[:field] | |
end | |
def fetch |
Factory.define :application do |factory| | |
factory.attachment(:sample, "public/samples/sample.doc", "application/msword") | |
end |
class Api::V2::MunicipalitiesController < Api::V2::BaseController | |
def index | |
municipalities = Municipality.find_all_for_api | |
@municipalities = municipalities.collect { |m| {:id => m.id, :name => m.name} } | |
render_json(@municipalities) | |
end | |
end |
class User < ActiveRecord::Base | |
def find_form(id) | |
company.forms.find(id) | |
end | |
end |
class User < ActiveRecord::Base | |
def forms | |
Form.where(:company => company) | |
end | |
def find_form(id) | |
forms.find(id) | |
end | |
end |
sudo apt-get install mercurial | |
hg clone https://vim.googlecode.com/hg/ vim | |
cd vim | |
./configure --enable-rubyinterp --enable-gui=no | |
make | |
sudo make install |
➜ vSync git:(sharing) be rake stats | |
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M | | |
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Controllers | 1446 | 1101 | 33 | 170 | 5 | 4 | | |
| Helpers | 297 | 239 | 0 | 29 | 0 | 6 | | |
| Models | 677 | 491 | 15 | 84 | 5 | 3 | | |
| Libraries | 1971 | 1551 | 41 | 144 | 3 | 8 | | |
| Model specs | 559 | 396 | 0 | 1 | 0 | 394 | | |
| Controller specs | 951 | 694 | 0 | 6 | 0 | 113 | |
defmodule MyApp.Router do | |
use Phoenix.Router | |
namespace MyApp.Controllers do | |
get "restaurants/:id", Restaurants, :show, as: :restaurant | |
resources :images | |
resources :users, Accounts | |