From 6234421ec6eec7f8c0b94de691e8f6bced25b87f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Pachas=20Garc=C3=ADa?= Date: Mon, 19 Dec 2011 20:52:57 +0100 Subject: [PATCH 1/8] Revert c6aeadcd009dca2705845fe0063ee959870587ac^..HEAD --- app/assets/javascripts/viajes.js.coffee | 3 + app/assets/stylesheets/viajes.css.scss | 3 + app/controllers/selecteds_controller.rb | 1 - app/controllers/viajes_controller.rb | 83 +++++++ app/helpers/viajes_helper.rb | 2 + app/models/viaje.rb | 3 + app/views/selecteds/create.js.erb | 1 - app/views/trips/_trip.html.erb | 4 +- app/views/trips/show.html.erb | 2 +- app/views/viajes/_form.html.erb | 25 +++ app/views/viajes/edit.html.erb | 6 + app/views/viajes/index.html.erb | 25 +++ app/views/viajes/new.html.erb | 5 + app/views/viajes/show.html.erb | 15 ++ config/routes.rb | 2 + db/migrate/20111219132335_create_viajes.rb | 10 + db/schema.rb | 9 +- public/index.html | 241 --------------------- test/fixtures/viajes.yml | 9 + test/functional/viajes_controller_test.rb | 49 +++++ test/unit/helpers/viajes_helper_test.rb | 4 + test/unit/viaje_test.rb | 7 + 22 files changed, 261 insertions(+), 248 deletions(-) create mode 100644 app/assets/javascripts/viajes.js.coffee create mode 100644 app/assets/stylesheets/viajes.css.scss create mode 100644 app/controllers/viajes_controller.rb create mode 100644 app/helpers/viajes_helper.rb create mode 100644 app/models/viaje.rb delete mode 100644 app/views/selecteds/create.js.erb create mode 100644 app/views/viajes/_form.html.erb create mode 100644 app/views/viajes/edit.html.erb create mode 100644 app/views/viajes/index.html.erb create mode 100644 app/views/viajes/new.html.erb create mode 100644 app/views/viajes/show.html.erb create mode 100644 db/migrate/20111219132335_create_viajes.rb delete mode 100644 public/index.html create mode 100644 test/fixtures/viajes.yml create mode 100644 test/functional/viajes_controller_test.rb create mode 100644 test/unit/helpers/viajes_helper_test.rb create mode 100644 test/unit/viaje_test.rb diff --git a/app/assets/javascripts/viajes.js.coffee b/app/assets/javascripts/viajes.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/viajes.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/viajes.css.scss b/app/assets/stylesheets/viajes.css.scss new file mode 100644 index 0000000..8888794 --- /dev/null +++ b/app/assets/stylesheets/viajes.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Viajes controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/selecteds_controller.rb b/app/controllers/selecteds_controller.rb index daa35bf..df7b7c0 100644 --- a/app/controllers/selecteds_controller.rb +++ b/app/controllers/selecteds_controller.rb @@ -45,7 +45,6 @@ def create respond_to do |format| if @selected.save format.html { redirect_to @selected.trip, notice: 'Selected was successfully created.' } - format.js format.json { render json: @selected, status: :created, location: @selected } else format.html { render action: "new" } diff --git a/app/controllers/viajes_controller.rb b/app/controllers/viajes_controller.rb new file mode 100644 index 0000000..4ae60e8 --- /dev/null +++ b/app/controllers/viajes_controller.rb @@ -0,0 +1,83 @@ +class ViajesController < ApplicationController + # GET /viajes + # GET /viajes.json + def index + @viajes = Viaje.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @viajes } + end + end + + # GET /viajes/1 + # GET /viajes/1.json + def show + @viaje = Viaje.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @viaje } + end + end + + # GET /viajes/new + # GET /viajes/new.json + def new + @viaje = Viaje.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @viaje } + end + end + + # GET /viajes/1/edit + def edit + @viaje = Viaje.find(params[:id]) + end + + # POST /viajes + # POST /viajes.json + def create + @viaje = Viaje.new(params[:viaje]) + + respond_to do |format| + if @viaje.save + format.html { redirect_to @viaje, notice: 'Viaje was successfully created.' } + format.json { render json: @viaje, status: :created, location: @viaje } + else + format.html { render action: "new" } + format.json { render json: @viaje.errors, status: :unprocessable_entity } + end + end + end + + # PUT /viajes/1 + # PUT /viajes/1.json + def update + @viaje = Viaje.find(params[:id]) + + respond_to do |format| + if @viaje.update_attributes(params[:viaje]) + format.html { redirect_to @viaje, notice: 'Viaje was successfully updated.' } + format.json { head :ok } + else + format.html { render action: "edit" } + format.json { render json: @viaje.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /viajes/1 + # DELETE /viajes/1.json + def destroy + @viaje = Viaje.find(params[:id]) + @viaje.destroy + + respond_to do |format| + format.html { redirect_to viajes_url } + format.json { head :ok } + end + end +end diff --git a/app/helpers/viajes_helper.rb b/app/helpers/viajes_helper.rb new file mode 100644 index 0000000..232bd8c --- /dev/null +++ b/app/helpers/viajes_helper.rb @@ -0,0 +1,2 @@ +module ViajesHelper +end diff --git a/app/models/viaje.rb b/app/models/viaje.rb new file mode 100644 index 0000000..5f381fb --- /dev/null +++ b/app/models/viaje.rb @@ -0,0 +1,3 @@ +class Viaje < ActiveRecord::Base + has_many : sites +end diff --git a/app/views/selecteds/create.js.erb b/app/views/selecteds/create.js.erb deleted file mode 100644 index 69ed882..0000000 --- a/app/views/selecteds/create.js.erb +++ /dev/null @@ -1 +0,0 @@ -$('#selected').html("<%= j render @selected.trip %>"); \ No newline at end of file diff --git a/app/views/trips/_trip.html.erb b/app/views/trips/_trip.html.erb index ad032a3..deea1c3 100644 --- a/app/views/trips/_trip.html.erb +++ b/app/views/trips/_trip.html.erb @@ -1,5 +1,4 @@ -
<% trip.selecteds.order(:hour).each do |selected| %> @@ -22,9 +21,8 @@ <%= link_to 'Destroy', selected, :confirm => 'Are you sure?', :method => :delete %> - <% end %>
-
+ diff --git a/app/views/trips/show.html.erb b/app/views/trips/show.html.erb index 0157392..2da1a1b 100644 --- a/app/views/trips/show.html.erb +++ b/app/views/trips/show.html.erb @@ -24,7 +24,7 @@ <%= render(@trip) %> - <%= form_for(@selected, remote: true) do |f| %> + <%= form_for(@selected) do |f| %> <%= f.number_field :trip_id, :value => @trip.id, :hidden => true %> <%= f.collection_select(:site_id, diff --git a/app/views/viajes/_form.html.erb b/app/views/viajes/_form.html.erb new file mode 100644 index 0000000..e1133d7 --- /dev/null +++ b/app/views/viajes/_form.html.erb @@ -0,0 +1,25 @@ +<%= form_for(@viaje) do |f| %> + <% if @viaje.errors.any? %> +
+

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

+ + +
+ <% end %> + +
+ <%= f.label :site_id %>
+ <%= f.number_field :site_id %> +
+
+ <%= f.label :hour %>
+ <%= f.number_field :hour %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/viajes/edit.html.erb b/app/views/viajes/edit.html.erb new file mode 100644 index 0000000..7e205b9 --- /dev/null +++ b/app/views/viajes/edit.html.erb @@ -0,0 +1,6 @@ +

Editing viaje

+ +<%= render 'form' %> + +<%= link_to 'Show', @viaje %> | +<%= link_to 'Back', viajes_path %> diff --git a/app/views/viajes/index.html.erb b/app/views/viajes/index.html.erb new file mode 100644 index 0000000..dc7f66f --- /dev/null +++ b/app/views/viajes/index.html.erb @@ -0,0 +1,25 @@ +

Listing viajes

+ + + + + + + + + + +<% @viajes.each do |viaje| %> + + + + + + + +<% end %> +
SiteHour
<%= viaje.site_id %><%= viaje.hour %><%= link_to 'Show', viaje %><%= link_to 'Edit', edit_viaje_path(viaje) %><%= link_to 'Destroy', viaje, confirm: 'Are you sure?', method: :delete %>
+ +
+ +<%= link_to 'New Viaje', new_viaje_path %> diff --git a/app/views/viajes/new.html.erb b/app/views/viajes/new.html.erb new file mode 100644 index 0000000..28faa86 --- /dev/null +++ b/app/views/viajes/new.html.erb @@ -0,0 +1,5 @@ +

New viaje

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

<%= notice %>

+ +

+ Site: + <%= @viaje.site_id %> +

+ +

+ Hour: + <%= @viaje.hour %> +

+ + +<%= link_to 'Edit', edit_viaje_path(@viaje) %> | +<%= link_to 'Back', viajes_path %> diff --git a/config/routes.rb b/config/routes.rb index fbb0b1d..96bd857 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,7 @@ Planet::Application.routes.draw do + resources :viajes + resources :selecteds resources :trips diff --git a/db/migrate/20111219132335_create_viajes.rb b/db/migrate/20111219132335_create_viajes.rb new file mode 100644 index 0000000..b81cf12 --- /dev/null +++ b/db/migrate/20111219132335_create_viajes.rb @@ -0,0 +1,10 @@ +class CreateViajes < ActiveRecord::Migration + def change + create_table :viajes do |t| + t.integer :site_id + t.integer :hour + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 6a99b9c..177c144 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20111211202305) do +ActiveRecord::Schema.define(:version => 20111219132335) do create_table "selecteds", :force => true do |t| t.integer "trip_id" @@ -48,4 +48,11 @@ t.datetime "updated_at" end + create_table "viajes", :force => true do |t| + t.integer "site_id" + t.integer "hour" + t.datetime "created_at" + t.datetime "updated_at" + end + end diff --git a/public/index.html b/public/index.html deleted file mode 100644 index 9d9811a..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. -
-
-
- - -
- - diff --git a/test/fixtures/viajes.yml b/test/fixtures/viajes.yml new file mode 100644 index 0000000..6bd3b10 --- /dev/null +++ b/test/fixtures/viajes.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + site_id: 1 + hour: 1 + +two: + site_id: 1 + hour: 1 diff --git a/test/functional/viajes_controller_test.rb b/test/functional/viajes_controller_test.rb new file mode 100644 index 0000000..bbf4cb9 --- /dev/null +++ b/test/functional/viajes_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class ViajesControllerTest < ActionController::TestCase + setup do + @viaje = viajes(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:viajes) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create viaje" do + assert_difference('Viaje.count') do + post :create, viaje: @viaje.attributes + end + + assert_redirected_to viaje_path(assigns(:viaje)) + end + + test "should show viaje" do + get :show, id: @viaje.to_param + assert_response :success + end + + test "should get edit" do + get :edit, id: @viaje.to_param + assert_response :success + end + + test "should update viaje" do + put :update, id: @viaje.to_param, viaje: @viaje.attributes + assert_redirected_to viaje_path(assigns(:viaje)) + end + + test "should destroy viaje" do + assert_difference('Viaje.count', -1) do + delete :destroy, id: @viaje.to_param + end + + assert_redirected_to viajes_path + end +end diff --git a/test/unit/helpers/viajes_helper_test.rb b/test/unit/helpers/viajes_helper_test.rb new file mode 100644 index 0000000..11d37c6 --- /dev/null +++ b/test/unit/helpers/viajes_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class ViajesHelperTest < ActionView::TestCase +end diff --git a/test/unit/viaje_test.rb b/test/unit/viaje_test.rb new file mode 100644 index 0000000..d46b5ab --- /dev/null +++ b/test/unit/viaje_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ViajeTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end From 2c1cb7a8f421a282bdc2f447d6225e6a06748be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Pachas=20Garc=C3=ADa?= Date: Mon, 19 Dec 2011 20:53:15 +0100 Subject: [PATCH 2/8] Revert c6aeadcd009dca2705845fe0063ee959870587ac^..HEAD --- app/assets/javascripts/viajes.js.coffee | 3 - app/assets/stylesheets/viajes.css.scss | 3 - app/controllers/viajes_controller.rb | 83 ------- app/helpers/viajes_helper.rb | 2 - app/models/viaje.rb | 3 - app/views/viajes/_form.html.erb | 25 --- app/views/viajes/edit.html.erb | 6 - app/views/viajes/index.html.erb | 25 --- app/views/viajes/new.html.erb | 5 - app/views/viajes/show.html.erb | 15 -- config/routes.rb | 2 - db/migrate/20111219132335_create_viajes.rb | 10 - db/schema.rb | 9 +- public/index.html | 241 +++++++++++++++++++++ test/fixtures/viajes.yml | 9 - test/functional/viajes_controller_test.rb | 49 ----- test/unit/helpers/viajes_helper_test.rb | 4 - test/unit/viaje_test.rb | 7 - 18 files changed, 242 insertions(+), 259 deletions(-) delete mode 100644 app/assets/javascripts/viajes.js.coffee delete mode 100644 app/assets/stylesheets/viajes.css.scss delete mode 100644 app/controllers/viajes_controller.rb delete mode 100644 app/helpers/viajes_helper.rb delete mode 100644 app/models/viaje.rb delete mode 100644 app/views/viajes/_form.html.erb delete mode 100644 app/views/viajes/edit.html.erb delete mode 100644 app/views/viajes/index.html.erb delete mode 100644 app/views/viajes/new.html.erb delete mode 100644 app/views/viajes/show.html.erb delete mode 100644 db/migrate/20111219132335_create_viajes.rb create mode 100644 public/index.html delete mode 100644 test/fixtures/viajes.yml delete mode 100644 test/functional/viajes_controller_test.rb delete mode 100644 test/unit/helpers/viajes_helper_test.rb delete mode 100644 test/unit/viaje_test.rb diff --git a/app/assets/javascripts/viajes.js.coffee b/app/assets/javascripts/viajes.js.coffee deleted file mode 100644 index 7615679..0000000 --- a/app/assets/javascripts/viajes.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# 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/viajes.css.scss b/app/assets/stylesheets/viajes.css.scss deleted file mode 100644 index 8888794..0000000 --- a/app/assets/stylesheets/viajes.css.scss +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the Viajes controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/viajes_controller.rb b/app/controllers/viajes_controller.rb deleted file mode 100644 index 4ae60e8..0000000 --- a/app/controllers/viajes_controller.rb +++ /dev/null @@ -1,83 +0,0 @@ -class ViajesController < ApplicationController - # GET /viajes - # GET /viajes.json - def index - @viajes = Viaje.all - - respond_to do |format| - format.html # index.html.erb - format.json { render json: @viajes } - end - end - - # GET /viajes/1 - # GET /viajes/1.json - def show - @viaje = Viaje.find(params[:id]) - - respond_to do |format| - format.html # show.html.erb - format.json { render json: @viaje } - end - end - - # GET /viajes/new - # GET /viajes/new.json - def new - @viaje = Viaje.new - - respond_to do |format| - format.html # new.html.erb - format.json { render json: @viaje } - end - end - - # GET /viajes/1/edit - def edit - @viaje = Viaje.find(params[:id]) - end - - # POST /viajes - # POST /viajes.json - def create - @viaje = Viaje.new(params[:viaje]) - - respond_to do |format| - if @viaje.save - format.html { redirect_to @viaje, notice: 'Viaje was successfully created.' } - format.json { render json: @viaje, status: :created, location: @viaje } - else - format.html { render action: "new" } - format.json { render json: @viaje.errors, status: :unprocessable_entity } - end - end - end - - # PUT /viajes/1 - # PUT /viajes/1.json - def update - @viaje = Viaje.find(params[:id]) - - respond_to do |format| - if @viaje.update_attributes(params[:viaje]) - format.html { redirect_to @viaje, notice: 'Viaje was successfully updated.' } - format.json { head :ok } - else - format.html { render action: "edit" } - format.json { render json: @viaje.errors, status: :unprocessable_entity } - end - end - end - - # DELETE /viajes/1 - # DELETE /viajes/1.json - def destroy - @viaje = Viaje.find(params[:id]) - @viaje.destroy - - respond_to do |format| - format.html { redirect_to viajes_url } - format.json { head :ok } - end - end -end diff --git a/app/helpers/viajes_helper.rb b/app/helpers/viajes_helper.rb deleted file mode 100644 index 232bd8c..0000000 --- a/app/helpers/viajes_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ViajesHelper -end diff --git a/app/models/viaje.rb b/app/models/viaje.rb deleted file mode 100644 index 5f381fb..0000000 --- a/app/models/viaje.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Viaje < ActiveRecord::Base - has_many : sites -end diff --git a/app/views/viajes/_form.html.erb b/app/views/viajes/_form.html.erb deleted file mode 100644 index e1133d7..0000000 --- a/app/views/viajes/_form.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -<%= form_for(@viaje) do |f| %> - <% if @viaje.errors.any? %> -
-

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

- -
    - <% @viaje.errors.full_messages.each do |msg| %> -
  • <%= msg %>
  • - <% end %> -
-
- <% end %> - -
- <%= f.label :site_id %>
- <%= f.number_field :site_id %> -
-
- <%= f.label :hour %>
- <%= f.number_field :hour %> -
-
- <%= f.submit %> -
-<% end %> diff --git a/app/views/viajes/edit.html.erb b/app/views/viajes/edit.html.erb deleted file mode 100644 index 7e205b9..0000000 --- a/app/views/viajes/edit.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -

Editing viaje

- -<%= render 'form' %> - -<%= link_to 'Show', @viaje %> | -<%= link_to 'Back', viajes_path %> diff --git a/app/views/viajes/index.html.erb b/app/views/viajes/index.html.erb deleted file mode 100644 index dc7f66f..0000000 --- a/app/views/viajes/index.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -

Listing viajes

- - - - - - - - - - -<% @viajes.each do |viaje| %> - - - - - - - -<% end %> -
SiteHour
<%= viaje.site_id %><%= viaje.hour %><%= link_to 'Show', viaje %><%= link_to 'Edit', edit_viaje_path(viaje) %><%= link_to 'Destroy', viaje, confirm: 'Are you sure?', method: :delete %>
- -
- -<%= link_to 'New Viaje', new_viaje_path %> diff --git a/app/views/viajes/new.html.erb b/app/views/viajes/new.html.erb deleted file mode 100644 index 28faa86..0000000 --- a/app/views/viajes/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

