The modal
1: class SearchFor < ActiveRecord::Base2: attr_accessible :pharse3: end4:
The controller
1: class OperatorsController < ApplicationController2: # GET /operators3: # GET /operators.json4: def index5: @operators = Operator.all6: @searchP = SearchFor.new7: @searchP.pharse = "zvika"8:9: respond_to do |format|10: format.html # index.html.erb11: format.json { render json: @operators }12:13: end14: end
The view
1: <h2>Search for operator:</h2>2:3: <div class="field">4: <p>The search pharse: <%= @searchP.pharse%><br /></p>5: </div>6:
The result
http://localhost:3000/operators
אין תגובות:
הוסף רשומת תגובה