Class: AddressSearchesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- AddressSearchesController
- Defined in:
- app/controllers/address_searches_controller.rb
Overview
typed: false
Instance Method Summary collapse
-
#create ⇒ Object
POST /address_searches POST /address_searches.json.
-
#destroy ⇒ Object
DELETE /address_searches/1 DELETE /address_searches/1.json.
-
#edit ⇒ Object
GET /address_searches/1/edit.
-
#index ⇒ Object
GET /address_searches GET /address_searches.json.
-
#new ⇒ Object
GET /address_searches/new.
-
#show ⇒ Object
GET /address_searches/1 GET /address_searches/1.json.
-
#update ⇒ Object
PATCH/PUT /address_searches/1 PATCH/PUT /address_searches/1.json.
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
POST /address_searches POST /address_searches.json
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/address_searches_controller.rb', line 29 def create @address_search = AddressSearch.new(address_search_params) respond_to do |format| if @address_search.save format.html { redirect_to @address_search, notice: 'Address search was successfully created.' } format.json { render :show, status: :created, location: @address_search } else format.html { render :new } format.json { render json: @address_search.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /address_searches/1 DELETE /address_searches/1.json
59 60 61 62 63 64 65 |
# File 'app/controllers/address_searches_controller.rb', line 59 def destroy @address_search.destroy respond_to do |format| format.html { redirect_to address_searches_url, notice: 'Address search was successfully destroyed.' } format.json { head :no_content } end end |
#edit ⇒ Object
GET /address_searches/1/edit
24 25 |
# File 'app/controllers/address_searches_controller.rb', line 24 def edit end |
#index ⇒ Object
GET /address_searches GET /address_searches.json
7 8 9 |
# File 'app/controllers/address_searches_controller.rb', line 7 def index @address_searches = AddressSearch.all end |
#new ⇒ Object
GET /address_searches/new
19 20 21 |
# File 'app/controllers/address_searches_controller.rb', line 19 def new @address_search = AddressSearch.new end |
#show ⇒ Object
GET /address_searches/1 GET /address_searches/1.json
13 14 15 16 |
# File 'app/controllers/address_searches_controller.rb', line 13 def show search_url = "https://seeiendom.kartverket.no/api/soekEtterEiendom?searchstring=#{CGI.escape(@address_search.search_string)}" @search_result_json = HTTParty.get(search_url) end |
#update ⇒ Object
PATCH/PUT /address_searches/1 PATCH/PUT /address_searches/1.json
45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/address_searches_controller.rb', line 45 def update respond_to do |format| if @address_search.update(address_search_params) format.html { redirect_to @address_search, notice: 'Address search was successfully updated.' } format.json { render :show, status: :ok, location: @address_search } else format.html { render :edit } format.json { render json: @address_search.errors, status: :unprocessable_entity } end end end |