Permalink
Browse files

clean out unnecessary order methods and views

  • Loading branch information...
1 parent 87618b9 commit bc1f22ad2edd1f017c2e7383ab7499463a4a4cbd @rogergraves committed Apr 13, 2012
@@ -4,21 +4,7 @@ class OrdersController < ApplicationController
def index
@orders = Order.all
- respond_to do |format|
- format.html # index.html.erb
- format.json { render json: @orders }
- end
- end
-
- # GET /orders/1
- # GET /orders/1.json
- def show
- @order = Order.find(params[:id])
-
- respond_to do |format|
- format.html # show.html.erb
- format.json { render json: @order }
- end
+ redirect_to(new_order_path) unless @orders.length > 0
end
# GET /orders/new
@@ -34,11 +20,6 @@ def new
end
end
- # GET /orders/1/edit
- def edit
- @order = Order.find(params[:id])
- end
-
# POST /orders
# POST /orders.json
def create
@@ -47,14 +28,15 @@ def create
quotes = File.read("quotes.txt")
quote = quotes.split("\n").sample
- a = 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
- t = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
+ a = 'AC1660f10e3c574db28a14a2b65f27ed88'
+ t = 'f0ddd92db1ba63e4df656aae38aff69c'
@client = Twilio::REST::Client.new a, t
@client.account.sms.messages.create(
:from => '(415) 599-2671',
- :to => '(317) 519-2400',
+ # :to => '(317) 519-2400',
+ :to => '(925) 286-4589',
:body => "Yo Fred, #{@order.user.email} wants a #{@order.sandwich_name}. By the way, #{quote}"
)
@@ -66,22 +48,6 @@ def create
end
end
- # PUT /orders/1
- # PUT /orders/1.json
- def update
- @order = Order.find(params[:id])
-
- respond_to do |format|
- if @order.update_attributes(params[:order])
- format.html { redirect_to @order, notice: 'Order was successfully updated.' }
- format.json { head :no_content }
- else
- format.html { render action: "edit" }
- format.json { render json: @order.errors, status: :unprocessable_entity }
- end
- end
- end
-
# DELETE /orders/1
# DELETE /orders/1.json
def destroy
@@ -15,9 +15,10 @@
<%= f.hidden_field(:user_id) %>
</div>
-
+ <br /><br /><br />
+
<div class="field">
- <%= f.label "Make my sandwich" %><br />
+ <%= f.label "Make my please, and make it" %><br />
<%= f.collection_select(:sandwich_name, @sandwiches, :name, :name) %>
</div>
<div class="actions">
@@ -1,6 +0,0 @@
-<h1>Editing order</h1>
-
-<%= render 'form' %>
-
-<%= link_to 'Show', @order %> |
-<%= link_to 'Back', orders_path %>
@@ -1,4 +1,4 @@
-<h1>New order</h1>
+<h1>Gimme my Sandwich, Chucky!</h1>
<%= render 'form' %>
@@ -1,15 +0,0 @@
-<p id="notice"><%= notice %></p>
-
-<p>
- <b>User:</b>
- <%= @order.user_id %>
-</p>
-
-<p>
- <b>Sandwich:</b>
- <%= @order.sandwich_name %>
-</p>
-
-
-<%= link_to 'Edit', edit_order_path(@order) %> |
-<%= link_to 'Back', orders_path %>

0 comments on commit bc1f22a

Please sign in to comment.