This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mysql2::Error: Unknown column 'orders.projects' in 'where clause': SELECT COUNT(*) FROM `invoices` INNER JOIN `orders` ON `orders`.`id` = `invoices`.`order_id` INNER JOIN `projects` ON `projects`.`id` = `orders`.`project_id` WHERE `orders`.`projects` = '---\n:user_id: 283\n' AND `invoices`.`status` = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Order < ActiveRecord::Base | |
## Setup accessible (or protected) attributes for your model | |
attr_accessible :project_id, :developer_id, :due_date, :status, :notes, :is_delivered, :deliveted_at, :completed_at | |
## Virtual attributes | |
attr_accessor :pages | |
## Associations | |
belongs_to :project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def unread_comments | |
readable_comments.delete_if {|c| c.created_at < c.discussion.assignments.find_by_user_id(id).updated_at } | |
end | |
def create_new_invoice! | |
invoice = invoices.build | |
order_item_options.delete_if{ |o| o.price == 0 }.map{ |o| invoice.invoice_lines.build(:order_item_id => o.order_item.id, :description => o.order_item.name, :unit_price => o.price) } | |
invoice.save! | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/gmail_will_paginate.rb | |
# USAGE: | |
# <%= will_paginate(@posts, :renderer => WillPaginate::Gmail) %> | |
module WillPaginate | |
class Gmail < ::WillPaginate::ActionView::LinkRenderer | |
def pagination | |
[:window, :pagination_buttons] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This is the main Apache HTTP server configuration file. It contains the | |
# configuration directives that give the server its instructions. | |
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information. | |
# In particular, see | |
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html> | |
# for a discussion of each configuration directive. | |
# | |
# Do NOT simply read the instructions in here without understanding | |
# what they do. They're here only as hints or reminders. If you are unsure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Started PUT "/manager/projects/1" for 127.0.0.1 at 2013-05-07 19:32:00 -0300 | |
Processing by Manager::ProjectsController#update as HTML | |
Parameters: {"utf8"=>"✓", "authenticity_token"=>"chEAfffsI3HcHlPqBn0LfQxIO/V7DhXj6wQ2j3jSIi8=", "project"=>{"milestones_attributes"=>{"0"=>{"pages"=>"1", "budget"=>"2", "development_cost_amount"=>"3", "developer_id"=>"1", "is_completed"=>"1", "is_delivered"=>"0"}}}, "commit"=>"Save", "id"=>"1"} | |
Project Load (0.3ms) SELECT `projects`.* FROM `projects` WHERE `projects`.`id` = 1 LIMIT 1 | |
(0.1ms) BEGIN | |
SQL (0.3ms) INSERT INTO `activities` (`created_at`, `key`, `owner_id`, `owner_type`, `parameters`, `recipient_id`, `recipient_type`, `trackable_id`, `trackable_type`, `updated_at`) VALUES ('2013-05-07 22:32:00', 'project.update', NULL, NULL, '--- {}\n', NULL, NULL, 1, 'Project', '2013-05-07 22:32:00') | |
SQL (5.9ms) INSERT INTO `project_milestones` (`budget`, `created_at`, `developer_id`, `development_cost_amount`, `is_completed`, `is_delivered`, `pages`, `project_id`, `up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine on | |
# Hide Directories | |
Options -Indexes | |
# Redirects | |
ErrorDocument 404 http://www.pixel2html.net/ | |
ErrorDocument 401 http://www.pixel2html.net/ | |
ErrorDocument 403 http://www.pixel2html.net/ | |
RewriteCond %{HTTP_HOST} ^pixel2wp.com$ [OR] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Backend::Application.routes.draw do | |
namespace :manager do | |
resources :projects do | |
scope :module => "projects" do | |
resources :activities, as: 'activity', path: 'activity', only: [:index, :destroy] | |
resources :milestones | |
resources :tickets | |
resources :invoices |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="day"> | |
<ul> | |
<% date = Time.now+1.day %> | |
<% price = 150 %> | |
<% 7.times do |i| %> | |
<% date += 1.day %> | |
<% price -= 10 %> | |
<% if date.strftime("%u").to_i > 5 %> | |
<% date = date+2.day %> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.box = "precise32" | |
config.vm.box_url = "http://files.vagrantup.com/precise32.box" | |
config.vm.network :forwarded_port, guest: 3000, host: 3000 | |
config.vm.hostname = "ruby-dev-server" | |
config.vm.provision :shell, path: "install.sh" |