This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
validate :something | |
def something | |
errors.add(:person_in_charges, "mensagem_de_erro") if person_in_changes.empty? | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DemandsController < CrudUpdatedController | |
def new | |
object = build_resource | |
object.academic_year = current_academic_year | |
super | |
end | |
private |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SchoolStatusManager | |
def initialize(school) | |
@school = school | |
end | |
def set_status! | |
@school.update_attribute :status, school_status | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe 'POST create' do | |
context 'setting status' do | |
let :entidade do | |
Entidade.make!(:entidade) | |
end | |
it 'should set the status' do | |
post :create, :entidade => entidade.attributes | |
entidade.stub(:status).and_return 'calculated' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#has_many :demands | |
has_many :demand_stages | |
#has_many :enrollment_renewals | |
#has_many :classroom_placings | |
#has_many :pre_enrollments | |
#has_many :employee_positions | |
#has_many :project_classrooms | |
#has_many :course_evaluation_criteria | |
has_many :evaluation_periods | |
has_many :evaluation_criterion_disciplines |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveRecord | |
module PreventChangeCloseAcademicYearDependents | |
def self.included(base) | |
base.before_destroy :validate | |
base.validate :validate, :on => :update | |
end | |
def validate | |
if (respond_to? :academic_year) && (academic_year_is_closed?) | |
errors.add(:base, :academic_year_is_closed) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="yui3-g"> | |
<div class="yui3-u-1-3"> | |
<%= f.input :academic_year %> | |
</div> | |
<div class="yui3-u-2-3"> | |
<%= f.input :school %> | |
</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def change | |
MultipleClassroom.all.each do |multiple_classroom| | |
multiple_classroom.academic_classrooms << multiple_classroom.first_academic_classroom if multiple_classroom.first_academic_classroom | |
multiple_classroom.academic_classrooms << multiple_classroom.second_academic_classroom if multiple_classroom.second_academic_classroom | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#academic_classroom_course_id').bind('change', function(){ | |
academic_classroom_id = this.value(); | |
var url = entity_modal_path(:campo_id => academic_year_id ) | |
$('#academic_record_mec_stage').data('modal-url', url); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Alguma | |
def self.something | |
new(parametro).metodo2 | |
end | |
private | protected | public | |
def metodo2 | |
end |