Displaying 20 results from an estimated 104 matches for "write_attribute".
2009 Sep 23
5
Overriding AR read/write_attribute - Overridden write_attribute Is Never Called
...explain this?
#config/initializers/ar_attributes.rb
module ActiveRecord
module AttributeMethods
alias_method :ar_read_attribute, :read_attribute
def read_attribute(attr_name)
p "read_override"
ar_read_attribute(attr_name)
end
alias_method :ar_write_attribute, :write_attribute
def write_attribute(attr_name, value)
raise ''You made it!''
end
end
end
In the Rails console:
>> person.read_attribute :name
"read_override"
=> "Joe"
>> person.write_attribute :name, "Bilal"
=&g...
2009 Oct 21
1
zfs acls and MS office applications
...y; files within have the same permissions (sans the inheritance).
moe-lh /moe2/office/student_workers 546# ls -vd .
drwxrws---+ 2 toml cefac 5 Oct 20 18:36 ./
0:group:cefac:list_directory/read_data/add_file/write_data
/add_subdirectory/append_data/write_xattr/execute/write_attributes
/write_acl/write_owner:file_inherit/dir_inherit/inherit_only:allow
1:group:cefac:list_directory/read_data/add_file/write_data
/add_subdirectory/append_data/write_xattr/execute/write_attributes
/write_acl/write_owner:allow
2:group:ceoffstu:list_directory/re...
2006 Nov 04
0
write_attribute trouble
Can anyone clarify something for me? I''ve been having a hard time with
write_attribute.
If I do (for instance in a callback):
write_attribute(:user, user)
Is obj.user_id set automatically too? And viceversa, if I do:
write_attribute(:user_id, user.id)
Does that set obj.user for me?
Doesn''t seem like it''s doing that for me.
Anyone understands exactly what wr...
2005 Nov 23
14
ACL issues with ZFS
ZFS introduces a new and incompatible ACL interface into
Solaris and this seems to be not yet fully completed in addition
to the fact that is causes a lot of problems for software that
needs to be compatible with Solaris-2.5 like star.
Proof for incompatibility:
create a file on UFS and set an ACL for this file.
Use Sun tar cpf out file to archive this file.
Unpack this archive file on ZFS
2007 Aug 02
1
write_attribute functionality for related objects?
...:users
end
Is it in any way possible to retain reference to the old users when
they get replaced using group.users=(new_users) ?
The below doesn''t work but illustrates what I''m looking for:
class Group < AR
has_many :users
def users=(new_users)
@old_users = users
write_attribute(''users'', new_users)
end
end
I need to examine the differences when related objects (in this case
users) change.
Morten
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk&qu...
2006 May 10
0
Saving extracted data
Hi there,
I have a file upload form on my page that is for images. In the model I have
this:
def file_data=(file_data)
@file_data = file_data
write_attribute ''extension'',
file_data.original_filename.split(''.'').last.downcase
write_attribute("content_type", file_data.content_type)
write_attribute("current_name", file_data.original_filename)
write_attribute("file_size", file_data...
2006 Jul 14
7
Form validation - keepin correct fields displayed on refresh
All,
I''m finally doing my first real form in Rails - the model object that
I''m entering information for has 8 validations so far.
If I type in good values for all the fields but one, I get the pretty
validation, and the nice field highlighting, but all of the fields are
cleared, forcing me to retype all of that info. That is a big drag.
Is there a standard way to get the
2005 Dec 14
9
Passing quantity in a shopping cart
I am using this line on my index.rhtml page to capture the quantity
required of a particular item for a basic shopping cart app:
<%= text_field ''line_item'', ''quantity'', {:size=>3} %> </td>
but my next screen (a cart screen) doesn''t reflect what was entered in
that text field when the item is added to the cart. That is,
2010 Jan 31
0
? NFSv4 and ZFS: removing write_owner attribute does not stop a user changing file group ownership
...one.
bash-3.00$ id
uid=100(timt) gid=10001(ccbcadmins)
bash-3.00$ groups
ccbcadmins staff
bash-3.00$ ls -v testacl
-rwxrwx---+ 1 timt ccbcadmins 0 Jan 31 16:24 testacl
0:owner@:read_data/write_data/append_data/read_xattr/write_xattr/execute
/delete_child/read_attributes/write_attributes/delete/read_acl
/write_acl/write_owner/synchronize:allow
1:group@:read_data/write_data/append_data/read_xattr/write_xattr/execute
/delete_child/read_attributes/write_attributes/delete/read_acl
/write_acl/write_owner/synchronize:allow
I can change the group own...
2010 Jul 19
3
ActiveRecord override
Would really appreciate it if someone could tell me why this is happening:
I override ssn method of AR class so I can encrypt/decrypt to/from the db:
class Person < ActiveRecord::Base
def ssn=(value)
write_attribute(:borrower_ssn, Crypto.encrypt(self.encryption_key,
value))
write_attribute(:borrower_ssn_final_four, value[5,4])
end
def ssn
# this begin - rescue can be removed once all data is encrypted
begin
return Crypto.decrypt(self.encryption_key,
read_attribute(:borrower_ssn)) if read...
2006 Apr 24
0
ImageMagick and EXIF Data
...images''
THUMBDIRECTORY = ''public/thumbs''
DISPLAY_DIRECTORY = ''/public/uploaded_images/''
DISPLAYTHUMBS_DIRECTORY = ''/public/thumbs/''
after_save :process
after_destroy :cleanup
def file_data=(file_data)
@file_data = file_data
write_attribute ''extension'',
file_data.original_filename.split(''.'').last.downcase
write_attribute("content_type", file_data.content_type)
write_attribute("original_name", file_data.original_filename)
write_attribute("file_size", file_dat...
2008 Feb 28
0
Windows permissions and inheritance
...it looks
ok too, the permissions appear as:
d---r-x---+ 3 ross smith domain users 3 Feb 28 08:24 Departments
0:group:domain admins:list_directory/read_data/add_file/write_data
/add_subdirectory/append_data/read_xattr/write_xattr/execute
/delete_child/read_attributes/write_attributes/delete/read_acl
/write_acl/write_owner/synchronize:file_inherit/dir_inherit:allow
1:group@:list_directory/read_data/read_xattr/execute/read_attributes
/read_acl/synchronize:file_inherit/dir_inherit:allow
However, if I logon to a windows machine as a Domain Admin, and try to
create th...
2006 Feb 06
7
Delaying initialization of associations until first access
...''ve tried variations on the below code, each of which has failed to work.
It *seemed* to work, but it doesn''t persist to the database properly:
class Person < ActiveRecord::Base
has_one :house
def house
if !read_attribute(:house)
h = House.new
h.save
write_attribute(:house, h)
end
read_attribute(:house)
end
end
Can anyone tell me the proper way to accomplish this behavior?
Thanks!
John
2016 Nov 30
1
slow directory access, convert_string_internal: Conversion error: Incomplete multibyte sequence
...9 18:58
/Pool1/Department/Sales
0:user:nobody:read_xattr/read_attributes/read_acl:allow
1:user:root:read_xattr/read_attributes/read_acl:allow
2:group@:list_directory/read_data/add_file/write_data/add_subdirectory
/append_data/read_xattr/write_xattr/execute/delete_child
/read_attributes/write_attributes/delete/read_acl/write_acl
/write_owner/synchronize:allow
3:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
/append_data/read_xattr/write_xattr/execute/delete_child
/read_attributes/write_attributes/delete/read_acl/write_acl
/write_owner/synchronize:allow
#...
2006 Apr 20
5
Integrating with Legacy Databases
This seems like it must have been asked before - I really _did_ try to
find it in the archives, so my apologies if it''s already out there.
Utilizing ActiveRecord, I would like to specify a prefix for the
column names in my table. For example, in ''Recipe 16 Integrating with
Legacy Databases'' (Rails Recipes, from PragProg, by Fowler) they deal
with integration with a
2009 Aug 17
1
Problem with setter override on ActiveRecord
(This message was originally written on StackOverflow -- the
formatting is much prettier there --
http://stackoverflow.com/questions/1283046/problem-with-setter-override-on-activerecord)
This is not exactly a question, it''s rather a report on how I solved
an issue with write_attribute when the attribute is an object, on
Rails'' Active Record. I hope this can be useful to others facing the
same problem.
Let me explain with an example. Suppose you have two classes, Book and
Author:
class Book < ActiveRecord::Base
belongs_to :author
end
class Author < ActiveRecor...
2006 Jul 12
2
Weird problem. How to tell if an attribute has changed? Please help.
How do you tell if an foreign key attribute has been changed?
For example, lets say you have a model with attribute table_a_id.
Would you do this?
def table_a_id=(value)
if value != table_a_id
@table_a_changed = true
write_attribute ''table_a_id'', value
end
end
def table_a=(value)
if value != table_a
@table_a_changed = true
@table_a = value
end
end
I did this and when I try to save the model I get ''undefined method
updated?''. What am I doing wrong her...
2007 Dec 13
2
automatically strip values of activerecord attributes
i am doing a couple of times the following in my models
class User < ActiveRecord::Base
def name=(val)
write_attribute :name, val.to_s.strip
end
end
quite clear, it strips the name when setting it.
now the question: Is it possible to do something like the following ..
and if yes how could i achieve it
class User < ActiveRecord::Base
auto_strip :name, :street
end
thanks...
--
Posted via http://www.ruby-fo...
2016 Nov 30
2
slow directory access, convert_string_internal: Conversion error: Incomplete multibyte sequence
There are definitely some files with some weird names- in an ssh session they don't even have regular characters.
e.g
-rw-rw---- 1 xxx xxx 114985112 Oct 31 14:39 ▒^t
Not sure if that is related to problems though.
The top command shows
Memory: 12G phys mem, 343M free mem, 2048M total swap, 2048M free swap
This is in the evening so should not be much load but I think
2007 Nov 26
6
Model setters, override attribute=(attribute)?
...ected attributes, accessed via domain influence
methods, .set_customer, .process_order etc... I wasn''t really sure how
best to interpret this into ruby on rails models.
class Basket < ActiveRecord::Base
belongs_to :customer_type
belongs_to :customer
def customer=(_customer)
write_attribute(:customer, _customer)
customer_type = _customer.customer_type unless _customer.nil?
end
end
Thanks, Andrew.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this...