similar to: Page 129 of Agile Web Dev on Rails (or pg141 of pdf!)

Displaying 20 results from an estimated 300 matches similar to: "Page 129 of Agile Web Dev on Rails (or pg141 of pdf!)"

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
2006 Jun 08
3
Back again; errors in depot app
Sorry, 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 =>
2006 Jul 24
1
Newbie error: undefined local variable or method
When I add an item to the shopping cart, I get an error: undefined local variable or method `cart_item'' for #<#<Class:0x3715a78>:0x3715a48> Session info says the cart being updated properly. I''m just not able to output two variables: <%= cart_item.quantity %> &times; <%= h(cart_item.title) %> I did some research, and I can grasp that local
2006 Oct 19
1
Ajax functionality not working - partial problem?
I have a difficult using Ajax and wondered whether anyone has the expertise to advise me how to proceed? 1. We start at edit - this calls a partial form, which then calls a series of partials (which themselves call partials sometimes). If we take the case of features, the form goes: edit - _form - _features - _feature 2. Updates are made in the controller, then there is a re-direct to
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
2010 May 24
2
Two RJS visual effects will happen at the same time?
I was going to change the background of a div from white to red and then from red back to white, so this is used in an RJS file: page[:vote_score].visual_effect :highlight, :startcolor => ''#ffffff'', :endcolor => ''#ffcccc'' page[:vote_score].visual_effect :highlight, :startcolor => ''#ffcccc'', :endcolor =>
2006 Aug 04
6
Errors ... errors and errors.
I bought the second edition of the ruby on rails, it seems to work fine now, did some adjustments to the code. But now I get a second error and I want to learn to understand to fix them myself. So here is the error. ArgumentError in StoreController#add_to_cart wrong number of arguments (1 for 0) #{RAILS_ROOT}/app/models/cart.rb:15:in `initialize'' #{RAILS_ROOT}/app/models/cart.rb:15:in
2008 Sep 03
2
Highlighint rjs problem on a new product
Hi, Problem Summary: I have been trying to add the highlight effect to my table but everytime a new record is added the highlighting gives an rjs error. However when i click the add to cart button on a product that already exists inside the table, the highlight effect works. Is this because the partial must only have only one <tr></tr> in it and the <table> must be on the other
2006 Jan 10
5
using dynamic element ids with visual_effect
Mike and I demo an Ajaxified version of the Depot application in the Rails Studio. Part of the demo is a cart in the sidebar which updates when you add a product to it. As well as updating the div, it also highlights the most recently added link item. Right now, we do it with: <script language="JavaScript"> function flash_cart(request) { var id =
2006 Jan 06
3
Where to place a global function
Hi all, I have a little function called format_price(price) that simply formats the argument as a dollar sign, dollar amount, dot and penny amount. Then, in a .rhtml file, I could do this: <%= format_price(item.unit_price * item.quantity) %> But where do I put the format_price() function definition? The app couldn''t find it in app/controllers/application.rb. Where do I put it
2006 Jul 07
5
Can a route require POST or GET? / REST problem with routing
Hi, A store front a customer wants to GET /product/5/show. But for the application this is really GET /cart_item/new/5 or even better /cart_item/new?cart_item[product_id]=5 When the customer clicks add_to_cart they POST /product/5/show so that the url doesn''t confuse the user when any validation errors occur. But for the applicaiton this should be POST
2006 Mar 07
1
Minor fix for Ajax.InPlaceEditor
controls.js line 471: Where it says: new Effect.Highlight(element, {startcolor: this.options.highlightcolor}); can we change it to: new Effect.Highlight(element, {startcolor: this.options.highlightcolor, endcolor: this.options.highlightendcolor}); . Otherwise, it''ll use the default #FFFFFF to finish the highlight which doesn''t look right when #FFFFFF doesn''t match
2006 Jul 26
1
how do I change color to an highlight effect ?
This is my code: <%= form_remote_tag :url => { :action => "forgot_account" }, :update => "result", :complete => visual_effect(:highlight, "result", :duration => 2, :startcolor => "#c8e673", :endcolor => "#9db55d") %> If I remove colors to the effect everything works, but with this code it renders on another
2006 May 30
0
inexplicable undefined method errors
Hi All, I had a function from the pragprog book in my application_helper.rb file. Here it is: def format_price(amount) dollars, cents = amount.divmod(100) sprintf("$%d.%02d", dollars, cents) end I call this function in my view quite simply like this: <td><%= format_price(hard_product.price_ca) %></td> This was working fine until today, suddenly for
2006 Oct 09
2
page.visual_effect :highlight
I have some code that will do the highlight, fade effect on a block of text. It seems to work just fine until it is fired multiple times very rapidly. The end color matches a grey background and the start color is a yellow. Say its run 4 times a second for 3-5 seconds. When the flashing catches up the text will fade for the last time to the end color, then the background will switch to a
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.
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 =
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
2007 Jun 04
2
Re: Ajax.Request question with JSON return
Do I need something like this: eval(''('' + this.header(''X-JSON'') + '')'') (taken from Cody Swann, http://ajaxian.com/archives/prototype-extension-dynamic-script-pattern-support ). I''m guessing my problem is simpler, and I''m leaving something small out related to the header though. Thanks for any help -Mark 1. evalJSON:
2007 Sep 08
2
"Common action" for a controller
Sorry if this has been asked before; it seems like a simple problem. I 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 =