Removes geozone from budget heading
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
class Budget
|
||||
class Heading < ActiveRecord::Base
|
||||
belongs_to :group
|
||||
belongs_to :geozone
|
||||
|
||||
has_many :investments
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class Budget
|
||||
validates :heading_id, presence: true
|
||||
validates_presence_of :unfeasibility_explanation, if: :unfeasibility_explanation_required?
|
||||
|
||||
validates :title, length: { in: 4 .. Budget::Investment.title_max_length }
|
||||
validates :title, length: { in: 4..Budget::Investment.title_max_length }
|
||||
validates :description, length: { maximum: Budget::Investment.description_max_length }
|
||||
validates :terms_of_service, acceptance: { allow_nil: false }, on: :create
|
||||
|
||||
@@ -53,7 +53,7 @@ class Budget
|
||||
scope :by_tag, -> (tag_name) { tagged_with(tag_name) }
|
||||
scope :by_valuator, -> (valuator_id) { where("budget_valuator_assignments.valuator_id = ?", valuator_id).joins(:valuator_assignments) }
|
||||
|
||||
scope :for_render, -> { includes(heading: :geozone) }
|
||||
scope :for_render, -> { includes(:heading) }
|
||||
|
||||
before_save :calculate_confidence_score
|
||||
before_validation :set_responsible_name
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class RemoveGeozoneIdFromBudgetHeadings < ActiveRecord::Migration
|
||||
def change
|
||||
remove_column :budget_headings, :geozone_id
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20170102080432) do
|
||||
ActiveRecord::Schema.define(version: 20170103170147) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -107,9 +107,8 @@ ActiveRecord::Schema.define(version: 20170102080432) do
|
||||
|
||||
create_table "budget_headings", force: :cascade do |t|
|
||||
t.integer "group_id"
|
||||
t.integer "geozone_id"
|
||||
t.string "name", limit: 50
|
||||
t.integer "price", limit: 8
|
||||
t.string "name", limit: 50
|
||||
t.integer "price", limit: 8
|
||||
end
|
||||
|
||||
add_index "budget_headings", ["group_id"], name: "index_budget_headings_on_group_id", using: :btree
|
||||
|
||||
@@ -344,10 +344,8 @@ feature 'Budget Investments' do
|
||||
global_group = create(:budget_group, budget: budget, name: 'Global Group')
|
||||
global_heading = create(:budget_heading, group: global_group, name: 'Global Heading')
|
||||
|
||||
carabanchel = create(:geozone, name: "Carabanchel")
|
||||
new_york = create(:geozone, name: "New York")
|
||||
carabanchel_heading = create(:budget_heading, group: group, geozone: carabanchel, name: carabanchel.name)
|
||||
new_york_heading = create(:budget_heading, group: group, geozone: new_york, name: new_york.name)
|
||||
carabanchel_heading = create(:budget_heading, group: group, name: "Carabanchel")
|
||||
new_york_heading = create(:budget_heading, group: group, name: "New York")
|
||||
|
||||
|
||||
sp1 = create(:budget_investment, :selected, price: 1, heading: global_heading)
|
||||
|
||||
Reference in New Issue
Block a user