Displaying 2 results from an estimated 2 matches for "change_attribut".
Did you mean:
change_attributes
2009 Jul 02
1
Prevent attribute from being changed with "attr_readonly"
...;attr_readonly" also prevent the attribute from being changed even
from inside the class?
In other words, will the following method successfully change the values
of attribute_a and attribute_b in model A?
1.Class A < ActiveRecord::Base
2. attr_readonly :attribute_a, :attribute_b
3. def change_attributes(new_a, new_b)
4. self.attribute_a = new_a
5. self.attribute_b = new_b
6. save!
7. end
8. end
I know I can redefine the write accessor if I want to customize the way
a single attribute is changed. However here I would like to change two
attributes in one transaction and prevent each...
2011 Apr 07
0
python for game menus needing mouse but with mwo=force
...pointerDown()
elif keycode == key_click:
pointerClick()
elif keycode == key_exit:
exit()
else :
print "keycode = " , keycode
start = time.time()
d = display.Display()
s = d.screen()
root = s.root
# catch keyPress events
root.change_attributes(event_mask = X.KeyPressMask)
for keycode in keys:
root.grab_key(keycode, X.AnyModifier, 1,X.GrabModeAsync, X.GrabModeAsync)
while True :
root.warp_pointer(mouse['x'],mouse['y'])
d.sync()
elapsed = (time.time() - start)
event = root.display.next_event()
ha...