nil, "body"=>nil, "id"=>"1"}>
+ >> f.
+ Display all 152 possibilities? (y or n)
+
+Finally, when you're ready to resume execution, you can enter "cont".
+
+
+== Console
+
+The console is a Ruby shell, which allows you to interact with your
+application's domain model. Here you'll have all parts of the application
+configured, just like it is when the application is running. You can inspect
+domain models, change values, and save to the database. Starting the script
+without arguments will launch it in the development environment.
+
+To start the console, run rails console from the application
+directory.
+
+Options:
+
+* Passing the -s, --sandbox argument will rollback any modifications
+ made to the database.
+* Passing an environment name as an argument will load the corresponding
+ environment. Example: rails console production.
+
+To reload your controllers and models after launching the console run
+reload!
+
+More information about irb can be found at:
+link:http://www.rubycentral.org/pickaxe/irb.html
+
+
+== dbconsole
+
+You can go to the command line of your database directly through rails
+dbconsole. You would be connected to the database with the credentials
+defined in database.yml. Starting the script without arguments will connect you
+to the development database. Passing an argument will connect you to a different
+database, like rails dbconsole production. Currently works for MySQL,
+PostgreSQL and SQLite 3.
+
+== Description of Contents
+
+The default directory structure of a generated Ruby on Rails application:
+
+ |-- app
+ | |-- assets
+ | |-- images
+ | |-- javascripts
+ | `-- stylesheets
+ | |-- controllers
+ | |-- helpers
+ | |-- mailers
+ | |-- models
+ | `-- views
+ | `-- layouts
+ |-- config
+ | |-- environments
+ | |-- initializers
+ | `-- locales
+ |-- db
+ |-- doc
+ |-- lib
+ | `-- tasks
+ |-- log
+ |-- public
+ |-- script
+ |-- test
+ | |-- fixtures
+ | |-- functional
+ | |-- integration
+ | |-- performance
+ | `-- unit
+ |-- tmp
+ | |-- cache
+ | |-- pids
+ | |-- sessions
+ | `-- sockets
+ `-- vendor
+ |-- assets
+ `-- stylesheets
+ `-- plugins
+
+app
+ Holds all the code that's specific to this particular application.
+
+app/assets
+ Contains subdirectories for images, stylesheets, and JavaScript files.
+
+app/controllers
+ Holds controllers that should be named like weblogs_controller.rb for
+ automated URL mapping. All controllers should descend from
+ ApplicationController which itself descends from ActionController::Base.
+
+app/models
+ Holds models that should be named like post.rb. Models descend from
+ ActiveRecord::Base by default.
+
+app/views
+ Holds the template files for the view that should be named like
+ weblogs/index.html.erb for the WeblogsController#index action. All views use
+ eRuby syntax by default.
+
+app/views/layouts
+ Holds the template files for layouts to be used with views. This models the
+ common header/footer method of wrapping views. In your views, define a layout
+ using the layout :default and create a file named default.html.erb.
+ Inside default.html.erb, call <% yield %> to render the view using this
+ layout.
+
+app/helpers
+ Holds view helpers that should be named like weblogs_helper.rb. These are
+ generated for you automatically when using generators for controllers.
+ Helpers can be used to wrap functionality for your views into methods.
+
+config
+ Configuration files for the Rails environment, the routing map, the database,
+ and other dependencies.
+
+db
+ Contains the database schema in schema.rb. db/migrate contains all the
+ sequence of Migrations for your schema.
+
+doc
+ This directory is where your application documentation will be stored when
+ generated using rake doc:app
+
+lib
+ Application specific libraries. Basically, any kind of custom code that
+ doesn't belong under controllers, models, or helpers. This directory is in
+ the load path.
+
+public
+ The directory available for the web server. Also contains the dispatchers and the
+ default HTML files. This should be set as the DOCUMENT_ROOT of your web
+ server.
+
+script
+ Helper scripts for automation and generation.
+
+test
+ Unit and functional tests along with fixtures. When using the rails generate
+ command, template test files will be generated for you and placed in this
+ directory.
+
+vendor
+ External libraries that the application depends on. Also includes the plugins
+ subdirectory. If the app has frozen rails, those gems also go here, under
+ vendor/rails/. This directory is in the load path.
diff --git a/Rakefile b/Rakefile
index 5fc954f..2119925 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,7 +1,7 @@
+#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
-require 'rake'
Community::Application.load_tasks
diff --git a/public/images/black_stripe.png b/app/assets/images/black_stripe.png
old mode 100644
new mode 100755
similarity index 100%
rename from public/images/black_stripe.png
rename to app/assets/images/black_stripe.png
diff --git a/public/images/icon_notification_attention.png b/app/assets/images/icon_notification_attention.png
similarity index 100%
rename from public/images/icon_notification_attention.png
rename to app/assets/images/icon_notification_attention.png
diff --git a/public/images/icon_notification_error.png b/app/assets/images/icon_notification_error.png
similarity index 100%
rename from public/images/icon_notification_error.png
rename to app/assets/images/icon_notification_error.png
diff --git a/public/images/icon_notification_information.png b/app/assets/images/icon_notification_information.png
similarity index 100%
rename from public/images/icon_notification_information.png
rename to app/assets/images/icon_notification_information.png
diff --git a/public/images/icon_notification_note.png b/app/assets/images/icon_notification_note.png
similarity index 100%
rename from public/images/icon_notification_note.png
rename to app/assets/images/icon_notification_note.png
diff --git a/public/images/icon_notification_success.png b/app/assets/images/icon_notification_success.png
similarity index 100%
rename from public/images/icon_notification_success.png
rename to app/assets/images/icon_notification_success.png
diff --git a/public/images/rails.png b/app/assets/images/rails.png
old mode 100644
new mode 100755
similarity index 100%
rename from public/images/rails.png
rename to app/assets/images/rails.png
diff --git a/public/images/ruby.png b/app/assets/images/ruby.png
old mode 100644
new mode 100755
similarity index 100%
rename from public/images/ruby.png
rename to app/assets/images/ruby.png
diff --git a/public/images/white_stripe.png b/app/assets/images/white_stripe.png
old mode 100644
new mode 100755
similarity index 100%
rename from public/images/white_stripe.png
rename to app/assets/images/white_stripe.png
diff --git a/public/javascripts/application.js b/app/assets/javascripts/application.js
old mode 100644
new mode 100755
similarity index 88%
rename from public/javascripts/application.js
rename to app/assets/javascripts/application.js
index fe45776..965c462
--- a/public/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -1,2 +1,3 @@
// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
+//= require_tree .
diff --git a/public/javascripts/controls.js b/app/assets/javascripts/controls.js
old mode 100644
new mode 100755
similarity index 100%
rename from public/javascripts/controls.js
rename to app/assets/javascripts/controls.js
diff --git a/public/javascripts/dragdrop.js b/app/assets/javascripts/dragdrop.js
old mode 100644
new mode 100755
similarity index 100%
rename from public/javascripts/dragdrop.js
rename to app/assets/javascripts/dragdrop.js
diff --git a/public/javascripts/effects.js b/app/assets/javascripts/effects.js
old mode 100644
new mode 100755
similarity index 100%
rename from public/javascripts/effects.js
rename to app/assets/javascripts/effects.js
diff --git a/public/javascripts/prototype.js b/app/assets/javascripts/prototype.js
old mode 100644
new mode 100755
similarity index 100%
rename from public/javascripts/prototype.js
rename to app/assets/javascripts/prototype.js
diff --git a/public/javascripts/rails.js b/app/assets/javascripts/rails.js
old mode 100644
new mode 100755
similarity index 100%
rename from public/javascripts/rails.js
rename to app/assets/javascripts/rails.js
diff --git a/public/stylesheets/.gitkeep b/app/assets/stylesheets/.gitkeep
old mode 100644
new mode 100755
similarity index 100%
rename from public/stylesheets/.gitkeep
rename to app/assets/stylesheets/.gitkeep
diff --git a/public/stylesheets/application.css b/app/assets/stylesheets/application.css.scss
old mode 100644
new mode 100755
similarity index 98%
rename from public/stylesheets/application.css
rename to app/assets/stylesheets/application.css.scss
index 1ab4d2a..cc3cdd8
--- a/public/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css.scss
@@ -1,3 +1,8 @@
+/*
+ *= require_self
+ *= require_tree .
+ */
+
body {
font-family: Verdana, Helvetica, Arial;
font-size: 12px;
diff --git a/public/stylesheets/forum-monster.css b/app/assets/stylesheets/forum-monster.css.scss
old mode 100644
new mode 100755
similarity index 100%
rename from public/stylesheets/forum-monster.css
rename to app/assets/stylesheets/forum-monster.css.scss
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
old mode 100644
new mode 100755
diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb
old mode 100644
new mode 100755
diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb
old mode 100644
new mode 100755
diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb
old mode 100644
new mode 100755
diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb
old mode 100644
new mode 100755
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
new file mode 100755
index 0000000..4d2c251
--- /dev/null
+++ b/app/controllers/users_controller.rb
@@ -0,0 +1,95 @@
+class UsersController < ApplicationController
+
+ before_filter :authenticate_user!
+ before_filter :is_admin?
+
+ # GET /users
+ # GET /users.json
+ def index
+ @users = User.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render :json => @users }
+ end
+ end
+
+
+ # GET /users/1
+ # GET /users/1.json
+ def show
+ @user = User.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render :json => @user }
+ end
+ end
+
+ # GET /users/new
+ # GET /users/new.json
+ def new
+ @user = User.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render :json => @user }
+ end
+ end
+
+ # GET /users/1/edit
+ def edit
+ @user = User.find(params[:id])
+ end
+
+ # POST /users
+ # POST /users.json
+ def create
+ @user = User.new(params[:user])
+
+ respond_to do |format|
+ if @user.save
+ format.html { redirect_to @user, :notice => 'User was successfully created.' }
+ format.json { render :json => @user, :status => :created, :location => @user }
+ else
+ format.html { render :action => "new" }
+ format.json { render :json => @user.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /users/1
+ # PUT /users/1.json
+ def update
+ @user = User.find(params[:id])
+
+ respond_to do |format|
+ if @user.update_attributes(params[:user])
+ format.html { redirect_to @user, :notice => 'User was successfully updated.' }
+ format.json { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.json { render :json => @user.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /users/1
+ # DELETE /users/1.json
+ def destroy
+ @user = User.find(params[:id])
+ @user.destroy
+
+ respond_to do |format|
+ format.html { redirect_to users_url }
+ format.json { head :ok }
+ end
+ end
+
+ def is_admin?
+ unless (current_user && current_user.admin?)
+ flash[:error] = 'You are not an Admin'
+ redirect_to root_path
+ end
+ end
+end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
old mode 100644
new mode 100755
diff --git a/app/helpers/error_messages_helper.rb b/app/helpers/error_messages_helper.rb
old mode 100644
new mode 100755
diff --git a/app/helpers/layout_helper.rb b/app/helpers/layout_helper.rb
old mode 100644
new mode 100755
diff --git a/app/models/topic.rb b/app/models/topic.rb
index 8704e7c..b7d2505 100644
--- a/app/models/topic.rb
+++ b/app/models/topic.rb
@@ -28,7 +28,7 @@ class Topic < ActiveRecord::Base
private
def create_initial_post
- returning self.posts.build(:body => self.body) do |post|
+ self.posts.build(:body => self.body).tap do |post|
post.forum = self.forum
post.user = self.user
post.save
diff --git a/app/views/categories/_form.html.erb b/app/views/categories/_form.html.erb
old mode 100644
new mode 100755
diff --git a/app/views/categories/edit.html.erb b/app/views/categories/edit.html.erb
old mode 100644
new mode 100755
diff --git a/app/views/categories/index.html.erb b/app/views/categories/index.html.erb
old mode 100644
new mode 100755
diff --git a/app/views/categories/new.html.erb b/app/views/categories/new.html.erb
old mode 100644
new mode 100755
diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb
old mode 100644
new mode 100755
diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb
old mode 100644
new mode 100755
diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb
old mode 100644
new mode 100755
diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb
old mode 100644
new mode 100755
diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb
old mode 100644
new mode 100755
diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb
old mode 100644
new mode 100755
diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb
old mode 100644
new mode 100755
index 7e19228..d5f1d0d
--- a/app/views/devise/registrations/edit.html.erb
+++ b/app/views/devise/registrations/edit.html.erb
@@ -6,6 +6,11 @@
<%= f.label :email %>
<%= f.email_field :email %>
+ <% if current_user.admin? %>
+ <%= f.label :is_admin %>
+ <%= f.check_box :is_admin, {checked: resource.admin?} %>
+ <% end %>
+
<%= f.label :password %> (leave blank if you don't want to change it)
<%= f.password_field :password %>
diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb
old mode 100644
new mode 100755
index 99a3809..c241b63
--- a/app/views/devise/registrations/new.html.erb
+++ b/app/views/devise/registrations/new.html.erb
@@ -1,8 +1,7 @@
-
Welcome to Forum Monster
-
Forum Monster is a simple forum generator written in rails 3. The goal of Forum Monster, is to provide a simple, and easy to setup forum application without having to dictate how your site it setup.
-
The email field is required, but none of the data is saved for more than a day. Feel free to put in a fake address.
+
Welcome to Horses
+ <%= devise_error_messages! %>
<%= form_for("user", :as => resource_name, :url => registration_path("user")) do |f| %>
@@ -26,4 +25,4 @@
<% end %>
-
\ No newline at end of file
+
diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb
old mode 100644
new mode 100755
index 83752f4..a9e81c7
--- a/app/views/devise/sessions/new.html.erb
+++ b/app/views/devise/sessions/new.html.erb
@@ -19,13 +19,7 @@
-
Welcome to Forum Monster
-
- Forum Monster is a simple forum generator written in rails 3. The goal of Forum Monster, is to provide a simple, and easy to setup forum application without having to dictate how your site it setup.
-
You can login with the following information:
-
Admin Demo: admin/forum_admin
-
User Demo: user/forum_user
-
+
Welcome to Horses
<%= form_for("user", :url => user_session_path) do |f| %>
@@ -35,4 +29,4 @@
<% end %>
-
\ No newline at end of file
+
diff --git a/app/views/devise/shared/_links.erb b/app/views/devise/shared/_links.erb
old mode 100644
new mode 100755
diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb
old mode 100644
new mode 100755
diff --git a/app/views/forums/_form.html.erb b/app/views/forums/_form.html.erb
old mode 100644
new mode 100755
diff --git a/app/views/forums/edit.html.erb b/app/views/forums/edit.html.erb
old mode 100644
new mode 100755
diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb
old mode 100644
new mode 100755
diff --git a/app/views/forums/new.html.erb b/app/views/forums/new.html.erb
old mode 100644
new mode 100755
diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb
old mode 100644
new mode 100755
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
old mode 100644
new mode 100755
index 3add08e..3f03776
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -1,30 +1,27 @@
- <%= content_for?(:title) ? yield(:title) : "Untitled" %>
+ <%= content_for?(:title) ? yield(:title) : "Horses" %>
<%= stylesheet_link_tag "application", "forum-monster" %>
- <%= javascript_include_tag :defaults %>
<%= csrf_meta_tag %>
<%= yield(:head) %>
-
-
-
- <%= content_tag :div, "This is just a demo, the database is reset every 24 hours.", :class => "demo_notice" %>
-
-