mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-10 23:07:47 +00:00
Renaming Enterprise.active to Enterprise.visible
This commit is contained in:
@@ -30,7 +30,7 @@ class Enterprise < ActiveRecord::Base
|
||||
after_validation :geocode_address
|
||||
|
||||
scope :by_name, order('name')
|
||||
scope :active, where(:active => true)
|
||||
scope :visible, where(:visible => true)
|
||||
scope :is_primary_producer, where(:is_primary_producer => true)
|
||||
scope :is_distributor, where(:is_distributor => true)
|
||||
scope :supplying_variant_in, lambda { |variants| joins(:supplied_products => :variants_including_master).where('spree_variants.id IN (?)', variants).select('DISTINCT enterprises.*') }
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
= f.check_box :is_distributor
|
||||
= f.label :is_distributor, 'Hub'
|
||||
|
||||
= f.check_box :active
|
||||
= f.label :active, 'Active?'
|
||||
= f.check_box :visible
|
||||
= f.label :visible, 'Visible in search?'
|
||||
|
||||
.with-tip{'data-powertip' => "Select 'Producer' if you are a primary producer of food. Select 'Hub' if you want a shop-front. You can choose either or both."}
|
||||
%a What's this?
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class RenameActiveToVisibleOnEnterprises < ActiveRecord::Migration
|
||||
def change
|
||||
rename_column :enterprises, :active, :visible
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20140425055718) do
|
||||
ActiveRecord::Schema.define(:version => 20140430020639) do
|
||||
|
||||
create_table "adjustment_metadata", :force => true do |t|
|
||||
t.integer "adjustment_id"
|
||||
@@ -230,7 +230,7 @@ ActiveRecord::Schema.define(:version => 20140425055718) do
|
||||
t.string "promo_image_content_type"
|
||||
t.integer "promo_image_file_size"
|
||||
t.datetime "promo_image_updated_at"
|
||||
t.boolean "active", :default => true
|
||||
t.boolean "visible", :default => true
|
||||
end
|
||||
|
||||
add_index "enterprises", ["address_id"], :name => "index_enterprises_on_address_id"
|
||||
|
||||
@@ -50,9 +50,9 @@ describe Enterprise do
|
||||
|
||||
describe 'active' do
|
||||
it 'find active enterprises' do
|
||||
d1 = create(:distributor_enterprise, active: false)
|
||||
d1 = create(:distributor_enterprise, visible: false)
|
||||
s1 = create(:supplier_enterprise)
|
||||
Enterprise.active.should == [s1]
|
||||
Enterprise.visible.should == [s1]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user