From 3b81308d21f7e1e0c3ed3556cc2d361644497879 Mon Sep 17 00:00:00 2001 From: darko1002001 Date: Fri, 17 May 2013 15:55:34 +0200 Subject: [PATCH] Added crud --- Gemfile | 9 +- Gemfile.lock | 12 + app/assets/javascripts/categories.js.coffee | 3 + app/assets/javascripts/notes.js.coffee | 3 + app/assets/stylesheets/categories.css.scss | 3 + app/assets/stylesheets/notes.css.scss | 3 + app/assets/stylesheets/scaffolds.css.scss | 69 +++++ app/controllers/application_controller.rb | 7 + app/controllers/categories_controller.rb | 83 ++++++ app/controllers/notes_controller.rb | 92 +++++++ app/helpers/categories_helper.rb | 2 + app/helpers/notes_helper.rb | 2 + app/models/category.rb | 5 + app/models/note.rb | 5 + app/views/categories/_form.html.erb | 29 +++ app/views/categories/edit.html.erb | 6 + app/views/categories/index.html.erb | 27 ++ app/views/categories/new.html.erb | 5 + app/views/categories/show.html.erb | 20 ++ app/views/notes/_form.html.erb | 29 +++ app/views/notes/edit.html.erb | 6 + app/views/notes/index.html.erb | 27 ++ app/views/notes/new.html.erb | 5 + app/views/notes/show.html.erb | 20 ++ config/database.yml | 59 +---- config/initializers/rabl_init.rb | 20 ++ config/routes.rb | 8 +- .../20130517132549_create_categories.rb | 11 + db/migrate/20130517132622_create_notes.rb | 11 + .../20130517133318_add_category_id_to_note.rb | 5 + db/schema.rb | 33 +++ public/index.html | 241 ------------------ 32 files changed, 564 insertions(+), 296 deletions(-) create mode 100644 app/assets/javascripts/categories.js.coffee create mode 100644 app/assets/javascripts/notes.js.coffee create mode 100644 app/assets/stylesheets/categories.css.scss create mode 100644 app/assets/stylesheets/notes.css.scss create mode 100644 app/assets/stylesheets/scaffolds.css.scss create mode 100644 app/controllers/categories_controller.rb create mode 100644 app/controllers/notes_controller.rb create mode 100644 app/helpers/categories_helper.rb create mode 100644 app/helpers/notes_helper.rb create mode 100644 app/models/category.rb create mode 100644 app/models/note.rb create mode 100644 app/views/categories/_form.html.erb create mode 100644 app/views/categories/edit.html.erb create mode 100644 app/views/categories/index.html.erb create mode 100644 app/views/categories/new.html.erb create mode 100644 app/views/categories/show.html.erb create mode 100644 app/views/notes/_form.html.erb create mode 100644 app/views/notes/edit.html.erb create mode 100644 app/views/notes/index.html.erb create mode 100644 app/views/notes/new.html.erb create mode 100644 app/views/notes/show.html.erb create mode 100644 config/initializers/rabl_init.rb create mode 100644 db/migrate/20130517132549_create_categories.rb create mode 100644 db/migrate/20130517132622_create_notes.rb create mode 100644 db/migrate/20130517133318_add_category_id_to_note.rb create mode 100644 db/schema.rb delete mode 100644 public/index.html diff --git a/Gemfile b/Gemfile index 993b4b5..6884354 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,6 @@ source 'https://rubygems.org' gem 'rails', '3.2.11' - -# Bundle edge Rails instead: -# gem 'rails', :git => 'git://github.com/rails/rails.git' - gem 'pg' @@ -29,7 +25,10 @@ gem 'jquery-rails' # gem 'jbuilder' # Use unicorn as the app server -# gem 'unicorn' +gem 'unicorn' + +gem 'rabl' +gem 'oj' # Deploy with Capistrano # gem 'capistrano' diff --git a/Gemfile.lock b/Gemfile.lock index fd8461b..3068fed 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -47,14 +47,18 @@ GEM railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) json (1.8.0) + kgio (2.8.0) mail (2.4.4) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.23) multi_json (1.7.3) + oj (2.0.7) pg (0.15.1) polyglot (0.3.3) + rabl (0.8.0) + activesupport (>= 2.3.14) rack (1.4.5) rack-cache (1.2) rack (>= 0.4) @@ -77,6 +81,7 @@ GEM rake (>= 0.8.7) rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) + raindrops (0.10.0) rake (10.0.4) rdoc (3.12.2) json (~> 1.4) @@ -99,6 +104,10 @@ GEM uglifier (2.1.0) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) + unicorn (4.6.2) + kgio (~> 2.6) + rack + raindrops (~> 0.7) PLATFORMS ruby @@ -106,7 +115,10 @@ PLATFORMS DEPENDENCIES coffee-rails (~> 3.2.1) jquery-rails + oj pg + rabl rails (= 3.2.11) sass-rails (~> 3.2.3) uglifier (>= 1.0.3) + unicorn diff --git a/app/assets/javascripts/categories.js.coffee b/app/assets/javascripts/categories.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/categories.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/notes.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/categories.css.scss b/app/assets/stylesheets/categories.css.scss new file mode 100644 index 0000000..42976cb --- /dev/null +++ b/app/assets/stylesheets/categories.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Categories controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/notes.css.scss b/app/assets/stylesheets/notes.css.scss new file mode 100644 index 0000000..044e3d1 --- /dev/null +++ b/app/assets/stylesheets/notes.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Notes controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/scaffolds.css.scss b/app/assets/stylesheets/scaffolds.css.scss new file mode 100644 index 0000000..6ec6a8f --- /dev/null +++ b/app/assets/stylesheets/scaffolds.css.scss @@ -0,0 +1,69 @@ +body { + background-color: #fff; + color: #333; + font-family: verdana, arial, helvetica, sans-serif; + font-size: 13px; + line-height: 18px; +} + +p, ol, ul, td { + font-family: verdana, arial, helvetica, sans-serif; + font-size: 13px; + line-height: 18px; +} + +pre { + background-color: #eee; + padding: 10px; + font-size: 11px; +} + +a { + color: #000; + &:visited { + color: #666; + } + &:hover { + color: #fff; + background-color: #000; + } +} + +div { + &.field, &.actions { + margin-bottom: 10px; + } +} + +#notice { + color: green; +} + +.field_with_errors { + padding: 2px; + background-color: red; + display: table; +} + +#error_explanation { + width: 450px; + border: 2px solid red; + padding: 7px; + padding-bottom: 0; + margin-bottom: 20px; + background-color: #f0f0f0; + h2 { + text-align: left; + font-weight: bold; + padding: 5px 5px 5px 15px; + font-size: 12px; + margin: -7px; + margin-bottom: 0px; + background-color: #c00; + color: #fff; + } + ul li { + font-size: 12px; + list-style: square; + } +} diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e8065d9..e0cce92 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,10 @@ class ApplicationController < ActionController::Base protect_from_forgery + + + rescue_from ActiveRecord::RecordNotFound, :with => :record_not_found + + def record_not_found + render json: {:error => "Unable to find item"} , status: :unprocessable_entity + end end diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb new file mode 100644 index 0000000..869cd27 --- /dev/null +++ b/app/controllers/categories_controller.rb @@ -0,0 +1,83 @@ +class CategoriesController < ApplicationController + # GET /categories + # GET /categories.json + def index + @categories = Category.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @categories } + end + end + + # GET /categories/1 + # GET /categories/1.json + def show + @category = Category.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @category } + end + end + + # GET /categories/new + # GET /categories/new.json + def new + @category = Category.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @category } + end + end + + # GET /categories/1/edit + def edit + @category = Category.find(params[:id]) + end + + # POST /categories + # POST /categories.json + def create + @category = Category.new(params[:category]) + + respond_to do |format| + if @category.save + format.html { redirect_to @category, notice: 'Category was successfully created.' } + format.json { render json: @category, status: :created, location: @category } + else + format.html { render action: "new" } + format.json { render json: @category.errors, status: :unprocessable_entity } + end + end + end + + # PUT /categories/1 + # PUT /categories/1.json + def update + @category = Category.find(params[:id]) + + respond_to do |format| + if @category.update_attributes(params[:category]) + format.html { redirect_to @category, notice: 'Category was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @category.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /categories/1 + # DELETE /categories/1.json + def destroy + @category = Category.find(params[:id]) + @category.destroy + + respond_to do |format| + format.html { redirect_to categories_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb new file mode 100644 index 0000000..0761df1 --- /dev/null +++ b/app/controllers/notes_controller.rb @@ -0,0 +1,92 @@ +class NotesController < ApplicationController + + before_filter :load_category + + # GET /notes + # GET /notes.json + def index + @notes = @category.notes.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @notes } + end + end + + # GET /notes/1 + # GET /notes/1.json + def show + @note = Note.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @note } + end + end + + # GET /notes/new + # GET /notes/new.json + def new + @note = @category.notes.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @note } + end + end + + # GET /notes/1/edit + def edit + @note = Note.find(params[:id]) + end + + # POST /notes + # POST /notes.json + def create + @note = @category.notes.new(params[:note]) + + respond_to do |format| + if @note.save + format.html { redirect_to category_notes_path, notice: 'Note was successfully created.' } + format.json { render json: @note, status: :created, location: @note } + else + format.html { render action: "new" } + format.json { render json: @note.errors, status: :unprocessable_entity } + end + end + end + + # PUT /notes/1 + # PUT /notes/1.json + def update + @note = Note.find(params[:id]) + + respond_to do |format| + if @note.update_attributes(params[:note]) + format.html { redirect_to @note, notice: 'Note was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @note.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /notes/1 + # DELETE /notes/1.json + def destroy + @note = Note.find(params[:id]) + @note.destroy + + respond_to do |format| + format.html { redirect_to notes_url } + format.json { head :no_content } + end + end + + + private + def load_category + @category = Category.find(params[:category_id]) + end +end diff --git a/app/helpers/categories_helper.rb b/app/helpers/categories_helper.rb new file mode 100644 index 0000000..e06f315 --- /dev/null +++ b/app/helpers/categories_helper.rb @@ -0,0 +1,2 @@ +module CategoriesHelper +end diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb new file mode 100644 index 0000000..8078f73 --- /dev/null +++ b/app/helpers/notes_helper.rb @@ -0,0 +1,2 @@ +module NotesHelper +end diff --git a/app/models/category.rb b/app/models/category.rb new file mode 100644 index 0000000..d0ac59d --- /dev/null +++ b/app/models/category.rb @@ -0,0 +1,5 @@ +class Category < ActiveRecord::Base + attr_accessible :description, :name, :title + has_many :notes + +end diff --git a/app/models/note.rb b/app/models/note.rb new file mode 100644 index 0000000..afee2c9 --- /dev/null +++ b/app/models/note.rb @@ -0,0 +1,5 @@ +class Note < ActiveRecord::Base + attr_accessible :description, :name, :title + + belongs_to :category +end diff --git a/app/views/categories/_form.html.erb b/app/views/categories/_form.html.erb new file mode 100644 index 0000000..a814c80 --- /dev/null +++ b/app/views/categories/_form.html.erb @@ -0,0 +1,29 @@ +<%= form_for(@category) do |f| %> + <% if @category.errors.any? %> +
+

