search for: setter

Displaying 20 results from an estimated 302 matches for "setter".

Did you mean: better
2006 Apr 21
2
Using before_create and conflicting setter method...
Hi, I am having trouble using before_create when I have an specialized setter method: before_save :set_campaign_start #----------------------------------------------------------------------- ------- def set_campaign_start self.campaign_start = Time.now end # We want the date to always start at midnight #-------------------------------------...
2006 May 07
1
Overwriting setters for associated objects
Hi all, I''m trying to overwrite a setter method, but am running into some difficulties. This is normally really easy when overwriting a setter for a table column, but in this case it is the setter for an associated object. Here''s a hypothetical example: class User < ActiveRecord::Base has_many :posts end class...
2010 Apr 18
1
Getter and Setter with non DB property
Hi, I can''t find how do i created a getter and setter property for a non db property. what i have done isnt working, i have a cnt mass assign error. Here is what i''ve done: attr_accessor :creator_is_participant def creator_is_participant @participe end def creator_is_participant=(participe) if participe == true @parti...
2013 Apr 22
0
setter method in rails 4 beta 1
I have a virtual attribute ''tags'' , and defined a setter method for it tags=(val). My setter method is not called while creating a Article. I copied my rails 3.2.11 code in rails 4, it was perfectly working in former. I want to know who can i use setter method for virtual attribute in rails 4. Or is it a bug in rails 4. I raised this as a issue in...
2011 Dec 02
2
[LLVMdev] deglobalizing TargetOptions
...One of the things that I found is that the TargetOptions are all global; you could create a TargetMachine targeting ARM and X86 in two threads, but they both have to share the same FloatABIType setting. This is silly, and I plan to fix it by moving all the globals in TargetOptions into getters and setters on TargetMachine. This means that the TargetMachine object is going to get a bit bigger to accommodate, but at least two users of llvm linked into one program won't step on each other. The existing command-line options will move from TargetMachine into llc which will use the same setters. This...
2007 Dec 16
4
Make AR setter methods private?
Hi, I have a AR model that I want to limit changes to be only via instance methods that I''ve added. How do I prevent my other sw from setting the instance''s attributes? I know about #attr_protected and #attr_readonly. But the first leaves the individual setters as they were and the second stops all changes. I want something like "attr_private" Thoughts? Thanks, Larry -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups &quo...
2011 Jun 04
1
S4 class, passing argument names to function, modify original
Hello, an S4 class "Foo" is defined with a setter, $. For several reasons, the setter calls a function, .foo.update(). However, bypassing the argument names of the setter does not work. Question 1: Why not and how can I fix this? Question 2: What is the way to define either the function or the setter to modify the original object (not returning th...
2008 May 18
4
[LLVMdev] Opaque type usage to represent foreign types
In my project I have a group of foreign types (C++ classes) that I want to use, but don't want to represent as structs within LLVM. For example, for each field in each C++ class I have a setter and getter function that I'd like to use. The setters and getters are "extern C" functions to avoid problems with C++'s name mangling. After going over the documentation it seems like I can do this by creating a unique opaque type for each C++ class to track types during...
2006 Jun 01
1
Automatted Getter/Setter
...hat has a lot of number fields. Each of these go through a process when read in and read out to add/remove commas (between every three numbers) to make them more readable. The getter I currently have is like this: def sale_price Listing.insert_commas(read_attribte (:sale_price)) end and the setter is: def sale_price=(price) write_attribute(:saleprice, Listing.remove_commas(price)) end The trouble is there is at least 5 other fields that need the same thing done for them (and most likely more will be added in time). I was wondering if there is some way I could do this more automatted l...
2011 Dec 02
0
[LLVMdev] deglobalizing TargetOptions
...found is that the TargetOptions are all global; you could create a > TargetMachine targeting ARM and X86 in two threads, but they both have > to share the same FloatABIType setting. > > This is silly, and I plan to fix it by moving all the globals in > TargetOptions into getters and setters on TargetMachine. This means > that the TargetMachine object is going to get a bit bigger to > accommodate, but at least two users of llvm linked into one program > won't step on each other. Sounds great. > The existing command-line options will move > from TargetMachine into...
2011 Dec 02
2
[LLVMdev] deglobalizing TargetOptions
...argetOptions are all global; you could create a >> TargetMachine targeting ARM and X86 in two threads, but they both have >> to share the same FloatABIType setting. >> >> This is silly, and I plan to fix it by moving all the globals in >> TargetOptions into getters and setters on TargetMachine. This means >> that the TargetMachine object is going to get a bit bigger to >> accommodate, but at least two users of llvm linked into one program >> won't step on each other. > > Sounds great. > >> The existing command-line options will move...
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. Sup...
2015 Nov 20
1
Good practice for naming classes, builders, attributes, getters/setters for object composition
Hey everyone, I am developing a package and I am wondering if there is a good practice for naming classes, builders, attributes getters and setters when dealing with object composition. I know that it is usually a good practice to give to the builder the same name as the class and, if possible, to avoid to use upper case letters. My problem is that, when I build an object containing an other object (of an other class), at the end my getters c...
2024 Jul 15
0
[ANNOUNCE] libnftnl 1.2.7 release
...library providing a low-level netlink programming interface (API) to the in-kernel nf_tables subsystem. This library is currently used by nftables. This release contains fixes only: * Avoid potential use-after-free when clearing set's expression list * Avoid misc buffer overflows in attribute setters * Implement nftnl_obj_unset symbol already exported in libnftnl.map * Remove unimplemented symbols from libnftnl.map * Drop some unused internal functions * Validate per-expression and per-object attribute value and data length * Enable some attribute validation where missing * Fix synproxy object...
2005 Dec 25
0
Setter not being called
I have written the followign setter to raise an exception when the field disabled_on is beeing assigned a value minor or equal that the enabled_on field. class Survey < ActiveRecord::Base def disabled_on=(date) raise AssignmentException if date != nil and date <= self.enabled_on write_attribute(:disabled_on, date)...
2011 May 26
0
Reference Classes: getter and setter functions/methods and possible shortcuts
Hi everyone, just wanted to ask what's the smartest/recommended way of defining getter and setter function *shortcuts* (i.e. something like "[", "[<-") for Reference Class objects? Or is it desired to not use this stuff, but define methods like 'obj$getSubset(row=1:3, col=1)' and 'obj$setSubset(value=x)' instead? I have some example code that might help...
2006 Nov 07
0
somebody is calling my setters in the webservices!!!
a simple code to define a web service structures: class CLL_Answer < CLL_Struct member :answer, :bool member :answer_description, :string member :error, :bool member :error_description, :string # This is my setter def error_description=(value) @answer_description = nil @error = true @error_description = value end end and now, the webservice class UnifiedLoginApi < ActionWebService::API::Base api_method :test1, :returns => [CLL_Answer] end class UnifiedLoginController...
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
2011 Jul 30
22
Question about Helpers
Studying the RoR 3 Tutorial book by Michael Hartl and on page 345 there''s the code inside the SessionsHelper: _________________________________________________________ module SessionsHelper def sign_in(user) cookies.permanent.signed[:remember_token] = [user.id, user.sault] self.current_user = user end end __________________________________________________________ What is the purpose
2009 Mar 15
0
Assigning to factor[[i]]
I am a bit confused about the semantics of classes, [, and [[. For at least some important built-in classes (factors and dates), both the getter and the setter methods of [ operate on the class, but though the getter method of [[ operates on the class, the setter method operates on the underlying vector. Is this behavior documented? (I haven't found any documentation of it.) Is it intentional? (i.e. is it a bug or a feature?) There are also cases w...