Displaying 11 results from an estimated 11 matches for "current_item".
2006 Jul 18
15
Agile Web Developement with Rails
I recently got a copy of the second addition in PDF
and got stuck on the Ajax portion using highlighting
page 128. While trying to make my cart flash I got an
RJS error when I click add to cart. I have gone back
and made sure my code matched what was in the book but
no help. I sent Dave an email and he rec''d this list.
Anybody got any good links for troubleshooting Ajax or
maybe have see
2006 Jul 03
0
Page 129 of Agile Web Dev on Rails (or pg141 of pdf!)
Hi - another question, sorry....
I''m trying to get the highlighting effect to work on the current_item.
The page refreshes fine, and then I get an error as the highlighting
code is fired:
page[:current_item].visual_effect :highlight,
:startcolor => "#88ff88",
:endcolor => "#114411"
The error is: RJS Err...
2006 May 02
4
Bug in rails ?
Hi !
I just have a simple question.
I am writing an app using rails to familiarize myself with the framework (which is pretty cool, by the way).
I just wanted to know why these two work differently (since "find" should be a synonym for "detect" according to the Pick Axe) :
current_item = @invoice.line_items.detect {|i| i.product.id == key}
current_item = @invoice.line_items.find {|i| i.product.id == key}
(The details of my project are irrelevant, I think.) The first one works, the second doesn''t. With the "find" variant, I get this error :
"Couldn'&...
2006 Jun 08
19
Agile Web Dev (book) question: errors
This is kind of frustrating (but no doubt helpful in the long run) that
after following along and coding , and d/l the code the same error is
appearing.
For those who are familiar with the depot app, I''ve run into a problem after
fixing the cart to reflect quanitites. I worked through the intended error
messages but now have this appearing:
SyntaxError in StoreController#add_to_cart
2006 Jul 26
2
return values from a function - basic question
I thought this would be simple, but I just cant seem to get it to work.
# only allow numbers. Need to check for nil / NAN
def saveHours(val)
if val < 0
val = 0
end
return val
end
current_item.product.v1 = checkValue(values[:val1])
current_item.product.v2 = checkValue(values[:val2])
but when I run the code, nothing is ever returned from the checkValue
function. If I remove the function call and just have values[:val1]
things work fine.
Ive also tried removing the return and just h...
2006 Jul 31
4
RJS to find an element
I''m trying to implement a remove from cart method based on the
examples in the second edition Agile book. I have everything working
except for the RJS that removes items from the cart. Ideally what
I''d like to do is highlight an element that I am deleting only if
there is more than one of that particular item in the cart. If the
item deleted is the only of
2007 Sep 08
2
"Common action" for a controller
...have a controller called ItemController which displays information
about specific items to a user on various pages. The routing looks like
"items/:item/:action". Is there any way to automatically look up the
:item in the items table (it''s just an ID).
I tried:
before_filter { @current_item = Item.find(:first, @params[:item],
:include => [:set, :card]) }
but apperently filters don''t have access to params. Is there any other
simple way? Or is this somehow bad practice?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You rec...
2006 Jul 16
17
AWDWR question
In an early section on Action View, showing code being put directly
into the rhtml file:
<% require ''date''
DAY_NAMES = %w{ Sunday Monday Tuesday Wednesday Thursday Friday Saturday }
today = Date.today %>
<h1>Hello, Dave</h1>
<p>
It''s <%= DAY_NAMES[today.wday] %>.
Tomorrow is <%= DAY_NAMES[(today + 1).wday %>.
</p>
I get this
2008 Feb 06
1
Try-Catch AWDWR P3.0, Sect9.2,Mid pg 121.
...part is really working? What key
phrases should be displayed in the log file? (I''ve looked in the log
file, but I can''t tell.)
try {
Element.update("cart", "\074div class=\"cart-title\"\076Your
Cart\074/div\076\n\074table\076\n\t\n\t\074tr\076
id=\"current_item\"\076\n\n\t\074td\0763×\074/td\076\n\t\074td\076Pragmatic
Project Automation\074/td\076\n (see the attachment for the rest)
Attachments:
http://www.ruby-forum.com/attachment/1397/Try-CatchSect9_2.txt
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-...
2006 Jun 08
3
Back again; errors in depot app
..., but this is a big one - after adding the Ajax portion of the Agile
Web Development tutorial my page displays:
Application error
Change this error message for exceptions thrown outside of an action (like
in Dispatcher setups or broken Ruby code) in public/500.html
It started when I added -
page[:current_item].visual_effect :highlight,
:startcolor => "#88ff88" ,
:endcolor => "#114411"
Since the page is not giving any specific errors , and there is nothing in
500.html I''m not sure where to look. I did check the development.log
after rebooting Webrick and see this:
C...
2007 Jan 12
9
Nil object in E1 capture the order
I''m following the depot application in the rails bible Agile Web
Development with Rails. In interation E1
NoMethodError in Admin#checkout
Showing app/views/admin/checkout.rhtml where line #12 raised:
You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.include?
Extracted source (around line #12):