Class: PhcdevworksRealEstate::Property::FeaturesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/phcdevworks_real_estate/property/features_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /property/features



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/controllers/phcdevworks_real_estate/property/features_controller.rb', line 32

def create
  @property_feature = Property::Feature.new(property_feature_params)
  @property_feature.user_id = current_user.id
  @property_feature.org_id = current_user.org_id
  respond_to do |format|
    if @property_feature.save
      format.html { redirect_to property_features_path, :flash => { :success => 'Property Feature has been Added.' }}
      format.json { render :show, status: :created, location: @property_feature }
    else
      format.html { render :new }
      format.json { render json: @property_feature.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /property/features/1



61
62
63
64
65
66
67
# File 'app/controllers/phcdevworks_real_estate/property/features_controller.rb', line 61

def destroy
  @property_feature.destroy
  respond_to do |format|
    format.html { redirect_to property_features_path, :flash => { :error => 'Property Feature has been Removed.' }}
    format.json { head :no_content }
  end
end

#editObject

GET /property/features/1/edit



28
29
# File 'app/controllers/phcdevworks_real_estate/property/features_controller.rb', line 28

def edit
end

#indexObject

GET /property/features



13
14
15
# File 'app/controllers/phcdevworks_real_estate/property/features_controller.rb', line 13

def index
  @property_features = Property::Feature.all
end

#newObject

GET /property/features/new



23
24
25
# File 'app/controllers/phcdevworks_real_estate/property/features_controller.rb', line 23

def new
  @property_feature = Property::Feature.new
end

#showObject

GET /property/features/1



18
19
20
# File 'app/controllers/phcdevworks_real_estate/property/features_controller.rb', line 18

def show
  @property_feature = Property::Feature.friendly.find(params[:id])
end

#updateObject

PATCH/PUT /property/features/1



48
49
50
51
52
53
54
55
56
57
58
# File 'app/controllers/phcdevworks_real_estate/property/features_controller.rb', line 48

def update
  respond_to do |format|
    if @property_feature.update(property_feature_params)
      format.html { redirect_to property_features_path, :flash => { :notice => 'Property Feature has been Updated.' }}
      format.json { render :show, status: :ok, location: @property_feature }
    else
      format.html { render :edit }
      format.json { render json: @property_feature.errors, status: :unprocessable_entity }
    end
  end
end