New viaje

- -<%= render 'form' %> - -<%= link_to 'Back', viajes_path %> diff --git a/app/views/viajes/show.html.erb b/app/views/viajes/show.html.erb deleted file mode 100644 index fc63c49..0000000 --- a/app/views/viajes/show.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -

<%= notice %>

- -

- Site: - <%= @viaje.site_id %> -

- -

- Hour: - <%= @viaje.hour %> -

- - -<%= link_to 'Edit', edit_viaje_path(@viaje) %> | -<%= link_to 'Back', viajes_path %> diff --git a/config/routes.rb b/config/routes.rb index 96bd857..fbb0b1d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,5 @@ Planet::Application.routes.draw do - resources :viajes - resources :selecteds resources :trips diff --git a/db/migrate/20111219132335_create_viajes.rb b/db/migrate/20111219132335_create_viajes.rb deleted file mode 100644 index b81cf12..0000000 --- a/db/migrate/20111219132335_create_viajes.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateViajes < ActiveRecord::Migration - def change - create_table :viajes do |t| - t.integer :site_id - t.integer :hour - - t.timestamps - end - end -end diff --git a/db/schema.rb b/db/schema.rb index 177c144..6a99b9c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20111219132335) do +ActiveRecord::Schema.define(:version => 20111211202305) do create_table "selecteds", :force => true do |t| t.integer "trip_id" @@ -48,11 +48,4 @@ t.datetime "updated_at" end - create_table "viajes", :force => true do |t| - t.integer "site_id" - t.integer "hour" - t.datetime "created_at" - t.datetime "updated_at" - end - end diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..9d9811a --- /dev/null +++ b/public/index.html @@ -0,0 +1,241 @@ + + + + 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. +
+
+
+ + +
+ + diff --git a/test/fixtures/viajes.yml b/test/fixtures/viajes.yml deleted file mode 100644 index 6bd3b10..0000000 --- a/test/fixtures/viajes.yml +++ /dev/null @@ -1,9 +0,0 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html - -one: - site_id: 1 - hour: 1 - -two: - site_id: 1 - hour: 1 diff --git a/test/functional/viajes_controller_test.rb b/test/functional/viajes_controller_test.rb deleted file mode 100644 index bbf4cb9..0000000 --- a/test/functional/viajes_controller_test.rb +++ /dev/null @@ -1,49 +0,0 @@ -require 'test_helper' - -class ViajesControllerTest < ActionController::TestCase - setup do - @viaje = viajes(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:viajes) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create viaje" do - assert_difference('Viaje.count') do - post :create, viaje: @viaje.attributes - end - - assert_redirected_to viaje_path(assigns(:viaje)) - end - - test "should show viaje" do - get :show, id: @viaje.to_param - assert_response :success - end - - test "should get edit" do - get :edit, id: @viaje.to_param - assert_response :success - end - - test "should update viaje" do - put :update, id: @viaje.to_param, viaje: @viaje.attributes - assert_redirected_to viaje_path(assigns(:viaje)) - end - - test "should destroy viaje" do - assert_difference('Viaje.count', -1) do - delete :destroy, id: @viaje.to_param - end - - assert_redirected_to viajes_path - end -end diff --git a/test/unit/helpers/viajes_helper_test.rb b/test/unit/helpers/viajes_helper_test.rb deleted file mode 100644 index 11d37c6..0000000 --- a/test/unit/helpers/viajes_helper_test.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'test_helper' - -class ViajesHelperTest < ActionView::TestCase -end diff --git a/test/unit/viaje_test.rb b/test/unit/viaje_test.rb deleted file mode 100644 index d46b5ab..0000000 --- a/test/unit/viaje_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class ViajeTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end From cb690a0cf1a6ec4389f793a7776b0202f216eac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Pachas=20Garc=C3=ADa?= Date: Tue, 20 Dec 2011 00:22:37 +0100 Subject: [PATCH 3/8] =?UTF-8?q?Entrega=202=20-=20Miguel=20Pachas=20Garc?= =?UTF-8?q?=C3=ADa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 241 ---------------------------------------------- 1 file changed, 241 deletions(-) delete mode 100644 public/index.html diff --git a/public/index.html b/public/index.html deleted file mode 100644 index 9d9811a..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. -
-
-
- - -
- - From ec3fbe74953b0084d04d77980a74cb54b1b3162b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Pachas=20Garc=C3=ADa?= Date: Tue, 20 Dec 2011 00:23:42 +0100 Subject: [PATCH 4/8] =?UTF-8?q?Entrega=202=20ror=20-=20Miguel=20Pachas=20G?= =?UTF-8?q?arc=C3=ADa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/javascripts/viajes.js.coffee | 3 + app/assets/stylesheets/viajes.css.scss | 3 + app/controllers/viajes_controller.rb | 90 ++++++++++++++++++++++ app/helpers/viajes_helper.rb | 2 + app/models/site.rb | 2 +- app/models/viaje.rb | 3 + app/views/layouts/application.html.erb | 4 +- app/views/sites/index.html.erb | 1 + app/views/sites/show.html.erb | 1 + app/views/viajes/_form.html.erb | 27 +++++++ app/views/viajes/edit.html.erb | 6 ++ app/views/viajes/index.html.erb | 45 +++++++++++ app/views/viajes/new.html.erb | 5 ++ app/views/viajes/show.html.erb | 20 +++++ config/routes.rb | 3 + db/migrate/20111219195413_create_viajes.rb | 10 +++ db/schema.rb | 9 ++- db/seeds.rb | 71 +++++++++++++++++ test/fixtures/viajes.yml | 9 +++ test/functional/viajes_controller_test.rb | 49 ++++++++++++ test/unit/helpers/viajes_helper_test.rb | 4 + test/unit/viaje_test.rb | 7 ++ 22 files changed, 370 insertions(+), 4 deletions(-) create mode 100644 app/assets/javascripts/viajes.js.coffee create mode 100644 app/assets/stylesheets/viajes.css.scss create mode 100644 app/controllers/viajes_controller.rb create mode 100644 app/helpers/viajes_helper.rb create mode 100644 app/models/viaje.rb create mode 100644 app/views/viajes/_form.html.erb create mode 100644 app/views/viajes/edit.html.erb create mode 100644 app/views/viajes/index.html.erb create mode 100644 app/views/viajes/new.html.erb create mode 100644 app/views/viajes/show.html.erb create mode 100644 db/migrate/20111219195413_create_viajes.rb create mode 100644 test/fixtures/viajes.yml create mode 100644 test/functional/viajes_controller_test.rb create mode 100644 test/unit/helpers/viajes_helper_test.rb create mode 100644 test/unit/viaje_test.rb diff --git a/app/assets/javascripts/viajes.js.coffee b/app/assets/javascripts/viajes.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/viajes.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/viajes.css.scss b/app/assets/stylesheets/viajes.css.scss new file mode 100644 index 0000000..8888794 --- /dev/null +++ b/app/assets/stylesheets/viajes.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Viajes controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/viajes_controller.rb b/app/controllers/viajes_controller.rb new file mode 100644 index 0000000..8e4ed8b --- /dev/null +++ b/app/controllers/viajes_controller.rb @@ -0,0 +1,90 @@ +class ViajesController < ApplicationController + # GET /viajes + # GET /viajes.json + def index + @viajes = Viaje.all(:order => :hour) + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @viajes } + end + end + + # GET /viajes/1 + # GET /viajes/1.json + def show + @viaje = Viaje.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @viaje } + end + end + + # GET /viajes/new + # GET /viajes/new.json + def new + @viaje = Viaje.new + @viaje.site_id = params[:id] + @viaje.hour = 0 + + respond_to do |format| + if @viaje.save + format.html { redirect_to viajes_url, notice: 'Viaje was successfully created.' } + format.json { render json: @viaje } + else + format.html { redirect_to viajes_url, notice: 'Viaje was unsuccessfully created.' } + format.json { render json: @viaje } + end + end + end + + # GET /viajes/1/edit + def edit + @viaje = Viaje.find(params[:id]) + end + + # POST /viajes + # POST /viajes.json + def create + @viaje = Viaje.new(params[:viaje]) + + respond_to do |format| + if @viaje.save + format.html { redirect_to @viaje, notice: 'Viaje was successfully created.' } + format.json { render json: @viaje, status: :created, location: @viaje } + else + format.html { render action: "new" } + format.json { render json: @viaje.errors, status: :unprocessable_entity } + end + end + end + + # PUT /viajes/1 + # PUT /viajes/1.json + def update + @viaje = Viaje.find(params[:id]) + + respond_to do |format| + if @viaje.update_attributes(params[:viaje]) + format.html { redirect_to viajes_url, notice: 'Viaje was successfully updated.' } + format.json { head :ok } + else + format.html { render action: "edit" } + format.json { render json: @viaje.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /viajes/1 + # DELETE /viajes/1.json + def destroy + @viaje = Viaje.find(params[:id]) + @viaje.destroy + + respond_to do |format| + format.html { redirect_to viajes_url } + format.json { head :ok } + end + end +end diff --git a/app/helpers/viajes_helper.rb b/app/helpers/viajes_helper.rb new file mode 100644 index 0000000..232bd8c --- /dev/null +++ b/app/helpers/viajes_helper.rb @@ -0,0 +1,2 @@ +module ViajesHelper +end diff --git a/app/models/site.rb b/app/models/site.rb index 8ac96ef..a84b85f 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -1,4 +1,4 @@ class Site < ActiveRecord::Base belongs_to :type - has_many :selected + belongs_to :viaje end diff --git a/app/models/viaje.rb b/app/models/viaje.rb new file mode 100644 index 0000000..bd929b5 --- /dev/null +++ b/app/models/viaje.rb @@ -0,0 +1,3 @@ +class Viaje < ActiveRecord::Base + has_many :sites +end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 04e4045..40464b3 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -8,7 +8,7 @@ @@ -23,7 +23,7 @@ <%= link_to "Home", planet_index_path %>
<%= link_to "Tipos", types_path %>
<%= link_to "Sitios", sites_path %>
- <%= link_to "Viajes", trips_path %>
+ <%= link_to "Viaje", viajes_path %>
<%= link_to "Contact", planet_contact_path %>
diff --git a/app/views/sites/index.html.erb b/app/views/sites/index.html.erb index f1034b8..d8ff3c1 100644 --- a/app/views/sites/index.html.erb +++ b/app/views/sites/index.html.erb @@ -18,6 +18,7 @@ + <%= link_to 'Añadir Sitio' , '/viajes/new/'+site.id.to_s,remote: true, class: 'add_viaje' %>
<%= link_to 'Show', site %>
<%= link_to 'Edit', edit_site_path(site) %>
<%= link_to 'Destroy', site, diff --git a/app/views/sites/show.html.erb b/app/views/sites/show.html.erb index 244b974..b1392b4 100644 --- a/app/views/sites/show.html.erb +++ b/app/views/sites/show.html.erb @@ -22,5 +22,6 @@

+<%= link_to 'Añadir Sitio', '/viajes/new/'+@site.id.to_s,remote: true, class: 'add_viaje_show_site' %> <%= link_to 'Edit', edit_site_path(@site) %> | <%= link_to 'Back', sites_path %> diff --git a/app/views/viajes/_form.html.erb b/app/views/viajes/_form.html.erb new file mode 100644 index 0000000..aa6a703 --- /dev/null +++ b/app/views/viajes/_form.html.erb @@ -0,0 +1,27 @@ +<%= form_for(@viaje) do |f| %> + <% if @viaje.errors.any? %> +

+

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

+ +
    + <% @viaje.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + + <% site = Site.find(@viaje.site_id) %> + <%= image_tag(site.image_url, :class => 'site_image') %> + +

<%= site.name %>

+ +

<%=sanitize site.description %>

+
+ <%= f.label :hour %>
+ <%= f.select(:hour, Array.new(24, 0).fill {|i| [(i.to_s + 'H'), i]}) %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/viajes/edit.html.erb b/app/views/viajes/edit.html.erb new file mode 100644 index 0000000..7e205b9 --- /dev/null +++ b/app/views/viajes/edit.html.erb @@ -0,0 +1,6 @@ +

Editing viaje

+ +<%= render 'form' %> + +<%= link_to 'Show', @viaje %> | +<%= link_to 'Back', viajes_path %> diff --git a/app/views/viajes/index.html.erb b/app/views/viajes/index.html.erb new file mode 100644 index 0000000..c31b10f --- /dev/null +++ b/app/views/viajes/index.html.erb @@ -0,0 +1,45 @@ +
+

Listing viajes

+ + + + + + + + + + +<% @viajes.each do |viaje| %> +<% site = Site.find(viaje.site_id) %> + + + + + + + + + + + <% end %> +
SitioDescripcionHora
+ <%= link_to image_tag(site.image_url, :class => 'list_image'), site %> + +
+
<%= link_to site.name, site %>
+
<%= truncate(strip_tags(site.description), + :length => 80) %>
+
+
<%= viaje.hour %> + <%= link_to 'Show', site %>
+ <%= link_to 'Edit', edit_viaje_path(viaje) %>
+ <%= link_to 'Quitar', viaje, + :confirm => 'Are you sure?', remote: true, class: 'delete_viaje', + :method => :delete %> +
+
+ +
+ + diff --git a/app/views/viajes/new.html.erb b/app/views/viajes/new.html.erb new file mode 100644 index 0000000..28faa86 --- /dev/null +++ b/app/views/viajes/new.html.erb @@ -0,0 +1,5 @@ +

New viaje

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

<%= notice %>

+ + <% site = Site.find(@viaje.site_id) %> + +

<%= site.type.name if site.type %>

+ + <%= image_tag(site.image_url, :class => 'site_image') %> + +

<%= site.name %>

+ +

<%=sanitize site.description %>

+ +

+ Hour: + <%= @viaje.hour %> +

+ + +<%= link_to 'Edit', edit_viaje_path(@viaje) %> | +<%= link_to 'Back', viajes_path %> diff --git a/config/routes.rb b/config/routes.rb index fbb0b1d..fc3fa18 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,7 @@ Planet::Application.routes.draw do + resources :viajes + resources :selecteds resources :trips @@ -18,6 +20,7 @@ get "planet/ejemplo" # Se añade una nueva ruta a la acción ejemplo + match 'viajes/new/:id' => 'viajes#new' # The priority is based upon order of creation: # first created -> highest priority. diff --git a/db/migrate/20111219195413_create_viajes.rb b/db/migrate/20111219195413_create_viajes.rb new file mode 100644 index 0000000..b81cf12 --- /dev/null +++ b/db/migrate/20111219195413_create_viajes.rb @@ -0,0 +1,10 @@ +class CreateViajes < ActiveRecord::Migration + def change + create_table :viajes do |t| + t.integer :site_id + t.integer :hour + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 6a99b9c..1bbf18d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20111211202305) do +ActiveRecord::Schema.define(:version => 20111219195413) do create_table "selecteds", :force => true do |t| t.integer "trip_id" @@ -48,4 +48,11 @@ t.datetime "updated_at" end + create_table "viajes", :force => true do |t| + t.integer "site_id" + t.integer "hour" + t.datetime "created_at" + t.datetime "updated_at" + end + end diff --git a/db/seeds.rb b/db/seeds.rb index 4edb1e8..b95b6ca 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -5,3 +5,74 @@ # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel', city: cities.first) +Type.create( + name: 'Monumento', + description: 'Edificio de interes turistico o artistico') + +Type.create( + name: 'Naturaleza', + description: 'Lugar al aire libre de interes natural o de recreo') + +Type.create( + name: 'Ruina', + description: 'Lugar o resto de interes arquelogico') + + +Site.create( + name: 'Pedriza', + description: 'Magnifico valle al norte de Madrid en el Macizo Central', + type_id: 2, + latitude: 40, + longitude: 40, + zoom: 10, + image_url: 'pedriza.png') + +Site.create( + name: 'Catedral de Florencia', + description: 'Catedral de la ciudad de Florencia con la que se inicia el Renacimiento', + type_id: 1, + latitude: 50, + longitude: 35, + zoom: 10, + image_url: 'florencia.png') + +Site.create( + name: 'Jardin de Lineo', + description: 'Jardin de la ciudad sueca de Uppsala donde el famoso naturalista enia su coleccion de plantas', + type_id: 2, + latitude: 80, + longitude: 45, + zoom: 10, + image_url: 'arbol1.png') + +Site.create( + name: 'Reichstag', + description: 'Parlamento aleman en la ciudad de Berlin', + type_id: 1, + latitude: 50, + longitude: 50, + zoom: 10, + image_url: 'reichstag.png') + +Site.create( + name: 'Pergamo', + description: 'Puerta del mercado de la antigua ciudad griega de Pergamo del museo arquelogico de Berlin', + type_id: 3, + latitude: 50, + longitude: 50, + zoom: 10, + image_url: 'pergamo.png') + +Viaje.create( + site_id: 2, + hour: 11) + +Viaje.create( + site_id: 4, + hour: 15) + +Viaje.create( + site_id: 1, + hour: 10) + + diff --git a/test/fixtures/viajes.yml b/test/fixtures/viajes.yml new file mode 100644 index 0000000..6bd3b10 --- /dev/null +++ b/test/fixtures/viajes.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + site_id: 1 + hour: 1 + +two: + site_id: 1 + hour: 1 diff --git a/test/functional/viajes_controller_test.rb b/test/functional/viajes_controller_test.rb new file mode 100644 index 0000000..bbf4cb9 --- /dev/null +++ b/test/functional/viajes_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class ViajesControllerTest < ActionController::TestCase + setup do + @viaje = viajes(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:viajes) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create viaje" do + assert_difference('Viaje.count') do + post :create, viaje: @viaje.attributes + end + + assert_redirected_to viaje_path(assigns(:viaje)) + end + + test "should show viaje" do + get :show, id: @viaje.to_param + assert_response :success + end + + test "should get edit" do + get :edit, id: @viaje.to_param + assert_response :success + end + + test "should update viaje" do + put :update, id: @viaje.to_param, viaje: @viaje.attributes + assert_redirected_to viaje_path(assigns(:viaje)) + end + + test "should destroy viaje" do + assert_difference('Viaje.count', -1) do + delete :destroy, id: @viaje.to_param + end + + assert_redirected_to viajes_path + end +end diff --git a/test/unit/helpers/viajes_helper_test.rb b/test/unit/helpers/viajes_helper_test.rb new file mode 100644 index 0000000..11d37c6 --- /dev/null +++ b/test/unit/helpers/viajes_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class ViajesHelperTest < ActionView::TestCase +end diff --git a/test/unit/viaje_test.rb b/test/unit/viaje_test.rb new file mode 100644 index 0000000..d46b5ab --- /dev/null +++ b/test/unit/viaje_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ViajeTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end From 95e4868a3ba079075a4f488c3b47efa14b4fd4b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Pachas=20Garc=C3=ADa?= Date: Fri, 13 Jan 2012 12:46:27 +0100 Subject: [PATCH 5/8] Entrega 3 MPG --- app/controllers/sites_controller.rb | 2 +- app/views/layouts/application.html.erb | 43 +++++++++++++++++++++++++- app/views/sites/index.html.erb | 3 +- app/views/sites/new.html.erb | 13 +++++++- app/views/sites/show.html.erb | 2 +- app/views/trips/_trip.html.erb | 4 +++ app/views/trips/show.html.erb | 6 +++- 7 files changed, 67 insertions(+), 6 deletions(-) diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index 9db5a12..47f4088 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -19,7 +19,7 @@ def index # GET /sites/1.json def show @site = Site.find(params[:id]) - + respond_to do |format| format.html # show.html.erb format.json { render json: @site } diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 40464b3..f4059e9 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -6,12 +6,52 @@ <%= javascript_include_tag "application" %> <%= csrf_meta_tags %> + + +
diff --git a/app/views/sites/index.html.erb b/app/views/sites/index.html.erb index d8ff3c1..c6d171c 100644 --- a/app/views/sites/index.html.erb +++ b/app/views/sites/index.html.erb @@ -23,7 +23,8 @@ <%= link_to 'Edit', edit_site_path(site) %>
<%= link_to 'Destroy', site, :confirm => 'Are you sure?', - :method => :delete %> + :method => :delete %>
+ Times included: <%= Site.count_by_sql("SELECT COUNT (id) FROM selecteds WHERE site_id ="+site.id.to_s)%> <% end %> diff --git a/app/views/sites/new.html.erb b/app/views/sites/new.html.erb index 2988bdc..21f4756 100644 --- a/app/views/sites/new.html.erb +++ b/app/views/sites/new.html.erb @@ -1,5 +1,16 @@

New site

<%= render 'form' %> - + <%= link_to 'Back', sites_path %> diff --git a/app/views/sites/show.html.erb b/app/views/sites/show.html.erb index b1392b4..af6bd83 100644 --- a/app/views/sites/show.html.erb +++ b/app/views/sites/show.html.erb @@ -5,7 +5,7 @@ <%= image_tag(@site.image_url, :class => 'site_image') %>

<%= @site.name %>

- + Times included: <%= Site.count_by_sql("SELECT COUNT (id) FROM selecteds WHERE site_id ="+@site.id.to_s)%>

<%=sanitize @site.description %>

diff --git a/app/views/trips/_trip.html.erb b/app/views/trips/_trip.html.erb index deea1c3..1c74a15 100644 --- a/app/views/trips/_trip.html.erb +++ b/app/views/trips/_trip.html.erb @@ -1,6 +1,10 @@ <% trip.selecteds.order(:hour).each do |selected| %> +
diff --git a/app/views/trips/show.html.erb b/app/views/trips/show.html.erb index 2da1a1b..4aacbf3 100644 --- a/app/views/trips/show.html.erb +++ b/app/views/trips/show.html.erb @@ -2,6 +2,7 @@

<%= notice %>

<% end %> +

Name: <%= @trip.name %> @@ -37,11 +38,14 @@
+

