The modal
1: class SearchFor < ActiveRecord::Base
2: attr_accessible :pharse3: end
4:
The controller
1: class OperatorsController < ApplicationController
2: # GET /operators
3: # GET /operators.json
4: def index
5: @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: end
14: 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
אין תגובות:
הוסף רשומת תגובה