<%= pluralize(@category.errors.count, "error") %> prohibited this category from being saved:

+ + +
+ <% end %> + +
+ <%= f.label :name %>
+ <%= f.text_field :name %> +
+
+ <%= f.label :title %>
+ <%= f.text_field :title %> +
+
+ <%= f.label :description %>
+ <%= f.text_area :description %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/categories/edit.html.erb b/app/views/categories/edit.html.erb new file mode 100644 index 0000000..fce22f7 --- /dev/null +++ b/app/views/categories/edit.html.erb @@ -0,0 +1,6 @@ +

Editing category

+ +<%= render 'form' %> + +<%= link_to 'Show', @category %> | +<%= link_to 'Back', categories_path %> diff --git a/app/views/categories/index.html.erb b/app/views/categories/index.html.erb new file mode 100644 index 0000000..74e399d --- /dev/null +++ b/app/views/categories/index.html.erb @@ -0,0 +1,27 @@ +

Listing categories

+ + + + + + + + + + + +<% @categories.each do |category| %> + + + + + + + + +<% end %> +
NameTitleDescription
<%= category.name %><%= category.title %><%= category.description %><%= link_to 'Show', category_notes_path(category) %><%= link_to 'Edit', edit_category_path(category) %><%= link_to 'Destroy', category, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Category', new_category_path %> diff --git a/app/views/categories/new.html.erb b/app/views/categories/new.html.erb new file mode 100644 index 0000000..a84b5d3 --- /dev/null +++ b/app/views/categories/new.html.erb @@ -0,0 +1,5 @@ +

