similar to: validations without AR - going crazy trying to find link

Displaying 20 results from an estimated 80 matches similar to: "validations without AR - going crazy trying to find link"

2005 Jul 23
11
Validation without ActiveRecord
Hello, I followed the instructions at http://wiki.rubyonrails.com/rails/show/HowToUseValidationsWithoutExtendingActiveRecord But now I''m having trouble trying to create my form view. Here''s a brief rundown of what I''ve done: - Created a class called SearchRequest that extends ValidatingBase and saved it in a file called search_request.rb and put it in my models
2006 May 11
1
[Globalize] Enhancement - zip code regexes for each country
Was just playing around with trying to sort out validation of zip/postcodes depending on what country the user lived in, and was wondering if anyone has done this in a nice way? Seems to me that it would be a relatively simple addition to Globalize to add a regex for zip code validation to the things already in there? Or am I missing a trick? Thanks geoff -------------- next part --------------
2005 Dec 20
7
wrong id for activerecord object when using :joins in mysql
I''m using a find with a :joins clause, like this: :joins => "JOIN table_b ON table_b.id=table_b_id" The records returned are used in a scaffold generated list page. The edit, show, and destroy links are getting the wrong id. They are getting the id of the table b record. When I run the query using mysql, I see that the query returns *2* id columns, the id of the main
2005 Dec 16
4
Validation with Aggregation
ActiveRecord supports composed_of for value objects which is fantastic but one thing that it doesn''t seem to support (or at least I am unable to find any documentation for) validation of the value objects. For example, given the following: class Message < ActiveRecord::Base composed_of :sender, :class_name => ''EmailAddress'' composed_of :recipient,
2006 Jan 30
3
ActiveRecord without database
The question is this. Can I use ActiveRecord without the presence of a database? I use only YAML file for my project and I would like use the power of ActiveRecord for my models. I have not tested and so I ask you if this is possible. Thanks so much. --Reis -- Posted via http://www.ruby-forum.com/.
2006 Jun 25
3
Dummy field in a model
I want to have a field in model, which I''m not storing in a database. And I want to do something like the following in the model code : validates_format_of :field_NOT_in_db, :with => session[:field] How can I do it ? Thanks, Pratik -- rm -rf / 2>/dev/null - http://null.in
2006 Aug 16
5
too many SESSIONS?
I just notices my app was down, and in the log file were lots of these: No space left on device - ../config/../tmp/sessions//ruby_sess.898b1cf95e14f8e3 So i figured that i had too many sessions. I went through and deleted the sessions and then in a few minutes, the site was back up again. Can anyone explain this? Did I do the right thing? Is there a way I can tell my app to accept more
2005 Dec 23
6
Agile book - test error
Hi all, I get an error when testing the "store_controller_test.rb" The troublesome line is in the test below: def test_add_to_cart get :add_to_cart, :id => @version_control_book.id <<< cart = session[:cart] assert_equal @version_control_book.price, cart.total_price assert_redirected_to :action => ''display_cart'' follow_redirect
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
2006 May 25
0
Intermittent failure to automatically include all models
I have two models in my rails app that inherit from ValidatingBase instead of ActiveRecord. I didn''t start having this issue until I switched to Planet Argon, running lighttpd, but I''ve started to get errors where one or the other models doesn''t get included and I get an "uninitialized constant ModelName" error. The weirdest thing is that when I restart
2005 Dec 19
2
Advanced search/filter use cases
I''ve been working on an application lately that has a lot of advanced search and filtering functionality (with ranges and substring searches for each attribute). Despite being a pretty common use case, this isn''t supported particularly well by any framework I''ve used, including Rails. I''d like to fix that. :) Right now, my major pet peeves are: 1. Long,
2006 Mar 20
2
Rails Plugin to Help Debug Views
Hi, I just released a plugin to help debug views. The plugin makes it easy to add a button that will popup a new window that displays the following debug data; * Request Parameters * Session Variables * Flash Variables * Assigned Template Variables It was derived from code that traces back to Marten Veldthuis in Epilog. You can check out webpage and plugin via;
2006 Jan 19
2
Easy way to handle form input without a model class?
I have a couple forms that I''d like to be able to validate and automatically populate, but it shouldn''t be based on AR. In fact I often have a bunch of small forms that I can''t really justify writing a whole new model class for anyway. I''d like to validate the form input, and then use rails helpers to automatically populate the form if validations fail.
2005 Dec 21
13
Too many login generators?
there is a blog about it http://www.realityforge.org/articles/2005/11/12/aaa_in_rails There are so many Authentication/Authorization/Auditing generators now, just like the situation in java''s world, Too many components doing the samething just make me confusion. Why not add one to rails core lib and everybody can extend it for their requirement ? -- Posted via
2006 Mar 02
1
Forms with and without Models and Error Handling
Hi, I currently programming a delicious clone to understand ruby on rails. The problem I''ve got is that I prefill a form (form without models) without a database connection and then save it into the database. For validation i am using the validation helper methods. My Problem is that i don''t know how I get the error hash from the helper method validates... etc. because I
2005 Dec 22
1
[NEWB] How to access database.yml parameters in a controller
Hi, Are the active database.yaml attributes for the current environment (dev, prod, test) available inside a controler ? adapter, host, db, socks, etc. AFIK Class#connection don''t give back theses infos. Thanks
2005 Dec 22
2
routes and url_for
Hi, All. I try to relocate controllers. Admin space controlers moved to /app/controllers/admin and user space controllers to /app/controllers/user In routes.rb I use map.connect ''search'', :controller => ''user/search'' that correct I see. But when I want to use start_form_tag or simply url_for, that used in start_form_tag, I do not know how generate url
2005 Dec 30
2
How to abort program flow after a redirect?
I''m developing an authorization plug-in which adds a permit keyword, so you can do things like: class FooController < ApplicationController permit "member" def edit permit "owner of :document", :document => Document.find(params[:id]) # stuff to edit.. end end I''ve got it mostly working, but if the permit in #edit fails, a redirection
2005 Dec 30
1
Need serious help - unit testing without a database
I''ve created a model, let''s just call it Person class Person attr_accessor :first_name, :lastname def full_name @first_name + " " + @last_name end end I''m using this in my Rails application. My Rails application does not use a database of any kind, and this model is obviously not a subclass of ActiveRecord::Base. I can''t unit test this
2006 Jan 03
1
Virtual Hosts?
Well, I guess I''m successful because within a month of getting my very first application online (and it''s barely functional) I now have to get a second one up pretty quickly. Basically, I have a rails application "myFirstApp", and a hostname www.myfirstapp.com. Now I have a second rails app "mySecondRailsApp" and I need www.mysecondapp.com to peacefully