+
+ <%= link_to 'Edit', edit_trip_path(@trip) %> <%= link_to 'Back', trips_path %>

- + From 6580e328be516af6b9468b6f58f51c15067ec1f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Pachas=20Garc=C3=ADa?= Date: Fri, 13 Jan 2012 13:18:55 +0100 Subject: [PATCH 6/8] modificado gemfile para usar postres --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 8a617b7..657c5c4 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ gem 'rails', '3.1.3' # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'sqlite3' - +gem 'pg' # Gems used only for assets and not required # in production environments by default. From 58b6fe4fcad3bf124deb2646bd53b393bc58052d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Pachas=20Garc=C3=ADa?= Date: Fri, 13 Jan 2012 13:23:20 +0100 Subject: [PATCH 7/8] gema pg --- Gemfile.lock | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9283a73..f5651d7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,24 +39,25 @@ GEM coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.1.3) + coffee-script-source (1.2.0) erubis (2.7.0) - execjs (1.2.9) + execjs (1.2.13) multi_json (~> 1.0) hike (1.2.1) i18n (0.6.0) - jquery-rails (1.0.18) + jquery-rails (1.0.19) railties (~> 3.0) thor (~> 0.14) - json (1.6.1) + json (1.6.4) mail (2.3.0) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.17.2) - multi_json (1.0.3) + multi_json (1.0.4) + pg (0.12.2) polyglot (0.3.3) - rack (1.3.5) + rack (1.3.6) rack-cache (1.1) rack (>= 0.4) rack-mount (0.8.3) @@ -81,9 +82,9 @@ GEM rdoc (~> 3.4) thor (~> 0.14.6) rake (0.9.2.2) - rdoc (3.11) + rdoc (3.12) json (~> 1.4) - sass (3.1.10) + sass (3.1.12) sass-rails (3.1.5) actionpack (~> 3.1.0) railties (~> 3.1.0) @@ -93,7 +94,7 @@ GEM hike (~> 1.2) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.4) + sqlite3 (1.3.5) thor (0.14.6) tilt (1.3.3) treetop (1.4.10) @@ -102,7 +103,7 @@ GEM turn (0.8.2) ansi (>= 1.2.2) tzinfo (0.3.31) - uglifier (1.1.0) + uglifier (1.2.1) execjs (>= 0.3.0) multi_json (>= 1.0.2) @@ -113,6 +114,7 @@ DEPENDENCIES cleditor_rails coffee-rails (~> 3.1.1) jquery-rails + pg rails (= 3.1.3) sass-rails (~> 3.1.5) sqlite3 From c6ddd56be7b9d516c65528b138c5b5513616e687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Pachas=20Garc=C3=ADa?= Date: Fri, 13 Jan 2012 13:34:24 +0100 Subject: [PATCH 8/8] stack cedar y sqlite en dev --- Gemfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 657c5c4..ff8f861 100644 --- a/Gemfile +++ b/Gemfile @@ -4,8 +4,9 @@ gem 'rails', '3.1.3' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' - -gem 'sqlite3' +group :development do + gem 'sqlite3' +end gem 'pg' # Gems used only for assets and not required