New category

+ +<%= render 'form' %> + +<%= link_to 'Back', categories_path %> diff --git a/app/views/categories/show.html.erb b/app/views/categories/show.html.erb new file mode 100644 index 0000000..a141662 --- /dev/null +++ b/app/views/categories/show.html.erb @@ -0,0 +1,20 @@ +

<%= notice %>

+ +

+ Name: + <%= @category.name %> +

+ +

+ Title: + <%= @category.title %> +

+ +

+ Description: + <%= @category.description %> +

+ + +<%= link_to 'Edit', edit_category_path(@category) %> | +<%= link_to 'Back', categories_path %> diff --git a/app/views/notes/_form.html.erb b/app/views/notes/_form.html.erb new file mode 100644 index 0000000..622219c --- /dev/null +++ b/app/views/notes/_form.html.erb @@ -0,0 +1,29 @@ +<%= form_for [@category,@note] do |f| %> + <% if @note.errors.any? %> +
+

<%= pluralize(@note.errors.count, "error") %> prohibited this note from being saved:

+ + +
+ <% end %> + +
+ <%= f.label :name %>
+ <%= f.text_field :name %> +
+
+ <%= f.label :title %>
+ <%= f.text_field :title %> +
+
+ <%= f.label :description %>
+ <%= f.text_area :description %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/notes/edit.html.erb b/app/views/notes/edit.html.erb new file mode 100644 index 0000000..b8aedf0 --- /dev/null +++ b/app/views/notes/edit.html.erb @@ -0,0 +1,6 @@ +

