Skip to content

Conversation

@cxasper
Copy link
Contributor

@cxasper cxasper commented Feb 12, 2018

No description provided.

validates :start_date, presence: true
validates :finish_date, presence: true
belongs_to :space
has_many :contract_spaces
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has_and_belongs_to_many :spaces

http://guides.rubyonrails.org/association_basics.html#the-has-many-association
2.6 The has_and_belongs_to_many Association
A has_and_belongs_to_many association creates a direct many-to-many connection with another model, with no intervening model. For example, if your application includes assemblies and parts, with each assembly having many parts and each part appearing in many assemblies, you could declare the models this way:

@@ -0,0 +1,5 @@
# ContractSpace
class ContractSpace < ApplicationRecord
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esta clase no es necesaria.

has_many :children, inverse_of: :parent, foreign_key: :space_id, class_name: 'Space'
has_many :contracts
has_many :assets
has_many :contract_spaces
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has_and_belongs_to_many :contracts

http://guides.rubyonrails.org/association_basics.html#the-has-many-association
2.6 The has_and_belongs_to_many Association
A has_and_belongs_to_many association creates a direct many-to-many connection with another model, with no intervening model. For example, if your application includes assemblies and parts, with each assembly having many parts and each part appearing in many assemblies, you could declare the models this way:

t.datetime "updated_at", null: false
end

create_table "payments", force: :cascade do |t|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+  create_table "payments", force: :cascade do |t|
 -    t.integer "payment"
 +    t.date "due_date"
 +    t.date "payment_date"
 -    t.date "warning_date"
 +    t.decimal "amount"
 +    t.string "status"
 +    t.text "note"

require 'rails_helper'

RSpec.describe Payment, type: :model do
it 'is valid with a payment, payment date, quantity and status' do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactorizar en 1 sola linea de código.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

end
end

# def generate_full_name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nunca incluir código comentado.

protected

def generate_full_name
new_name = name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new_name, next_parent = name, parent

def generate_full_name
new_name = name
next_parent = parent
while next_parent
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new_name, next_parent = "#{parent.name} | #{new_name}", next_parent.parent while next_parent

@@ -0,0 +1,5 @@
class RemoveReferencesOnContract < ActiveRecord::Migration[5.1]
def change
remove_reference(:contracts, :space, index: true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identación

# history_show
end
config.model 'User' do
list do
Copy link
Member

@lshimokawa lshimokawa Feb 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config.model 'User' { list { configure :id { hide } } }

@lshimokawa
Copy link
Member

@cxasper finish this PR to merge it to master.

@lshimokawa
Copy link
Member

@cxasper status? merge this PR to master

@moisesnandres
Copy link
Contributor

moisesnandres commented Apr 6, 2018

@cxasper status?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants