Displaying 20 results from an estimated 94 matches for "read_attributes".
Did you mean:
read_attribute
2006 Feb 06
7
Delaying initialization of associations until first access
Guys,
Say I have the following:
-----
class Person < ActiveRecord::Base
has_one :house
end
class House < ActiveRecord::Base
belongs_to :person
attr_accessor :color
end
-----
Then I have the following code:
-----
john = Person.new
john.house.color = "Blue"
john.save
-----
What I would like to have happen, is that on first call to john.house, if
house hadn''t been
2006 May 10
13
Issue in ActiveRecord generated reader methods
Hi all!
I have come into a strange issue in Rails that I am hoping someone
can shed some light.
To make a very long story short, I have been researching how to
override ActiveRecord::Base#read_attribute and write_attribute to
perform security checks at the model level (influenced by the
ModelSecurity generator). Shortly after implementing some code to
check this behavior, I began to
2006 Jun 21
8
Modifying Model Output
Hi!
I''m a very-very new Ruby-on-Rails user even if I have some experience
with other Languages (mostly PHP, so this is my first real
object-oriented language)
My problem, newbie-ish as it is, is the following: I have a model,
Article, that returns Articles from the DB. Now, when a certain field of
the model (the intro text) contains no data, I want to fill it with a
truncated
2016 Nov 30
1
slow directory access, convert_string_internal: Conversion error: Incomplete multibyte sequence
...but can't.
Solaris ZFS file systems supports ACL's similar to windows in the sense
that not limited to a single user and single group.
# ls -lvd /Pool1/Department/Sales
drwxrwx---+ 13 jsmith sales 48 Nov 29 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:a...
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
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
2006 May 09
11
model filter?
Hi All,
Is there a way to filter / modify the output of a model class before
it''s returned to controller/view that''s calling it?
Example: I have a field phone_number which I always want to preformat
using the number_to_phone() helper....
Any help is appriciated.
Thanks!
--
Posted via http://www.ruby-forum.com/.
2006 Jul 02
7
How can I intercept attribute calls?
Hi.
I have two types of fields in my database, e.g. "name" and "name_ru".
First one is a user''s name in english and the second one is in russian.
I want to intercept calls like "c.name" and add "_ru" to it if current
language is russian (I have my own Locale class like n Globalize).
So I want such thing:
--
Locale.set("en-US")
c.name
2009 Sep 23
5
Overriding AR read/write_attribute - Overridden write_attribute Is Never Called
Could someone 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)
2008 Feb 28
0
Windows permissions and inheritance
...nd under Solaris 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...
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
2007 Dec 15
2
Reading Model data before update
Hi all,
here is the challenge:
I have this validation method, that basically prevents an object which
billed = true to be updated:
def before_update
if read_attribute(:billed)
errors.add_to_base(''This service has already been billed for'')
end
!read_attribute(:billed)
end
The above code does not work in case I do something like:
object =
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
2010 Jan 31
0
? NFSv4 and ZFS: removing write_owner attribute does not stop a user changing file group ownership
...othing for everyone.
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 chan...
2006 Aug 19
5
Form helpers don''t work with facade columns?
Hello all,
I''ve been trying to use a facade column but I notice that the form
helpers don''t seem to respect the facade.
In the following example I''m trying to story the prices as Integer
values but present them to the user as decimals.
class Product < ActiveRecord::Base
def price=(new_price)
write_attribute(:price, Float(new_price)*100)
end
def price
2009 Nov 09
3
How can I improve a Ruby on Rails code that hast a lot of SQL as strings?
Hello Railists,
I have a piece of Ruby on Rails code that has a complex SQL query (well, not
that complex, but as far as I know beyond the ORM capabilities) and for my
taste it has too many strings and harcoded values. I''d like to improve it as
much as possible, so my question is open ended, what else can I do to
improve it?
Some particular issues I have
- Is there a way to get a table
2006 Feb 20
0
Override automatic accessor for reference field in model
When a column in a database table is actual data, rather than an fkey to
another table, I can override the automatic accessor by just doing the
following:
def field_name
# do something here
read_attribute(field_name)
end
This does not seem to work for me if the field is an fkey, say user_id,
linking to another table. I''ve made this work by aliasing the accessor
like this:
alias
2004 Nov 22
0
Can''t set then read id on AR class in 0.8.5
I''m learning rails and have a test application which parses parts an
XML file to create AR objects and puts them in a database. The IDs in
the database are taken from the XML, i.e. I explicitly set them using
#id. The XML structure is mapped to AR relationships using has_many,
belongs_to etc. I''m using a SAX parser, creating objects when the
element start tag occurs and saving
2014 Feb 20
0
Solaris Extended ACLs samba-3.6 vs samba-4.1 differences
...except for the write_acl part.
It looks like this:
chown root username
chmod A- username
chmod og-rwx username
chmod A+user:username:write_acl:deny username
chmod A+user:username:list_directory/read_data/add_file/write_data/add_subdirectory/append_data/read_xattr/write_xattr/execute/delete_child/read_attributes/read_acl/write_owner/synchronize:allow username
chmod A+group@:read_xattr/read_attributes/read_acl/synchronize:allow username
chmod A+everyone@:read_xattr/read_attributes/read_acl/synchronize:allow username
This all works very well when using an NFS mounted filesystem, and works with samba-3.6.22....
2006 Jul 13
4
Does text_field go directly to attributes hash in AR object?
All,
I''m having a hell of a time figuring out what is going on here.
I''m trying to override one of my getters so that I can format it a
certain way in my form. But I can''t seem to get text_field to call the
appropriate method on my object.
So here''s my getter:
public
def FAX
fax = read_attribute(:FAX)
puts fax