Editing note

+ +<%= render 'form' %> + +<%= link_to 'Show', category_note_path(@category,@note) %> | +<%= link_to 'Back', category_notes_path @category %> diff --git a/app/views/notes/index.html.erb b/app/views/notes/index.html.erb new file mode 100644 index 0000000..4c3ff1c --- /dev/null +++ b/app/views/notes/index.html.erb @@ -0,0 +1,27 @@ +

Listing notes

+ + + + + + + + + + + +<% @notes.each do |note| %> + + + + + + + + +<% end %> +
NameTitleDescription
<%= note.name %><%= note.title %><%= note.description %><%= link_to 'Show', category_note_url(@category, note) %><%= link_to 'Edit', edit_category_note_path(@category,note) %><%= link_to 'Destroy', category_note_path(@category,note), method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Note', new_category_note_path(@category) %> diff --git a/app/views/notes/new.html.erb b/app/views/notes/new.html.erb new file mode 100644 index 0000000..ecbea1c --- /dev/null +++ b/app/views/notes/new.html.erb @@ -0,0 +1,5 @@ +

New note

+ +<%= render 'form' %> + +<%= link_to 'Back', category_notes_path(@category) %> diff --git a/app/views/notes/show.html.erb b/app/views/notes/show.html.erb new file mode 100644 index 0000000..7386dbd --- /dev/null +++ b/app/views/notes/show.html.erb @@ -0,0 +1,20 @@ +

<%= notice %>

+ +

+ Name: + <%= @note.name %> +

+ +

+ Title: + <%= @note.title %> +

+ +

+ Description: + <%= @note.description %> +

