public
Fork of tablatom/hobo
Description: The web app builder for Rails
Homepage: http://hobocentral.net
Clone URL: git://github.com/drnic/hobo.git
Search Repo:
oops - adding missing bits from Tom's commit that I missed on conflict 
resolution
drnic (author)
Sat May 17 03:05:12 -0700 2008
commit  440a0a40cbaae8121c94e4e3635a538f371f1db2
tree    8d842623d7c89dd6a1d780220d63bf87583e01a2
parent  f72362fb2e8688e5fdffd7b0b07c510c546f52e5
...
282
283
284
 
 
 
 
 
 
 
285
 
286
287
288
289
290
...
328
329
330
331
332
333
334
335
336
337
338
339
340
 
 
 
 
 
 
 
 
 
 
 
341
342
 
343
344
 
 
345
346
347
...
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
...
336
337
338
 
 
 
 
 
 
 
 
 
 
339
340
341
342
343
344
345
346
347
348
349
350
 
351
352
 
353
354
355
356
357
0
@@ -282,7 +282,15 @@
0
         "#{name.underscore.pluralize}"
0
       end
0
 
0
+ def with_acting_user(user)
0
+ old = acting_user
0
+ self.acting_user = user
0
+ result = yield
0
+ self.acting_user = old
0
+ result
0
+ end
0
 
0
+
0
       def typed_id
0
         HoboFields.to_name(self) || name.underscore.gsub("/", "__")
0
       end
0
0
0
@@ -328,20 +336,22 @@
0
 
0
 
0
     def user_changes(user, changes={})
0
- if new_record?
0
- self.attributes = changes
0
- set_creator(user)
0
- Hobo.can_create?(user, self)
0
- else
0
- original = duplicate
0
- # 'duplicate' can cause these to be set, but they can conflict
0
- # with the changes so we clear them
0
- clear_aggregation_cache
0
- clear_association_cache
0
+ with_acting_user user do
0
+ if new_record?
0
+ self.attributes = changes
0
+ set_creator(user)
0
+ Hobo.can_create?(user, self)
0
+ else
0
+ original = duplicate
0
+ # 'duplicate' can cause these to be set, but they can conflict
0
+ # with the changes so we clear them
0
+ clear_aggregation_cache
0
+ clear_association_cache
0
 
0
- self.attributes = changes
0
+ self.attributes = changes
0
 
0
- Hobo.can_update?(user, original, self)
0
+ Hobo.can_update?(user, original, self)
0
+ end
0
       end
0
     end
0
 

Comments

    No one has commented yet.