Browse Source

expose is awesome

denney-disable-on-select
Jason Denney 12 years ago
parent
commit
4ae03fc563
  1. 11
      app/controllers/bike_brands_controller.rb
  2. 11
      app/controllers/bike_models_controller.rb

11
app/controllers/bike_brands_controller.rb

@ -1,14 +1,5 @@
class BikeBrandsController < AuthenticatedController class BikeBrandsController < AuthenticatedController
expose(:bike_brand) do expose(:bike_brand)
if params[:id]
BikeBrand.find(params[:id])
elsif params[:bike_brand]
BikeBrand.new(params[:bike_brand])
else
BikeBrand.new
end
end
expose(:bike_brands) { BikeBrand.order('id').paginate(:page => params[:page]) } expose(:bike_brands) { BikeBrand.order('id').paginate(:page => params[:page]) }
def index def index

11
app/controllers/bike_models_controller.rb

@ -1,14 +1,5 @@
class BikeModelsController < AuthenticatedController class BikeModelsController < AuthenticatedController
expose(:bike_model) do expose(:bike_model)
if params[:id]
BikeModel.find(params[:id])
elsif params[:bike_model]
BikeModel.new(params[:bike_model])
else
BikeModel.new
end
end
expose(:bike_models) { BikeModel.order('id').paginate(:page => params[:page]) } expose(:bike_models) { BikeModel.order('id').paginate(:page => params[:page]) }
def index def index

Loading…
Cancel
Save