similar to: small patch for attr_readonly

Displaying 20 results from an estimated 10000 matches similar to: "small patch for attr_readonly"

2009 Jul 02
1
Prevent attribute from being changed with "attr_readonly"
Is there a way to prevent an attribute from being changed from outside the class instance? So that after a record is created, the attribute can be read but cannot be changed from outside the class instance. At first glance, "attr_readonly" seems to be the solution. However, will "attr_readonly" also prevent the attribute from being changed even from inside the class? In
2009 Jul 02
0
validates_uniqueness_of and attr_readonly
I notice that I always want to prevent the unique key of a table from being changed. Does that mean I always have to have attr_readonly right after validates_uniqueness_of ? Is there a single function that replaces both of these but has the same affect? Thanks. -------------------------------------------------------------------------------- Developing with Rails 2.3.2; Ruby 1.8.7 (2009-04-08
2007 Jan 26
7
How to protect attributes from being updated?
Hi! I''m new to Rails! Rails rox! 1 quesion so far: I have :email attribute in User model. I dont'' want :email to allow to be updated. How do i do this with Rails? Do I have to implement required validation manually? Thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails:
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,
2009 Mar 02
0
Implementing conditional read-only attributes of ActiveRecord objects
Hello, my goal is to implement the option of specifying a condition in attr_protected, attr_readonly and possibly other attribute methods in ActiveRecord objects. Rationale (example): class User < AR:Base # User should not be able to modify fields any more once they have been verified attr_readonly :firstname, :lastname, :gender_id, :birthdate, :if => :passport_verified? # ... end
2008 Aug 22
0
[LLVMdev] Dependence Analysis [was: Flow-Sensitive AA]
In the general case, I think you have to be conservative about this because programmers may deliberately want this kind of "wraparound" behavior, e.g., with periodic boundary conditions. But 99.9% of programs probably don't need that so it would be bad to penalize them for this corner case. In such a situation, I think you just have to support both choices, but choose the
2012 Jun 15
1
help in sentDetect() fuction
hello, I am using the following code >s<-"I am very happy, excited, and optimistic.I am very scared, annoyed, and irritated.Iraq?s political crisis entered its second week one step closer to the potential.dissolution of the government, with a call for elections by a vital coalition partner and a suicide attack that extended the spate of violence. that has followed the withdrawal.of
2006 Jan 04
2
Rename lock_version field?
Hi, Is there a way to tell Rails that the magic field name for optimistic database locking is not lock_version? I have a legacy database where the optimistic locking field is named "version". Thanks, Phil -- Posted via http://www.ruby-forum.com/.
2009 Aug 10
1
[PATCH server] Fixed db-omatic so it doesn't die due to an unhandled ActiveRecord::StaleObjectError exception.
The error is caused by the save! method updating an object that another thread (most likely in taskomatic) already updated. In the case of this race condition, we retry saving. However, a proper fix would involve fixing the locking. --- src/db-omatic/db_omatic.rb | 23 ++++++++++++++++++++--- 1 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/db-omatic/db_omatic.rb
2009 Jul 04
12
save! not allowed after validates_uniqueness
I have this in a model validates_uniqueness_of :aspect, :scope => :user_id In an instance method of the same model I have "save!" but I don''t touch the :aspect attribute in that instance method at all. Whenever that save! command is run however I get this error: ActiveRecord::RecordInvalid: Validation failed: Aspect has already been taken I don''t
2008 Aug 22
5
[LLVMdev] Dependence Analysis [was: Flow-Sensitive AA]
On Aug 22, 2008, at 9:30 AM, Vikram S. Adve wrote: > In the general case, I think you have to be conservative about this > because programmers may deliberately want this kind of "wraparound" > behavior, e.g., with periodic boundary conditions. But 99.9% of > programs probably don't need that so it would be bad to penalize them > for this corner case. In such a
2007 May 21
7
How do I stop a column being updated by model.save?
One of my models has a column that is updated very frequently from a separate process, so it is important that when a record is saved in rails, this column should be left alone. In the update method of the controller I have: @record = MyModel.find(params[:id]) @record.update_attributes(params[:my_model]) params[:my_model] doesn''t have a reference to the column I''m talking
2006 Apr 11
1
Implementing Optimistic Offline Lock - How ?
I understand that ActiveRecord supports the "optimistic offline lock"-pattern through magic fields (created_at, updated_at). However, a scaffolded CRUD-Controller doesn''t generate the necessary code to support this feature (the model state gets lost between two action calls). What is the best practice to prevent users from overwriting objects with outdated data ? --
2000 Nov 18
5
Sample still has horrorible distortions... anyone know why?
Hi, I am subscribed to this list, and have learned a lot just from the discussions i see although i don't reply to the msgs, simply coz i'm no big deal programmer. I feel, though, that as i'm really optimistic about vorbis and want it to grow and start to have more and more people using it, i feel that i should warn you about a bug the encoder have (i'm sure monty receives loads
2006 May 09
7
When to use optimistic locking?
Hi All, I''m having some trouble deciding when and how to implement optimistic locking. Let''s say I have a multiuser Rails app, and let''s say it stores, among other things "vital" customer information. The standard methods created by the Rails generate scaffold script look like this: def edit @customer = Customer.find(params[:id]) end
2005 May 25
0
[LLVMdev] llc -march=ia64 support
Hi there, The IA64 architecture, which had its 'official' name changed to the "Itanium Processor Architecture", *is* supported by llc. I am pretty sure you are talking about the x86-64 architecture, which has also had its share of unfortunate name changes and is also known as "AMD64", "EM64T" and all sorts of things in between. x86-64 is *not* currently
2006 May 17
6
ActiveRecord#to_param
Hello, to implement some some kind of optimistic locking, I want to build a view, where an object is displayed together with a link containing the data of the displayed object. My first try looked something like <%= object.object_discription %> <%= link_to "action", :action => "take_action", :data => object %> this won''t work because object is of
2006 Jul 14
1
[LLVMdev] Thanks for llvm!
Hi, I know this is a strange mail and also off topic but since there is no user-list I'll simply post my stuff here ;) I wanted to say a big thank-you for developing llvm, I've always been fascinated by agressive optimizing frameworks like JVMs and other virtual machines and was a bit sad that the gnu-world relies(d) on techniques which have more or less reached their possibilities.
2006 Mar 31
3
can R be run without installation on to a computer
I have been trying for a year to get approval to install R on a work computer and am not optimistic of a positive reply in the near future. I was considering whether an option might be to run R from a CD/USB stick. I looked through the installation manual but could see no mention of this option. If it is possible to run R from a CD or a USB stick without installation to a computer, I would
2008 Nov 10
2
GEN-GEN and Manual Ring-Down (MRD)?
Does anyone here know anything about GEN-GEN analogue circuits, also known as Manual Ring-Down (MRD)? Apparently they are widely used in Hoot'n'Holler systems for financial dealer-boards. I have been asked to try and interface to such circuits, and have been having great difficulty locating any specifications for the interface. Apparently, they are always-on 2-wire analogue circuits with