Skip to content

Instantly share code, notes, and snippets.

View pluralism's full-sized avatar

André Pinheiro pluralism

  • Critical TechWorks
  • Porto, Portugal
View GitHub Profile
Processing by Devise::SessionsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"/yBhYDL+oHZSFZWvsYb+TKfGhgcBKTCZr9q4U0bZz6Y=", "admin"=>{"email"=>"[email protected]", "password"=>"[FILTERED]"}, "commit"=>"Sign In"}
Admin Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = '[email protected]' ORDER BY "users"."id" ASC LIMIT 1
Completed 401 Unauthorized in 89ms
Processing by Devise::SessionsController#new as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"/yBhYDL+oHZSFZWvsYb+TKfGhgcBKTCZr9q4U0bZz6Y=", "admin"=>{"email"=>"[email protected]", "password"=>"[FILTERED]"}, "commit"=>"Sign In"}
Rendered admins/sessions/new.html.erb within layouts/application (1.1ms)
Completed 200 OK in 71ms (Views: 5.5ms | ActiveRecord: 0.0ms)
User model
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
attr_accessible :name, :email, :password, :password_confirmation, :role
belongs_to :userable, :polymorphic => true
class DeviseCreateUsers < ActiveRecord::Migration
def change
create_table(:users) do |t|
## Database authenticatable
t.string :email, :null => false, :default => ""
t.string :encrypted_password, :null => false, :default => ""
## Recoverable
t.string :reset_password_token
t.datetime :reset_password_sent_at
<%= form_for @stage do |f| %>
<% if @stage.errors.any? %>
<% @stage.errors.full_messages.each do |msg| %>
<p><%= msg %></p>
<% end %>
<% end %>
<%= f.text_field :stage_name %>
<%= f.number_field :distance %>
<%= f.date_select :stage_date %>
<%= f.number_field :difficulty %>
<%= form_for @race do |f| %>
<%= f.fields_for :stages do |builder| %>
<%= builder.text_field :stage_name %>
<%= builder.number_field :distance %>
<%= builder.date_select :stage_date %>
<%= builder.number_field :difficulty %>
<%= builder.text_field :stage_description %>
<% end %>
<% if @stage.errors.any? %>
<% @stage.errors.full_messages.each do |msg| %>
Started PATCH "/races/12" for 127.0.0.1 at 2014-03-08 13:38:43 +0000
Processing by RacesController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"2CW75goDqyyVbiehBPwdoLNV2AmokjbK1cBy4yUUA+I=", "race"=>{"stages_attributes"=>{"0"=>{"stage_name"=>"Test stage", "distance"=>"100", "stage_date(1i)"=>"2014", "stage_date(2i)"=>"3", "stage_date(3i)"=>"12", "difficulty"=>"2", "stage_description"=>"Testing the stages feature"}}}, "commit"=>"Guardar etapa!", "id"=>"12"}
Race Load (0.1ms) SELECT "races".* FROM "races" WHERE "races"."id" = ? LIMIT 1 [["id", "12"]]
Unpermitted parameters: stages_attributes
(0.1ms) begin transaction
Race Load (0.1ms) SELECT "races".* FROM "races" ORDER BY "races"."id" ASC LIMIT 1000
(0.0ms) rollback transaction
Rendered races/update.html.erb within layouts/application (0.0ms)
Completed 200 OK in 7ms (Views: 4.3ms | ActiveRecord: 0.3ms)
class RacesController < ApplicationController
# Redirect the admin to the admin login page if he/she is not authenticated
before_filter :authenticate_admin!, :only => [:new, :create, :edit]
def new
@race = Race.new
@user ||= current_user || current_admin || current_staff
end
<% provide :title, "A editar evento #{@race.name}" %>
<% if @race.stages.count == 0 %>
<h2>Ainda não existe nenhuma etapa marcada para este evento!</h2>
<%= form_for @race do |f| %>
<%= f.fields_for :stages do |builder| %>
<%= builder.text_field :stage_name %>
<%= builder.number_field :distance %>
<%= builder.date_select :stage_date %>
<%= builder.number_field :difficulty %>
Started PATCH "/races/12" for 127.0.0.1 at 2014-03-08 13:54:42 +0000
Processing by RacesController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"2CW75goDqyyVbiehBPwdoLNV2AmokjbK1cBy4yUUA+I=", "race"=>{"stages_attributes"=>{"0"=>{"stage_name"=>"doawid poawid ", "distance"=>"123", "stage_date(1i)"=>"2014", "stage_date(2i)"=>"3", "stage_date(3i)"=>"8", "difficulty"=>"2", "stage_description"=>"aodi apowid apwod i"}}}, "commit"=>"Guardar etapa!", "id"=>"12"}
Race Load (0.2ms) SELECT "races".* FROM "races" WHERE "races"."id" = ? LIMIT 1 [["id", "12"]]
Unpermitted parameters: stages_attributes
(0.1ms) begin transaction
Race Load (0.3ms) SELECT "races".* FROM "races" ORDER BY "races"."id" ASC LIMIT 1000
(0.1ms) rollback transaction
Rendered races/update.html.erb within layouts/application (0.1ms)
Completed 200 OK in 17ms (Views: 8.6ms | ActiveRecord: 0.7ms)
class AddRaceIdToStages < ActiveRecord::Migration
def change
add_column :stages, :race_id, :integer
end
end