Permalink
Browse files

changes

  • Loading branch information...
1 parent ffcb1df commit 147531b83d53327759415a89d95c6ea46c5fcb0a @timothyf committed Mar 15, 2011
View
28 app/controllers/event_reviews_controller.rb
@@ -1,47 +1,39 @@
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.'
@@ -54,11 +46,9 @@ def create
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.'
@@ -71,15 +61,15 @@ def update
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
4 app/models/document.rb
@@ -1,2 +1,6 @@
class Document < ActiveRecord::Base
+
+ belongs_to :user
+ belongs_to :group
+
end
View
1 app/models/event.rb
@@ -43,6 +43,7 @@ class Event < ActiveRecord::Base
has_one :profile_photo
belongs_to :user # the creator
has_many :wall_posts, :order=>'created_at DESC'
+ has_many :event_reviews
validates_presence_of :start_time, :end_time, :name
View
4 app/models/event_review.rb
@@ -1,2 +1,6 @@
class EventReview < ActiveRecord::Base
+
+ belongs_to :event
+ belongs_to :user
+
end
View
1 app/models/group.rb
@@ -38,6 +38,7 @@ class Group < ActiveRecord::Base
has_one :profile_photo
has_many :wall_posts, :order=>'created_at DESC'
has_many :ideas
+ has_many :documents
has_many :permissions
has_many :admins, :source=>:user, :through => :permissions
View
2 app/models/user.rb
@@ -27,12 +27,14 @@ class User < ActiveRecord::Base
has_many :groups, :through => :memberships
has_many :likes
+ has_many :documents
# TODO:
# Add a condition to only get the attendances set in the future.
# Do not get attendances for past events
has_many :attendances, :foreign_key =>'attendee_id', :dependent => :destroy
has_many :events, :through => :attendances
+ has_many :event_reviews
has_many :sent_messages, :class_name => 'Message', :foreign_key =>'sender_id', :order=>'created_at DESC'
has_many :received_messages, :class_name => 'Message', :foreign_key =>'recipient_id', :order=>'created_at DESC'
View
2 app/views/widgets/ideas_group.html.erb
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
%>
<%
- widget_title = "Ideas"
+ widget_title = "Group Ideas"
@group = Group.find(@group_id)
@ideas = @group.ideas
View
6 db/migrate/20101119204114_create_event_reviews.rb
@@ -1,7 +1,11 @@
class CreateEventReviews < ActiveRecord::Migration
def self.up
create_table :event_reviews do |t|
-
+ t.references :event
+ t.references :group
+ t.references :user
+ t.string :title
+ t.text :body
t.timestamps
end
end
View
21 db/schema.rb
@@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20100707160333) do
+ActiveRecord::Schema.define(:version => 20101119204114) do
create_table "activities", :force => true do |t|
t.integer "user_id"
@@ -146,13 +146,30 @@
t.datetime "updated_at"
end
+ create_table "documents", :force => true do |t|
+ t.string "document_file_name"
+ t.string "document_content_type"
+ t.integer "document_file_size"
+ t.datetime "document_updated_at"
+ t.integer "user_id"
+ t.integer "group_id"
+ t.integer "event_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
create_table "domain_themes", :force => true do |t|
t.string "uri"
t.string "name"
end
add_index "domain_themes", ["uri"], :name => "index_domain_themes_on_uri"
+ create_table "event_reviews", :force => true do |t|
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
create_table "events", :force => true do |t|
t.string "name"
t.integer "user_id"
@@ -169,6 +186,7 @@
t.string "organized_by"
t.datetime "created_at"
t.datetime "updated_at"
+ t.integer "group_id"
end
create_table "ey_modules", :force => true do |t|
@@ -248,6 +266,7 @@
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
+ t.integer "group_id"
end
create_table "invites", :force => true do |t|
View
4 lib/tasks/ruby_mi_populate.rake
@@ -420,6 +420,9 @@ namespace :enginey do
mod = EyModule.create(:name => 'wall_posts')
Widget.create(:ey_module_id => mod.id, :name => 'wall_posts_group', :description => 'Wall posts for a group', :profile => false)
+ mod = EyModule.create(:name => 'event_reviews')
+ Widget.create(:ey_module_id => mod.id, :name => 'event_reviews_group', :description => 'Event reviews for a group', :profile => false)
+
##########################################################################
# Create Pages
puts 'Creating pages...'
@@ -498,6 +501,7 @@ namespace :enginey do
WidgetLayout.create(:widget_id => Widget.find_by_name("announcements_group").id, :page_id => group_pg.id, :col_num => 2)
WidgetLayout.create(:widget_id => Widget.find_by_name("events_group").id, :page_id => group_pg.id, :col_num => 3)
WidgetLayout.create(:widget_id => Widget.find_by_name("ideas_group").id, :page_id => group_pg.id, :col_num => 3)
+ WidgetLayout.create(:widget_id => Widget.find_by_name("event_reviews_group").id, :page_id => group_pg.id, :col_num => 3)
puts 'Database population done!'
end

0 comments on commit 147531b

Please sign in to comment.