Commit 9917c631cdd26318b461b5d13d8a056e86e2cf18
1 parent
0db12ddd
Exists in
staging
and in
42 other branches
Making sti work with namespaced models
Showing
2 changed files
with
18 additions
and
1 deletions
Show diff stats
config/environment.rb
test/unit/environment_test.rb
| ... | ... | @@ -1140,4 +1140,21 @@ class EnvironmentTest < Test::Unit::TestCase |
| 1140 | 1140 | end |
| 1141 | 1141 | end |
| 1142 | 1142 | |
| 1143 | + should 'not conflict to save classes with namespace on sti' do | |
| 1144 | + class School; end; | |
| 1145 | + class Work; end; | |
| 1146 | + class School::Project < Article; end | |
| 1147 | + class Work::Project < Article; end | |
| 1148 | + | |
| 1149 | + title1 = "Sample Article1" | |
| 1150 | + title2 = "Sample Article2" | |
| 1151 | + profile = fast_create(Profile) | |
| 1152 | + | |
| 1153 | + p1 = School::Project.new(:name => title1, :profile => profile) | |
| 1154 | + p2 = Work::Project.new(:name => title2, :profile => profile) | |
| 1155 | + | |
| 1156 | + p1.save! | |
| 1157 | + p2.save! | |
| 1158 | + end | |
| 1159 | + | |
| 1143 | 1160 | end | ... | ... |