Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def index
- if params[:query]
- @posts = Post.search(params[:query])
- else
- @posts = Post.find(:all)
- end
- respond_to do |format|
- format.html # index.html.erb
- format.xml { render :xml => @posts }
- end
- end
- <% form_tag posts_path, :method => :get do %>
- <p>
- <%= text_field_tag "query", "size" => 30 %>
- </p>
- <p>
- <%= submit_tag "Search" %>
- </p>
- <% end %>
Add Comment
Please, Sign In to add comment