Displaying 20 results from an estimated 11000 matches similar to: "Valitation only on one page?"
2006 Aug 07
28
Dr Nic’s Magic Models
Welcome! Welcome! Welcome! Ladies and Gentlemen, today you shall be
thrilled and dazzled by wonders of magical mystery.
Dr Nic?s Magic Models will now be unveiled to all. Mystery and magic
that you will be able to perform at home.
Within your ActiveRecord models, never again will you need to write:
* validates_presence_of validations
* has_many and belongs_to statements
* has_many
2009 May 25
4
after_create and has_one association bug?
Hello,
I''ve come across an issue that I''m sure is a bug when using after_create
with a has_one association, but I''m not 100% certain if I''m missing
something.
This is pretty much exactly the code I''m using. Two simple classes
(Account and Contact) and I create the contact after I create an account
(via after_create). I''m not passing in a
2010 Feb 01
3
validating both sides of a has_one relationship breaks pickle/machinist tests
A lot has been posted about validation issues with associations,
however, I don''t see this issue addressed specifically.
ex:
class Foo
has_one :schedule, :dependent => :destroy
validates_presence_of :schedule
class Schedule
belongs_to :foo
validates_presence_of :foo_id
this creates a circular dependency that breaks test frameworks like
pickle and machinist.
At first I was
2005 Oct 12
4
Validating 2 related models at once not working
Hello,
I have a form that submits data to two related models/tables. One is
Customer the other is Address. Validation for Customer works fine but not
for the Address.
Class Customer < ActiveRecord::Base
has_one :address
validates_presence_of :login, :password, :email
validates_associated :address
end
Class Address < ActiveRecord::Base
belongs_to :customer
validates_presence_of
2012 Nov 17
2
Help needed for error in foreign key validation
I have two models bank and country. User should only associate a Bank with
a country id present in the country table and I put validates presence of
country to enforce it but i get error mysql2::Error: Unknown column
''countries.bank_id'' in ''where clause'': SELECT `countries`.* FROM
`countries` WHERE `countries`.`bank_id` = 17 LIMIT 1 when updating the bank
2005 Dec 17
1
lost in an ActiveRecord::StatementInvalid
I have an error I don''t know how to debug. I am adding the login
suport in Depot (the example in the RoR book) and
LoginController#add_user throws ActiveRecord::StatementInvalid in an
innocent /login/add_user GET request.
The trace goes down to a call to SQLiteAdapter#table_structure, and
the source code suggests what''s happening is that "PRAGMA
2006 Dec 07
17
compress and max upload size?
I am using mongrel_cluster with mod_proxy_balancer and would like to
enable compression (assuming it improves throughtput) and limit file
size upload. I configured mod_deflate and LimitRequestSize in Apache,
but in my trials looks like the proxied calls bypass those directives
(the conf goes below).
Is there a way to get this?
-- fxn
# Adapt this .example locally, as usual.
#
# To be
2006 Apr 28
1
Where to put localization strings
Hello!
I have a model that validates presence of the attribute title
class Entry < ActiveRecord::Base
validates_presence_of :title
:message => ''empty title is a no no''
end
I also have a test of this valitation.
class EntryTest < Test::Unit::TestCase
fixtures :entries
def test_validate_title
first = entries(1)
first.title = ''''
2006 Apr 10
3
Problems with multiple ActiveRecords and Validations
Hi all,
I am a RoR newbie and have the following scenario set up:
There are 2 ActiveRecords involved, the first one being "User", the
second one being "Visibility".
The corresponding users table holds address informations regarding a
User. The visibilities table holds visibility settings for the
individual columns of the users table (i.e. firstname, lastname, country
2009 Jul 07
1
Adding data in two tables simul;taneously with Validations
Hi All,
I have 2 tables
1] user_infos &
2] users
class UserInfo
has_one :user
validates_presence_of :city
class User
belongs_to :user_info
validates_presence_of :first_name
i write following code in my create method.
@user_info = UserInfo.new(params[:user_info])
@user=@user_info.build_user(:first_name=>'''')
if @user_info.save
else
end
now what i want is to
2011 May 08
5
Am I being to paranoid?
Hi All,
I want to know thoughts on if I am being to paranoid/security conscious.
CentOS 5.6, Apache, MySQL, running an Firewall in front of everything and obviously the built-in firewall on the box. I have ssh on a different port and starting to use Keys instead of password authentication. I host an intensive website and I am getting about 150 unique visitors per day.
What I am seeing is
2006 May 23
1
Validating a required relationship.
Hello,
I''m not sure if I''m missing something blindingly obvious here.
All the relationships that Rails comes with assume 0..n, yes? It''s
not a strict 1 to 1 or 1 to n because it''s optional. My question is
this -
What is the best way to implement a required relationship?
For example, if I require that a comment is made by a user (a user
has many
2006 Jul 29
3
Validating two models
Hi,
I have a model Account wich "has_one" model called UserData. Both models
use validation.
# Model contains user name, email etc.
class Account < ActiveRecord::Base
has_one :user_data, :foreign_key => "user_id"
validates_presence_of :email
end
# Model contains firstname, lastname etc.
class UserData < ActiveRecord::Base
2006 Apr 07
1
Validate_presence_of error in nested object is not displayed
Hi,
I have a contact object . This contact has a address object
>>Contact
class Contact < ActiveRecord::Base
has_one :address
validates_presence_of :first_name ,:last_name
end
.>>> Address
class Address < ActiveRecord::Base
belongs_to :contact
validates_presence_of :address
end
Addres has the following fields ; address, phone, fax, email
In the contacts_controller I
2006 Apr 04
1
integration tests - 1.1
I?m using the new 1.1 integration test facility? I?m trying to write a
test that sees if a controller redirects to the correct place and
preserves the query string.
Here?s the code:
class LoginRedirectTest < ActionController::IntegrationTest
def test_non_admin_auth
request_uri = "/datafeed/event/report?blah=blah"
get(request_uri)
follow_redirect!
2008 Sep 01
3
basics questions on rails
Hello,
I started to use rails few weeks ago, and I have got basic question
about it.
1. There is a way to keep my form filled, after submit it (for example
if I get errors) ?
2. I would like to create a ''tree'' with my datas like ''pages'' for
example : a page has one children and belongs to a page. I added has_one
and belongs_to to the model but it
2009 Jun 17
2
Using a cgi perl program?
I have a cgi/perl program that I want to use on the same server as my
RoR app and I keep getting:
The page you were looking for doesn''t exist.
You may have mistyped the address or the page may have moved.
I load the program to the cgi-bin directory in its own folder /cgi-bin/
fump/
In the /public folder of my app I have the following .htaccess file:
# General Apache options
2006 Mar 04
4
How to redirect_to the same page after comment posting?
How can I have the page redirect_to the same page after someone posts a
comment?
I know that you can do "redirect_to :action => ''index''", but the page is
located at this URL:
/posts/2006/02/01/individual_post/
So, the action is "individual" which is in the "posts" controller, but
there is a custom URL mapped for the URL shown above. How can
2005 May 13
17
modeling...
I''ve tried tackling this many ways on my own and can''t find a good solution:
Breaking it down to something simplier...
Venue
has one address
Person
has one address
Address
belongs to state
Assuming I don''t want to do tables for venue_addresses and person_addresses.
What is the best way to model this using rails... big thing here is i
want to be able
to reuse a
2016 May 28
5
CentOS 6.8 Apache-2.2.15-53 re-write question
I was wondering if somebody could help me with an Apache re-write rule. Apparently CentOS 6.8 is running apache-2.2.15-53. I am trying
to redirect all pages except for two pages. The apache rewrite directives in the httpd config are:
RewriteEngine on
RewriteCond %{REQUEST_URI}!^/test/
RewriteCond %{REQUEST_URI}!^/my-folder/
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
These commands