diff --git a/app/models/enterprise.rb b/app/models/enterprise.rb index 916111bf21..5656f048c3 100644 --- a/app/models/enterprise.rb +++ b/app/models/enterprise.rb @@ -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.*') } diff --git a/app/views/admin/enterprises/_form.html.haml b/app/views/admin/enterprises/_form.html.haml index c38eb9b2a5..3158f464eb 100644 --- a/app/views/admin/enterprises/_form.html.haml +++ b/app/views/admin/enterprises/_form.html.haml @@ -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? diff --git a/db/migrate/20140430020639_rename_active_to_visible_on_enterprises.rb b/db/migrate/20140430020639_rename_active_to_visible_on_enterprises.rb new file mode 100644 index 0000000000..99b011304a --- /dev/null +++ b/db/migrate/20140430020639_rename_active_to_visible_on_enterprises.rb @@ -0,0 +1,5 @@ +class RenameActiveToVisibleOnEnterprises < ActiveRecord::Migration + def change + rename_column :enterprises, :active, :visible + end +end diff --git a/db/schema.rb b/db/schema.rb index 359326e90f..5df4ad8e56 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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" diff --git a/spec/models/enterprise_spec.rb b/spec/models/enterprise_spec.rb index 990829f1b1..6fc1913a8f 100644 --- a/spec/models/enterprise_spec.rb +++ b/spec/models/enterprise_spec.rb @@ -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