similar to: Rails validation is inefficient

Displaying 20 results from an estimated 40000 matches similar to: "Rails validation is inefficient"

2006 Sep 12
4
ActiveRecord Validations - validates_uniqueness_of
Hello, I''m wanting to use Mocha and Stubba for my tests in place of the default Rails testing with fixtures. I have the following class: class Person < ActiveRecord::Base validates_uniqueness_of :email end and am wondering how I can test to ensure that the validates_uniqueness_of validation is running. Any ideas? -Jonathan
2009 Mar 31
9
Application without database.yml
Hi, I have created one application. In that application I am not using any database. Whenever I starting rails server it is giving me an error for configuration of database.yml. What should I do for this? Thanks, Tushar -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups
2008 Nov 22
3
rawk no longer works on Rails 2.2.2
I just wanted to let you know that the hack to make rawk work on Rails 2.2.2 by grouping action calls no longer works. This is the hack, I have put the TODO where the line crashes Rails: -- module ActiveSupport class BufferedLogger def add(severity, message = nil, progname = nil, &block) return if @level > severity message = (message || (block && block.call) ||
2009 Jan 20
2
Do I need an SSL certificate to use ActionMailer 2.2.2?
Hi guys - I''m sorry to post about this issue again but after several days I still cannot get ActionMailer working and I''ve been through every tutorial/forum looking for the answer. I know ActionMailer now requires SSL validation, does that mean I need to purchase an SSL certificate before I can send emails? If not, is there anyone out there who can help me set up my mailer to
2008 Jul 13
4
How to justify text in text_field_tag
I would like to have the text in a text_field_tag right justified instead of left justified. Is there a way to do this? Thanks, Alex -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2006 Dec 05
4
has_many with :uniq not working for me
Hi all, I have a relationship (no really!) class RiskMatrix < ActiveRecord::Base has_many :severities, :order => :position, :uniq => true end class RiskFactor < ActiveRecord::Base belongs_to :risk_matrix validates_presence_of :descriptor, :example validates_uniqueness_of :descriptor, :example, :scope=> :risk_matrix_id end class Severity < RiskFactor
2010 Aug 16
2
Form validation and processing w/o model (no Db/ActiveRecord)
All - Trying not to fight rails on this, basically have a form and all the same as would be with an ActiveRecord model except that there is no table. I started out using this article: http://stackoverflow.com/questions/315850/rails-model-without-database ...which is kind of a hack by inheriting ActiveRecord in to non-AR model but am running into some problems and just have the feeling that I am
2008 Dec 04
1
permalink_fu and Rails 2.2.2
Hi, Since I have updated my Rails gems to 2.2.2, when I create a new entry in DB which has a permalink I get the following error message: uninitialized constant ActiveSupport::Multibyte::Handlers Do you know if permalink_fu is compatible with Rails 2.2.2? Is there an option I have forgotten to pass to make it work correctly? -- Posted via http://www.ruby-forum.com/.
2008 Dec 27
2
will_paginate working in the opposite way expected
Hi, I am creating a little blogging engine, so I want the most recent posts to display first, so I make a search with :order => ''created_at DESC'' For some reason, will_paginate works the opposite way I expect it to be. I mean the previous / next links are opposite to what I want. What could I be doing wrong? -- Posted via http://www.ruby-forum.com/.
2010 Jul 22
13
Sqlite3 busy and yet server has no load nor concurrency
Hi, Strange behavior here. On my dev machine code works, but on the production machine I get the dreaded: SQLite3::BusyException: database is locked INSERT INTO "comments" [...] What kind of bug could yield such behavior? It''s impossible the database times out, there are no concurrent requests coming in, and the db is only 150kB. Is there a possible race condition? Caching
2009 May 14
6
Generated test files and bad require 'test_helper'
Why do the generated test files have: require ''test_helper'' It cannot obviously find the file because it''s located in a subdirectory. That''s annoying. -- Posted via http://www.ruby-forum.com/.
2006 Nov 29
2
validates_uniqueness w scope
In a one-to-many relationship (domain has_many :categories and category belongs_to :domain) In the category model I use: validates_uniqueness_of :name, :case_sensitive => false but upon creation of a category this validation is performed on ALL domains, can I restrict it only to the categories of the current domain, the to which teh category being saved belongs_to ? if yes ? how ? thanks
2009 Mar 22
5
How does view know about instance vars set in controller?
Hi, I know that the AWDWR says to believe in magic and to not spend Xmas with people asking this question, but really how does it work under the hood? I was looking at the source code of crummy, and it seems that instance_variable_set and instance_variable_get may be part of the answer. Is there some resource on that or do I have to dive into Rails code? -- Posted via
2008 Mar 12
1
Testing helper methods in rspec
This is perhaps a naive question, but what is the recommended manner of testing a helper method in rspec? I have created a simple string manipulation function and I want to write some tests for it. It it were a script then I would just add if __FILE__ == $0 and add the tests below that but I do not feel that this is the best way to handle a rails helper. The code (I said it was simple) :
2011 Dec 15
6
Power Builder 11.5 and sqlserver2008 conection
i have a client application building power builder 11.5, i want connect with a server sql2008 I cant make this connection, i need help please... I have other application building power builder 9 and no have problem connection with sql2000 because use a driver odbc old
2010 Jul 01
25
Encoding problems with Rails 3 + Ruby 1.9.1 (big surprise)
I have kind of an interesting problem. I have a form wherein people enter information. Big surprise. If they enter any "weird" characters like ø or é or whatever, the form will submit and all is well. However, I have a select box for the state which, if you''re looking at Spain, has states like A Coruña, Cádiz and País Vasco. These are pulled from the database which is set to
2006 Aug 23
5
validation, concurrency, and transactions
Hi, Something has been bothering me about model validation: how do I know that the database has not changed in between when I validate my model''s data, and when it actually gets saved to the database? As a simple example, say I have a User model like: class User validates_uniqueness_of :username end When this gets saved to the database, the validation code checks that there is
2008 Jun 09
10
Testing file attachment with Paperclip
Does someone have an example on faking a file upload for just ensuring it gets called, without actually uploading the file to s3. I thought that stubbing Model.has_attached_file would be enough, but it doesn''t seem so ... This is what I did: Video.stub!( :has_attached_file ).with( :name ).and_return( true ) has_attached_file is from paperclip, it gets mixed to the model. 1)
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
2006 Dec 06
2
validates_uniqueness_of where scope euqals created_by "magic" field
I have the following ActiveRecord objects: class Recipe < ActiveRecord::Base has_many :ratings, :dependent => true . . . end class Rating < ActiveRecord::Base validates_uniqueness_of :created_by, :scope => :recipe_id belongs_to :recipe, :counter_cache => true . . . end The created_by field on Rating is implemented as a "magic" field similar to this: