Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding support for event reviews

  • Loading branch information...
commit 34e4c8977bd8e1858ec08c59e649de8671264e1d 1 parent e5da10d
@timothyf authored
View
85 app/controllers/event_reviews_controller.rb
@@ -0,0 +1,85 @@
+class EventReviewsController < ApplicationController
+ # GET /event_reviews
+ # GET /event_reviews.xml
+ def index
+ @event_reviews = EventReview.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @event_reviews }
+ end
+ end
+
+ # GET /event_reviews/1
+ # GET /event_reviews/1.xml
+ def show
+ @event_review = EventReview.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @event_review }
+ end
+ end
+
+ # GET /event_reviews/new
+ # GET /event_reviews/new.xml
+ def new
+ @event_review = EventReview.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @event_review }
+ end
+ end
+
+ # GET /event_reviews/1/edit
+ def edit
+ @event_review = EventReview.find(params[:id])
+ end
+
+ # POST /event_reviews
+ # POST /event_reviews.xml
+ def create
+ @event_review = EventReview.new(params[:event_review])
+
+ respond_to do |format|
+ if @event_review.save
+ flash[:notice] = 'EventReview was successfully created.'
+ format.html { redirect_to(@event_review) }
+ format.xml { render :xml => @event_review, :status => :created, :location => @event_review }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @event_review.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /event_reviews/1
+ # PUT /event_reviews/1.xml
+ def update
+ @event_review = EventReview.find(params[:id])
+
+ respond_to do |format|
+ if @event_review.update_attributes(params[:event_review])
+ flash[:notice] = 'EventReview was successfully updated.'
+ format.html { redirect_to(@event_review) }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @event_review.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /event_reviews/1
+ # DELETE /event_reviews/1.xml
+ def destroy
+ @event_review = EventReview.find(params[:id])
+ @event_review.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(event_reviews_url) }
+ format.xml { head :ok }
+ end
+ end
+end
View
2  app/helpers/event_reviews_helper.rb
@@ -0,0 +1,2 @@
+module EventReviewsHelper
+end
View
2  app/models/event_review.rb
@@ -0,0 +1,2 @@
+class EventReview < ActiveRecord::Base
+end
View
12 app/views/event_reviews/edit.html.erb
@@ -0,0 +1,12 @@
+<h1>Editing event_review</h1>
+
+<% form_for(@event_review) do |f| %>
+ <%= f.error_messages %>
+
+ <p>
+ <%= f.submit 'Update' %>
+ </p>
+<% end %>
+
+<%= link_to 'Show', @event_review %> |
+<%= link_to 'Back', event_reviews_path %>
View
18 app/views/event_reviews/index.html.erb
@@ -0,0 +1,18 @@
+<h1>Listing event_reviews</h1>
+
+<table>
+ <tr>
+ </tr>
+
+<% @event_reviews.each do |event_review| %>
+ <tr>
+ <td><%= link_to 'Show', event_review %></td>
+ <td><%= link_to 'Edit', edit_event_review_path(event_review) %></td>
+ <td><%= link_to 'Destroy', event_review, :confirm => 'Are you sure?', :method => :delete %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'New event_review', new_event_review_path %>
View
11 app/views/event_reviews/new.html.erb
@@ -0,0 +1,11 @@
+<h1>New event_review</h1>
+
+<% form_for(@event_review) do |f| %>
+ <%= f.error_messages %>
+
+ <p>
+ <%= f.submit 'Create' %>
+ </p>
+<% end %>
+
+<%= link_to 'Back', event_reviews_path %>
View
3  app/views/event_reviews/show.html.erb
@@ -0,0 +1,3 @@
+
+<%= link_to 'Edit', edit_event_review_path(@event_review) %> |
+<%= link_to 'Back', event_reviews_path %>
View
2  config/routes.rb
@@ -1,4 +1,6 @@
ActionController::Routing::Routes.draw do |map|
+ map.resources :event_reviews
+
map.resources :documents
map.resources :nav_items
View
12 db/migrate/20101119204114_create_event_reviews.rb
@@ -0,0 +1,12 @@
+class CreateEventReviews < ActiveRecord::Migration
+ def self.up
+ create_table :event_reviews do |t|
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :event_reviews
+ end
+end
View
7 test/fixtures/event_reviews.yml
@@ -0,0 +1,7 @@
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
+
+# one:
+# column: value
+#
+# two:
+# column: value
View
45 test/functional/event_reviews_controller_test.rb
@@ -0,0 +1,45 @@
+require 'test_helper'
+
+class EventReviewsControllerTest < ActionController::TestCase
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:event_reviews)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create event_review" do
+ assert_difference('EventReview.count') do
+ post :create, :event_review => { }
+ end
+
+ assert_redirected_to event_review_path(assigns(:event_review))
+ end
+
+ test "should show event_review" do
+ get :show, :id => event_reviews(:one).to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, :id => event_reviews(:one).to_param
+ assert_response :success
+ end
+
+ test "should update event_review" do
+ put :update, :id => event_reviews(:one).to_param, :event_review => { }
+ assert_redirected_to event_review_path(assigns(:event_review))
+ end
+
+ test "should destroy event_review" do
+ assert_difference('EventReview.count', -1) do
+ delete :destroy, :id => event_reviews(:one).to_param
+ end
+
+ assert_redirected_to event_reviews_path
+ end
+end
View
8 test/unit/event_review_test.rb
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class EventReviewTest < ActiveSupport::TestCase
+ # Replace this with your real tests.
+ test "the truth" do
+ assert true
+ end
+end
View
4 test/unit/helpers/event_reviews_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class EventReviewsHelperTest < ActionView::TestCase
+end
Please sign in to comment.
Something went wrong with that request. Please try again.