Displaying 20 results from an estimated 3000 matches similar to: "validates_presence_of not working"
2006 Mar 29
2
inserts now set unset columns to null
Hi,
I upgraded to Ruby 1.8.4 and whatever the latest Rails is as of March 29
2006.
I am using PostgreSQL 7.4.
With the earlier version of rails, I had insert queries that looked like
this:
Topic Create (0.001189) INSERT INTO topics ("inlibrary",
"irx_display_title", "irx_title", "title", "creation_stamp",
"last_update_stamp",
2006 Mar 29
0
active record bug?
I have some code that generates the following log entries (annotated
with #).
The code takes place inside a transaction.
A record is inserted. Then I get the of the newly inserted record, then
I explicitly
select that record (this is just to illustrate the problem). Then
another insert is attempted
and fails because of a constraint that requires one of the values
entered to be an existing
2005 Dec 19
7
Error handling!
Hello all,
I''m in the beginning states of learning ruby on rails development and
have got to a part where I''m a little stuck! Basically writing a simple
blog application, just to try something completely different! ;-)
I have a page which displays the current blog entry, it''s comments and
at the bottom of the page, a form to add a comment. So far, so good.
2006 Jun 20
2
Validation error_messages_for problem
I am having trouble getting error_messages_for to work.
My controller(relevant parts) looks like
def configure
@account = session[:account]
@user = User.new
end
def add_new_user_to_account
@user = User.new(params[:user])
if @user.valid?
session[:account].users << @user
end
redirect_to :action=> ''configure''
end
end
and my
2009 Nov 26
9
ActionView::TemplateError (can't convert ActiveRecord::Error into String)
I cannot work out why this error is appearing.
ActionView::TemplateError (can''t convert ActiveRecord::Error into
String) on line #3 of app/views/button/_show_enquiry.html.erb:
1: <h1>Send us a message</h1>
2: <% remote_form_for :enquiry, :url => {:action => ''send_mail''} do |
f| %>
3: <%= error_messages_for ''enquiry'',
2006 Feb 15
6
error_messages_for trouble
I am trying so learn how to do custom validations.
The validation works as expected, but I can''t get "error_messages_for"
to display.
How is the name of the object supposed to be formated?
Where is this object created, the model or controller?
What am I doing wrong here?
#### Model ########################
class MyFolder < ActiveRecord::Base
def validate
# validation
2006 Jul 17
2
error_messages_for ?
Hi,
I can''t list error_messages in my Form ??, and all the formfields are
reset ...(I think my redirect :back clean everything, formfield and
error_messages ...), only my flash[:notice] is ok....
I would like to use the "error_messages_for" tag to add a simple red *
on my textfiled if a problem occurs ...
thanks for help
arnaud
here are the basics steps to check that
2006 Feb 03
7
how to add multiple new records from one form
I''m trying to provide our customers with a page where they can add up to
20 items to their cart in one form. The form simply has 20 rows with
each row containing a text input for product code and a text input for
quantity.
I''ve tried having the controller create an array that has an object for
each row by looping through something like:
@new_items[1] = Cart.new
and the
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
2005 Dec 31
2
Validation errors not displaying and will not save
Hello all,
I''m fairly new to rails so I''m probably doing something really stupid
here.... I have been banging my head at this for hrs now... I''ve tried
so many different things and nothing seems to get me any further...
I am trying to create an image uploading page that will simultaneously
create thumbnails to separate file directories and update the database
via
2006 Jul 08
2
Creating/Saving dependent objects
Folks,
Am new to RoR and am building an example to get myself familiar. I am
running into a simple issue while creating a user registration page.
I have a User and Address models defined as below (partial/relevant code
included below). User has_one address and Address belongs_to user. I have a
foreign key defined in address table that refers to user(id)
In a form I take in username, password,
2008 Oct 25
2
Update action | NoMethodError | nil.to_sym
Ok, totally no reason why I''m getting an error in this model update
and no other. HELP!
CONTROLLER:
# GET /employees/1/edit
def edit
@employee = Employees.find(params[:id])
end
VIEW:
<h1>Edit Employee</h1>
<div id="main-sub">
<%= error_messages_for :employees %>
<% form_for(@employee) do |f| %>
<table width="600"
2007 Nov 20
3
How to test views with Nested Resources and Partials
Hi everyone,
I am relatively new to rspec and I am running into a wall in testing my
views. I have a RESTful resource Contracts with a nested resource of
Line_items.
I am trying to figure out how to test the "edit" form of the Line_items.
What complicates this is the nested routing and how to account for it,
and that there is a partial form (_form.haml) that both the edit.haml
and
2006 Jul 18
2
A quick question on forms
I want to change parts of this form in order to use default values (with a
disabled input). The problem is if I change it from text_field to
text_field_tag that part of the form stops functioning. It seems like a
silly question, but its been driving me crazy. Any help would help.
Steve.
<%= error_messages_for ''post'' %>
<!--[form:post]-->
<p><label
2007 Nov 06
2
Why is this view spec failing?
I can''t figure out why I am getting a failure. It renders out fine in
the browser.
<h1>New member</h1>
<%= error_messages_for :member %>
<% form_for(:member, :url => members_path) do |f| %>
<fieldset>
<legend>Member Info</legend>
<p><label for="member[first_name]">First Name:</label> <%=
2008 Feb 17
3
"URL" model not possible?
Hello there,
I just added an URL model to my app (allowing users to basically add
urls etc), which works perfectly fine on the console, but the views
are not working properly. I always get the following error (e.g. when
wanting to create/add a new url):
ActionView::TemplateError (undefined method `rewrite'' for #<Url:
0x25a6070>) on line #5 of urls/new.html.erb:
2:
3: <%=
2006 Jan 13
5
Form field naming semantics question
Hi,
I have a question today regarding how the various form elements in
_form.rhtml are named.
I understand that for a database table "persons" with a column headed by
"name", then in _form.rhtml it will probably be like:
<p><label for="person_name">Name><br/>
<%= text_field ''person'', ''name''
2005 Sep 02
7
Form to update two tables
Hello there,
this is probably a very simple problem but I''m stuck.
I''m following the Login generator tutorial from rubyonrails. It''s all
worked fine so far. But I want to add a bit more functionality so that
when a user signs up in addition to chosing a login name and password
they type in a company name which is added to a seperate table called
COMPANIES. The id
2006 Jun 13
7
help with ''error_messages_for''
Greetings,
I''m in the throws of deploying an app on site5, and I''m getting strange
errors. I think I might need to understand how error_messages_for
works.
I get a pretty standard looking error:
"
You have a nil object when you didn''t expect it!
You might have expected an instance of ActiveRecord::Base.
The error occured while evaluating nil.errors
Extracted
2006 Apr 29
1
can i alter the _form.rhtml without have troubles to validat
hello my name is reynaldo
and i have a problem
i alter the _form.rhtml to display a select option in the place a simple
text_box, and the application work very well, but in the moment that i
apply a validation in the model i get a error.
the code is the next
in the controller:
def new
@catelemento = Catelemento.new
@komandancias = Catcomandancia.find(:all)
end
in the