Displaying 20 results from an estimated 3000 matches similar to: "Rails validations app specific problems"
2010 Apr 14
1
Rails does not display form error message on a custom method
Hi all,
I''ve created a custom method called checkout in my app. I create an
order (which is done my adding products to my "cart"), assign it to my
client, and then I head to my checkout screen where I confirm the items
and enter their customer order number and complete the order (submit).
Everything works great except that it doesn''t display error messages.
2012 Jun 21
0
How to access an engine's method from main application?
Hi,
I''m not sure if this is the right place to post this, but please redirect
me if I''m posting this in the wrong place.
I''m trying to use a method defined in an engine''s library, specifically it
is the current_order method from the Spree::Core
engine:
https://github.com/spree/spree/blob/master/core/lib/spree/core/current_order.rb
In my view,
2007 Dec 22
3
collection_select validation problem
I''m trying to assign a parent foreign key value using
collection_select from my child "new" form. The problem I''m having is
if I do not make a selection, I get the following error instead of the
Rails validates_presence_of error:
You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occurred while evaluating
2009 Mar 15
1
remote_form_for ajax validation
Hi,
I have been reading a lot about this, but I do not manage to do a nice
validation. I already managed to save data to the database, to
validate a field, to display a "Everything went well" message. I can
also display an error message, but the view does not end up properly.
This is the form:
<% remote_form_for(product) do |f| %>
<%= f.error_messages %>
<p>
2006 Mar 17
1
How to update values in database in this form?
Hi,
This is my rHtml page & Corresponding actions & model pages:-
===listform.rHtml=================
<h1>Products List</h1>
<%= start_form_tag(:action => "add_to_cart")%>
<table>
<tr>
<%
i=0
%>
<th>
Product No.
</th>
<th>
Unit Price
</th>
<th>
Available Qty.
</th>
<th>
Demand Qty.
</th>
2006 Jul 20
2
Carrying model date from one page to the next
I am working on a crude first-go-round-in-rails shopping cart and
can''t figure out for the life of me the best way to do this. I have a
shopping cart that has one page during the checkout that handles the
address information, then the next handles the actual credit card
information. How do I take the information from the address form and
keep it alive long enough to put it in to
2008 May 10
0
can javascript handle 422 response
I''m toggling a check box via ajax using:
application_helper.rb: ...............................................................
def toggle_value(object)
remote_function(:url => url_for(object),
:method => :put,
:before => "Element.show(''spinner-
#{object.id}'')",
:complete
2012 May 07
1
Sprockets, JST, Eco and escaping
While it was a good move from Rails part to escape ERB <%= %> tags by
default, it doesn''t seem to happen to Sprockets as well.
The strange bit is that according to Sprockets documentation, it would
be just a matter of naming your template as .jst.eco to enable Eco:
https://github.com/sstephenson/sprockets#javascript-templating-with-ejs-and-eco
Then, extracted from Eco
2012 May 08
1
One to many relationships
I was trying to make one to many relationships - between professors
controller to rate_professors controller and used scaffold. it''s
giving me this error-
NoMethodError in RateProfessorsController#index
undefined method `rate_professors'' for nil:NilClass
app/controllers/rate_professors_controller.rb:7:in `index''
Request
Parameters:
2009 Feb 19
3
Associated child records not created on creation of a parent.
I am trying to create a record with association. Within the create
method, I would also like to pre-populate dependent (has_many) records
from a template in the database.
The child records are <u>mysteriously rolled back </u> if I insert
them in a loop. If I try to insert a single child record, it works.I
have read the books and tried to google my way out of this but am at a
dead
2006 Feb 02
6
How do I? Same Model, Different Controllers, Different Validations?
Hi all --
The simple question is: How do I set different validations for the same
Model, when accessed in different Controllers?
Here''s the scenario: I have a store/cart app, with a customer-facing
shopping cart, and a typical Admin side. The Admin side also has an
Order Entry component, where our staff can enter orders received by fax,
telephone, etc. Both the customer-facing cart
2009 Nov 01
5
Headache with sessions being shared.
I have a really horrendous problem with sessions.
before_filter :find_cart_from_session
private
def find_cart_from_session
if session[:cart] # if there''s is a cart in the session
begin
@cart = Cart.find(session[:cart]) # return existing or new cart
rescue ActiveRecord::RecordNotFound
@cart = Cart.create
@cart.save
session[:cart] = @cart.id
2007 May 30
2
Depot - empty_cart with ajax
First of all id like to say hi to everyone from Argentina, im yet
another Depot first-timer.
Going through the example, i got to the point where my cart finally
runs Ajax-based. And there is a line where Dave says, after all the
job is done "You should see the cart in the sidebar update. And you
shouldn''t see your browser show any indication of reloading the page.
You''ve
2006 Apr 18
1
''depot''app, trouble with session / cookies
Many of you probably know the ''depot'' app from the ''Agile Rails
development'' book.
When the view changes from ''Store'' to ''display_cart,'' a session
containing the shopping-cart (:cart) is supposed maintain the ''cart''
between calls, but when the display_cart stub view shows up, I have
always ZERO elements
2007 Feb 07
1
The Depot "Add to Cart" sessions question (2.ed agile book)
Hello,
Im in the process of working my way through the 2.ed of the agile book.
As many of you already know, the book goes through the regular
development cycle of the Depot application. I have hit a wall
when they started talking about the sessions and the exact mechanics of
how an item is added to the session.
The code looks like this:
depot/app/controllers/store_controller:
def add_to_cart
2005 Apr 13
0
Data Mining in Europe, please advise
Our CEO, Dr. Dan Steinberg, is planning to visit Europe in May. He
would like the opportunity to introduce statisticians (and statistically
minded people) to data mining, data mining applications and to forefront
data mining tools. Our algorithms are probably familiar to many
statisticians (CART, MARS, MART, TreeNet and RandomForests), although it
isn't necessary to be a statistician to
2006 Jun 23
3
Yet another problem with NoMethodError in Store#display_cart
Hi everybody,
I''ve search a lot on google to help me with this one without success. I
know that some people had the same problem as I have, but there
solutions doesn''t seems to work for me.
I''m trying to do the depot example in the AWDwR book. But now I''m stock
with a problem that I can''t solve. I get this error:
<--- begin error here --->
2006 Dec 04
3
uninitialized constant Product
I am actually following the instructions/code snippets from "Agile Web
Development with Rails" and got as far as page 73 where I did ruby
script/generate controller Store index, then edited
store_controller.rb to
class StoreController < ApplicationController
def index
@products = Product.salable_items
end
end
and product.rb to:
def self.salable_items
find(:all,
2006 Feb 12
0
no method error - you have a nil object....
hi,
i''ve been cracking my head on this one for a while and would be humbly
grateful for any pointers
i''m working through Agile Web Devopment w Rails and, in the depot
example have created the cart class for session handling, but am getting
the following error, which suggests the @items variable is not being
populated with any data from LineItem
NoMethodError (You have a
2006 Aug 16
2
Q on AJAX with respect to DRY
I have a shopping cart function, and I''d like to set it up to update the
cart with AJAX. My AJAX call will return a view that displays the cart
items.
My question is with regards to keeping things DRY. When the user goes to
"view cart", that page needs to display the cart, then the cart display
needs to update with AJAX calls when items are added from that page. It
would