-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Getting the subjects from an external xml
- Loading branch information
1 parent
0c3665a
commit d52a179
Showing
5 changed files
with
83 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,2 +1,12 @@ | |||
require 'rexml/document' | |||
include REXML | |||
|
|||
class Materia < ActiveRecord::Base | class Materia < ActiveRecord::Base | ||
|
|||
validates_uniqueness_of :code | |||
|
|||
def self.load_from_xml | |||
Document.new(File.new("public/materias.xml")) | |||
end | |||
|
|||
end | end |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,42 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
|
|||
<!-- | |||
Document : materias.xml | |||
Created on : November 28, 2010, 4:05 PM | |||
Author : cfernandezg | |||
Description: | |||
Purpose of the document follows. | |||
--> | |||
|
|||
<materias> | |||
<materia nombre="proyecto" codigo="ST0042" creditos="3" umes="3"> | |||
<profesor nombre="jaime acosta"/> | |||
<descripcion>La descripcion de la materia</descripcion> | |||
<programa url="www.programa.com"/> | |||
<homepage url="www.home.com"/>" | |||
</materia> | |||
<materia nombre="topicos" codigo="ST0052" creditos="3" umes="3"> | |||
<profesor nombre="carlos"/> | |||
<descripcion>La descripcion de la materia</descripcion> | |||
<programa url="www.programa.com"/> | |||
<homepage url="www.home.com"/>" | |||
</materia> | |||
<materia nombre="analisis" codigo="ST0038" creditos="3" umes="3"> | |||
<profesor nombre="miguel"/> | |||
<descripcion>La descripcion de la materia</descripcion> | |||
<programa url="www.programa.com"/> | |||
<homepage url="www.home.com"/>" | |||
</materia> | |||
<materia nombre="bases de datos" codigo="ST0040" creditos="3" umes="3"> | |||
<profesor nombre="juan"/> | |||
<descripcion>La descripcion de la materia</descripcion> | |||
<programa url="www.programa.com"/> | |||
<homepage url="www.home.com"/>" | |||
</materia> | |||
<materia nombre="sistemas operativos" codigo="ST0036" creditos="3" umes="3"> | |||
<profesor nombre="alberto"/> | |||
<descripcion>La descripcion de la materia</descripcion> | |||
<programa url="www.programa.com"/> | |||
<homepage url="www.home.com"/>" | |||
</materia> | |||
</materias> |