similar to: Best Practice: Validating and returning conflicting object

Displaying 20 results from an estimated 30000 matches similar to: "Best Practice: Validating and returning conflicting object"

2008 Apr 30
6
best practice for object transaction?
I have a new @offer that needs to generate a document if saved. But that''s all or nothing: transaction do @offer.save! generate_document end # handle exceptions if needed If save! fails everything is fine, but if generate_document raises an exception @offer is left as a model with timestamps, id, which is not a new_record? anymore (though the database was
2006 Apr 18
6
Best Practice for Returning to Calling Page?
I have a partial, it''s a shopping cart display, it''s designed to appear on several different pages of my site. One of the buttons on the shopping cart empties the cart, and then I want the calling page to redisplay. In other words, the cart controller needs to return the visitor to the same page -- however since the cart could appear on any given page, this has to be
2006 Jun 12
2
Validating a non-object attribute in a form via checkbox?
Hi there A user can place an ad with various attributes via a form; however, I want the user to check a box signifying that they''ve read the terms and conditions for use of the site. So the ''terms'' is not an attribute of the Advertisement model. I could check that the user has ticked the box in my controller but would like to bundle this up with the validation
2019 Aug 07
0
best practice for domain admins
Good one Norbert, And this is exacly as im doing my software installs. My collega finds it very annoying. :-) I also added ( through GPO ) that, once your logged in the Domain, all software add/remove functions are disabled, even for Domain admins, only "local - pc admins" can install software. ( use .\localInstallAdmin ) where "." is equal to the pc name. That is
2006 Jan 03
1
validating model without saving
Hi all, I would like to validate my model without actually saving it to the database. Actualy I need it as follows: User enters user details in a post form. When the user submits the form I would like the form to be validated. However, when validation passes, I don''t want to save the model yet, but I would like to store it in Session context. Is this possible at all? And if so, how
2018 Mar 06
1
best practice nfs and samba file lock
Hi, i'm searching for best practice in configuration a dual head nfs / samba server. At the moment samba 3.6.x is used, an yes i'll know it is EOL. We have the problem if the windows client open a file, the aix nfs client doesn't recognize the lock and overwrite the file. Is there a solution for this or is this the hell of nfs locking ;-) best regards Michael -- Michael Wandel
2006 Apr 26
1
Observer best practices
I''ve seen two ways of connecting observers: 1) In the observer class put observe MyModel 2) In the controller class put observer :my_observer What is the difference between these two? Also, is it necessary to put in the observer class the following? MyObserver.instance Jose -- Posted via http://www.ruby-forum.com/.
2006 Jan 17
5
file_column mangling URL
Hey, I''ve gotten file_column to upload a file, drop it in the dynamic directory, but I can''t display the image, the directories repeat themselves: My model: class Person < ActiveRecord::Base file_column :image_url In my view: <%= image_tag url_for_file_column(''person'', ''image_url'') %> HTML generated is this: <img
2006 Mar 23
4
RJS and Form Validation (Best Practice)
Hello All ! I''ve been using RJS extensively, but haven''t done any form validation with it until now. Should I be manually passing the RJS template some models error messages from the controller.... or ... should I be using error_messages_for in order to do the display ? I''ve implemented the first approach, but it seems like quite a hack. Any insight would be greatly
2019 Feb 10
0
AD Backup Best Practice
On Sun, 10 Feb 2019 14:13:27 +0100 Viktor Trojanovic via samba <samba at lists.samba.org> wrote: > I'm currently reviewing my own backup strategy for Samba and I > realize it is not in line with best practices provided in the Wiki. ( > https://wiki.samba.org/index.php/Back_up_and_Restoring_a_Samba_AD_DC) > Said best practices, however, seem a bit like a nightmare to me. >
2013 May 07
1
packages (binary) update best practice
Hi all, I have update recently to freebsd 9.1 via freebsd-update and I was quite happy with the process and the instructions on freebsd-handbook, I think well documented. But I would like to understand what is the best practice to update the ports too as I used the package tools (pkg_add -r) to add few package to the base install. Keeping in mind my server have disk space constrain (small disk
2009 Dec 31
1
Single Validation Error... best practices?
So a lot of Rails apps (mine included) have multiple validations on a single attribute. For example: on the password field, validating that it is (a) not blank, (b) matches the confirmation, (c) is at least X characters long, and (d) contains at least 1 alpha and at least 1 numeric character. The problem is: if that field is blank, the default errors shows all four. That''s a little
2008 Apr 11
2
Validating an ActiveRecord object and its has_many :through associations
Considering an object with several has_many :through => associations, what is the ''best'' way to handle validations? As an example: class Student < ActiveRecord::Base # some attrbutes like # :name # :grade # relationships has_many :students_assignment, :dependent => :destroy has_many :assignments, :through => :students_assignment has_many
2006 Jun 10
1
Validating Object Without Saving It
Is their a way to validate an object without saving it? So I can do something like this if user.save else end But where save is just validating it but not actually saving it into DB. I just don''t want to save the object yet. Thanks guys and gals :-) John Kopanas http://www.kopanas.com ============================================================ http://www.soen.info - Index of
2019 Feb 10
0
AD Backup Best Practice
A good practice is to have at least 2 DCs in a domain. If one crashes, you can reinstall one from scratch, join it to the domain and it will synchronize with the safe one. And your services should not stop in the meantime. That doesn’t prevent us from setting up backups, but that reduce risks a lot. :-) G. > Le 10 févr. 2019 à 17:07, Viktor Trojanovic via samba <samba at
2012 Jan 17
0
What is the best way to validate a json object? (POST request)
I must create a class (JobClass) and include ActiveModel::Validations? and then valided = JobClass.new(params).valid? The JSON body : http://pastebin.com/TwRbydmq I can not create rules corresponding to the validation of the field "method" ... It can be "concat" or "split" but it is not the first level. How can I do? Thanks -- Posted via
2019 Feb 10
0
AD Backup Best Practice
I am cc'ing Tim Beale on this, he wrote the wikipage and, I think, most of the backup & restore code. On Sun, 10 Feb 2019 17:07:55 +0100 Viktor Trojanovic <viktor at troja.ch> wrote: > See comments inline. > > On Sun, 10 Feb 2019 at 16:33, Rowland Penny via samba > <samba at lists.samba.org> wrote: > > > On Sun, 10 Feb 2019 14:13:27 +0100 > >
2006 Jun 30
2
best practice: raise an exception or return false
just wondering how others deal with invalid/illegal operations on their models? until now, I''ve simply been returning true or false depending on wether or not the operation succeeded, but that doesn''t tell the calling function why the operation failed (if it failed). I could use custom exceptions, but is it good practice to raise an exception on every invalid action or just
2006 Jul 11
1
Validating composed_of
Hi, How do I validate a composed_of attribute in my model? I have a product model with: composed_of :price, :class_name => ''Money'', :mapping => %w(cents cents) This maps the price attribute to the Money (http://dist.leetsoft.com/api/money/) class. I want to make sure that the price only contains a price to 2 decimal places i.e. 1.25. This is because if someone enters
2007 Apr 19
5
Best practice thoughts: Model helpers, mocks
Hello! I''m pretty new to unit testing, and have only been using RSpec for a few weeks. I found that for my controller specs, my setup methods were getting very long building mocks/stubs for all the model objects I needed to work with. I''ve started creating helpers like the following for each of my models. The "min_" methods are short for "minimum", and