Skip to content

Instantly share code, notes, and snippets.

View dennermiranda's full-sized avatar

Dener Miranda dennermiranda

View GitHub Profile
Webgrades::Application.routes.draw do
devise_for :users
devise_scope :user do
get '/login' => 'devise/sessions#new'
get '/logout' => 'devise/sessions#destroy'
end
resources :user, :controller => "user"
#match 'inicio', :controller => 'user', :action => 'index'
match 'grades/aluno' => 'grades#aluno'
activesupport (3.0.0) lib/active_support/inflector/methods.rb:113:in `constantize'
activesupport (3.0.0) lib/active_support/inflector/methods.rb:112:in `each'
activesupport (3.0.0) lib/active_support/inflector/methods.rb:112:in `constantize'
activesupport (3.0.0) lib/active_support/core_ext/string/inflections.rb:43:in `constantize'
cancan (1.4.0) lib/cancan/controller_resource.rb:102:in `resource_class'
cancan (1.4.0) lib/cancan/controller_resource.rb:109:in `resource_class_with_parent'
cancan (1.4.0) lib/cancan/controller_resource.rb:37:in `authorize_resource'
cancan (1.4.0) lib/cancan/controller_resource.rb:25:in `load_and_authorize_resource'
cancan (1.4.0) lib/cancan/controller_resource.rb:9:in `send'
cancan (1.4.0) lib/cancan/controller_resource.rb:9:in `_callback_before_47'
@dennermiranda
dennermiranda / gist:661019
Created November 3, 2010 12:18
GradesController
class GradesController < ApplicationController
#load_and_authorize_resource
def aluno
@aluno =Aluno.find(current_user.associable_id)
@pessoa = Pessoa.find(@aluno.pessoa_id)
@aluno_diario = AlunoDiario.where(:aluno_id => @aluno.id).to_a
@aluno_diario.each{|alunod|
@diario = Diario.where(:id => alunod.diario_id)