+ + +<%= link_to 'Edit', edit_category_note_path(@category,@note) %> | +<%= link_to 'Back', category_notes_path(@category) %> diff --git a/config/database.yml b/config/database.yml index add995e..d7e5f9e 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,55 +1,16 @@ -# PostgreSQL. Versions 8.2 and up are supported. -# -# Install the pg driver: -# gem install pg -# On Mac OS X with macports: -# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config -# On Windows: -# gem install pg -# Choose the win32 build. -# Install PostgreSQL and put its /bin directory on your path. -# -# Configure Using Gemfile -# gem 'pg' -# development: adapter: postgresql - encoding: unicode - database: AndroidCourseWebService_development + database: simple-android-service_dev + username: postgres + password: 123456 pool: 5 - username: AndroidCourseWebService - password: - - # Connect on a TCP socket. Omitted by default since the client uses a - # domain socket that doesn't need configuration. Windows does not have - # domain sockets, so uncomment these lines. - #host: localhost - #port: 5432 - - # Schema search path. The server defaults to $user,public - #schema_search_path: myapp,sharedapp,public - - # Minimum log levels, in increasing order: - # debug5, debug4, debug3, debug2, debug1, - # log, notice, warning, error, fatal, and panic - # The server defaults to notice. - #min_messages: warning - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. + host: localhost + timeout: 5000 test: adapter: postgresql - encoding: unicode - database: AndroidCourseWebService_test + database: simple-android-service_test + username: postgres + password: 123456 pool: 5 - username: AndroidCourseWebService - password: - -production: - adapter: postgresql - encoding: unicode - database: AndroidCourseWebService_production - pool: 5 - username: AndroidCourseWebService - password: + host: localhost + timeout: 5000 \ No newline at end of file diff --git a/config/initializers/rabl_init.rb b/config/initializers/rabl_init.rb new file mode 100644 index 0000000..6619d28 --- /dev/null +++ b/config/initializers/rabl_init.rb @@ -0,0 +1,20 @@ +Rabl.configure do |config| + # Commented as these are defaults + # config.cache_all_output = false + # config.cache_sources = Rails.env != 'development' # Defaults to false + # config.cache_engine = Rabl::CacheEngine.new # Defaults to Rails cache + # config.escape_all_output = false + # config.json_engine = nil # Any multi_json engines or a Class with #encode method + # config.msgpack_engine = nil # Defaults to ::MessagePack + # config.bson_engine = nil # Defaults to ::BSON + # config.plist_engine = nil # Defaults to ::Plist::Emit + config.include_json_root = false + config.include_child_root = false + # config.include_msgpack_root = true + # config.include_bson_root = true + # config.include_plist_root = true + # config.include_xml_root = false + # config.enable_json_callbacks = false + # config.xml_options = { :dasherize => true, :skip_types => false } + # config.view_paths = [] +end \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index bd978fa..58a0918 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,10 @@ AndroidCourseWebService::Application.routes.draw do + + resources :categories do + resources :notes + end + + # The priority is based upon order of creation: # first created -> highest priority. @@ -48,7 +54,7 @@ # You can have the root of your site routed with "root" # just remember to delete public/index.html. - # root :to => 'welcome#index' + root :to => 'categories#index' # See how all your routes lay out with "rake routes" diff --git a/db/migrate/20130517132549_create_categories.rb b/db/migrate/20130517132549_create_categories.rb new file mode 100644 index 0000000..4e78bb1 --- /dev/null +++ b/db/migrate/20130517132549_create_categories.rb @@ -0,0 +1,11 @@ +class CreateCategories < ActiveRecord::Migration + def change + create_table :categories do |t| + t.string :name + t.string :title + t.text :description + + t.timestamps + end + end +end diff --git a/db/migrate/20130517132622_create_notes.rb b/db/migrate/20130517132622_create_notes.rb new file mode 100644 index 0000000..de2d826 --- /dev/null +++ b/db/migrate/20130517132622_create_notes.rb @@ -0,0 +1,11 @@ +class CreateNotes < ActiveRecord::Migration + def change + create_table :notes do |t| + t.string :name + t.string :title + t.text :description + + t.timestamps + end + end +end diff --git a/db/migrate/20130517133318_add_category_id_to_note.rb b/db/migrate/20130517133318_add_category_id_to_note.rb new file mode 100644 index 0000000..6f21f5f --- /dev/null +++ b/db/migrate/20130517133318_add_category_id_to_note.rb @@ -0,0 +1,5 @@ +class AddCategoryIdToNote < ActiveRecord::Migration + def change + add_column :notes, :category_id, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..f4fe958 --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,33 @@ +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 20130517133318) do + + create_table "categories", :force => true do |t| + t.string "name" + t.string "title" + t.text "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "notes", :force => true do |t| + t.string "name" + t.string "title" + t.text "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "category_id" + end + +end diff --git a/public/index.html b/public/index.html deleted file mode 100644 index a1d5099..0000000 --- a/public/index.html +++ /dev/null @@ -1,241 +0,0 @@ - - - - Ruby on Rails: Welcome aboard - - - - -
- - -
- - - - -
-

Getting started

-

Here’s how to get rolling:

- -
    -
  1. -

    Use rails generate to create your models and controllers

    -

    To see all available options, run it without parameters.

    -
  2. - -
  3. -

    Set up a default route and remove public/index.html

    -

    Routes are set up in config/routes.rb.

    -
  4. - -
  5. -

    Create your database

    -

    Run rake db:create to create your database. If you're not using SQLite (the default), edit config/database.yml with your username and password.

    -
  6. -
-
-
- - -
- -