Class: BusinessSegmentsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/business_segments_controller.rb

Instance Method Summary collapse

Methods included from SessionsHelper

#preferences_customer_type=, #preferences_customer_type?, #signed_in?, #signed_in_user, #store_location

Instance Method Details

#createObject

POST /business_segments POST /business_segments.json



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'app/controllers/business_segments_controller.rb', line 47

def create
  #@business_segment = BusinessSegment.new(params[:business_segment])

  respond_to do |format|
    if @business_segment.save
      format.html { redirect_to @business_segment, notice: 'Business segment was successfully created.' }
      format.json { render json: @business_segment, status: :created, location: @business_segment }
    else
      format.html { render action: "new" }
      format.json { render json: @business_segment.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /business_segments/1 DELETE /business_segments/1.json



79
80
81
82
83
84
85
86
87
# File 'app/controllers/business_segments_controller.rb', line 79

def destroy
  #@business_segment = BusinessSegment.find(params[:id])
  @business_segment.destroy

  respond_to do |format|
    format.html { redirect_to business_segments_url }
    format.json { head :no_content }
  end
end

#updateObject

PUT /business_segments/1 PUT /business_segments/1.json



63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'app/controllers/business_segments_controller.rb', line 63

def update
  #@business_segment = BusinessSegment.find(params[:id])

  respond_to do |format|
    if @business_segment.update_attributes(params[:business_segment])
      format.html { redirect_to @business_segment, notice: 'Business segment was successfully updated.' }
      format.json { head :no_content }
    else
      format.html { render action: "edit" }
      format.json { render json: @business_segment.errors, status: :unprocessable_entity }
    end
  end
end