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
[enrico@archlap lib]$ find /lib/* -type f -exec yaourt -Qo -- {} + 1>/dev/null | |
error: No package owns /lib/modules/3.1.9-2-ARCH/modules.usbmap | |
error: No package owns /lib/modules/3.1.9-2-ARCH/modules.pcimap | |
error: No package owns /lib/modules/3.1.9-2-ARCH/modules.inputmap | |
error: No package owns /lib/modules/3.1.9-2-ARCH/modules.isapnpmap | |
error: No package owns /lib/modules/3.1.9-2-ARCH/modules.ieee1394map | |
error: No package owns /lib/modules/3.1.9-2-ARCH/modules.ccwmap | |
error: No package owns /lib/modules/3.1.9-2-ARCH/modules.seriomap | |
error: No package owns /lib/modules/3.1.9-2-ARCH/modules.ofmap | |
error: No package owns /lib/modules/3.2.6-2-ARCH/modules.alias |
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 Project < ActiveRecord::Base | |
attr_accessible :name, :start, :stop | |
belongs_to :institution | |
validates :name, :start, :stop, :presence => true | |
end | |
class Institution < ActiveRecord::Base | |
attr_accessible :email, :name, :phone | |
has_many :projects, :dependent => :destroy | |
validates :email, :name, :phone, :presence => true |
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 Project < ActiveRecord::Base | |
attr_accessible :name, :start, :stop, :institution_id | |
belongs_to :institution | |
validates :name, :start, :stop, :institution, :presence => true | |
validate :start_before_stop_date | |
def start_before_stop_date | |
if self.start && self.stop && self.start >= self.stop | |
self.errors.add :start, ' deve essere prima di stop' | |
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
require 'test_helper' | |
class ProjectTest < ActiveSupport::TestCase | |
test "should not save empty project" do | |
project = Project.new | |
assert !project.save, "Saved empty project" | |
end | |
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
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html | |
one: | |
name: MyString | |
institution_id: 1 | |
start: 2012-08-03 | |
stop: 2012-08-03 | |
two: | |
name: MyString |
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
test "stop is greater than start date" do | |
project = Project.new(:name => "Puppa", | |
:institution_id => 1) | |
project.start = "2012-08-03" | |
project.stop = "2012-08-10" | |
assert project.valid? | |
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
class User < ActiveRecord::Base | |
has_and_belongs_to_many :roles | |
accepts_nested_attributes_for :roles | |
has_many :carts | |
# Include default devise modules. Others available are: | |
# :token_authenticatable, :confirmable, | |
# :lockable, :timeoutable and :omniauthable |
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 Role < ActiveRecord::Base | |
has_and_belongs_to_many :users | |
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
<div id="left_dashboard_column"> | |
<div class="div_interno" id="projects_by_institution"> | |
<h2>Progetti attivi</h2> | |
<%= render 'projects/nextbyinstitution' %> | |
<% if current_user.role? :super_admin %> | |
<%= link_to 'Elenco progetti', projects_path %> | | |
<%= link_to 'Nuovo progetto', new_project_path %> | |
<% end %> | |
</div> | |
</div> |
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
# POST /orders | |
# POST /orders.json | |
def create | |
@order = Order.new(params[:order]) | |
cart = session[:cart] | |
cart.each do | id, quantity | | |
item = Project.find_by_id(id) | |
@line_item = LineItem.new |