Displaying 20 results from an estimated 700 matches similar to: "<% unless params[:context] == :gallery -%> question"
2006 Aug 07
2
Newbie question about adding product to cart
Hello. I''m using the Agile Web Dev. book 1st Edition and I''m puzzled by
the code on pp. 83-84.
<%= link_to ''Add to Cart'', {:action => ''add_to_cart'', :id => product },
:class => ''addtocart'' %>
def add_to_cart
product = Product.find(params[:id])
@cart = find_cart
2006 May 14
3
Beginner question on paginate with params and conditions
I am trying to do a simple search by product name. The first page
returns fine, but when I try to go to any other pages of the search
results, I lose the original search parameters from my search form and
get NilClass errors.
Here is the code in my controller:
namesearch = "%" + params[:name].strip + "%"
@product_pages, @products = paginate :product,
2006 Apr 19
4
Another DRY question
I have some code working that lists only items from a particular user.
The code in my list action finds the user and then conditionally lists
only his/her items:
def list
user = User.find(session[:user])
user_id = user.id
@product_pages, @products = paginate :products, :per_page => 10,
:conditions =>[''user_id = ?'',
user.id]
2006 Jan 13
2
Problem
Hi. I''m doing a tutorial from the Thomas~Hansson book and am getting this
error message:
Extracted source (around line #17):
14: <%= link_to ''Add to Cart'',
15: {:action => ''add_to_cart'',
16: :id => product },
17: class => ''addtocart'' %>
18: </br>
19: </td>
20:
2006 Jan 04
7
wrong number of arguments error
I keep getting this error every time I try to pass a value to a method.
Here is a sample nonworking method. I''ve been pulling my hair out over
this all night! Why won''t it work!?
My url path is :3000/store/browse/shoes and I''m getting this in the log
Parameters: {"action"=>"browse", "id"=>"shoes",
2006 Jan 20
5
Instance variable?
I''m trying to grab a temporary variable from my view and then pass along
that value to my model
My view code is this:
<td width="40" align="center"><%= text_field ''product'', ''qty_added'',
{:size=>3}
And I''m trying to pass the qty_added variable to my model.
item.quantity = qty_added
It doesn''t seem
2005 Nov 30
8
nested attributes with update_attributes()
Hi,
I am trying to use the update_attributes on object with nested
attributes and I am getting the following error:
ProductPrice expected, got HashWithIndifferentAccess
Here''s the situation (simplified):
class Product < ActiveRecord::Base
belongs_to :productPrice
end
class ProductPrice < ActiveRecord::Base
has_one :product,
:dependent => true
2006 Apr 19
2
Filtering items within scaffold
I''m messing with the agiles store example. I added a field in my
product table (user_id) that is also a foreign key relationship via
fk_products_user
In my scaffold I''d like to list the products as usual, but only those
products from the logged in user. I assume that would be done in the
controller..
How would I extend the basic controller:
def list
@product_pages,
2006 Apr 22
7
Expiring items
In my database I have a products table that has a bunch of attributes
(title, description, etc) including one for date_expires.
Is there a best practices method to get the database to erase the
expired items? Is that done outside RoR via Cron or something?
Else is it better to just have my app filter out anything that is
expired but still keep those records in my dbase?
--
Posted via
2006 Sep 12
3
Querying against numeric fields? e.g. price:( >= min_price)
Using acts_as_ferret I''m trying to do a query like:
active:(true) title|body:(#{params[:s]}) product_price:( >=
#{params[:min]})
Where I want to return only the active products that contain the search
term in the title or body and has a minimum price >= params[:min]
I''m finding that even though I''m indexing the product price as an
integer (so no .00 to cause
2006 Apr 11
2
Extending Depot Example
Hi
I am new to the whole Rails/Ruby world as having come from a MS .NET
background, but I have followed the Depot example in the Agile Web Dev.
with Rails book with relative ease. However as an exercise to see how
much I had understood, I thought I would attempt to modify the example a
bit and add a Quantity field to the store index so as to pass that value
into the cart. I have extended the
2012 Nov 26
8
why functional test does not get failure?
The test:
test "should get new" do
get :new, :room_id => @room.name
assert_template(:ne)
end
the template new does not exists but the test does not get failure.
Why?
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2005 Dec 24
2
Common menu
Hi,
I''m releasing my first rails application and I''d like to have a common
menu in all my templates.
Do I have to include an rhtml from .rb or other rhtml ? Some sample code pls
?
Regards,
Fabian
2006 May 05
1
Agile Rails (1st edition), depot TDD "exercise"
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I''ve been working my way through the Agile book and just completed
the depot sample application. I learned quite a bit along the way.
On page 171 we are led through the creation of a test (that fails)
for new code. The new code (a search function) is left as an exercise
for the reader. Well, I think I solved it but I''m not
2006 May 06
1
depot test-driven development exercise
(I posted this yesterday but within 20 minutes my thread was hijacked
so I''m not sure anyone really saw this.)
I''ve been working my way through the Agile book and just completed
the depot sample application. I learned quite a bit along the way.
On page 171 we are led through the creation of a test (that fails)
for new code. The new code (a search function) is left as an
2014 Jul 08
1
using R functions in a C loop
I would like to write a fast version of a function which contains slow
loops that I cannot vectorize.
I would like to rewrite it in C, but in the loops I need to call a few
(two) R functions.
Which is the best way to do so? I have read that one can call a C library
which import all the R functions (R.h, is it?). Is that efficient? I tried
to have a look into the internal C code to find just the
2006 Mar 29
0
css, div-tags and ajax
Hi.
I copied parts of the ajax-examples in Agile Rails prog. and modified
it so it searched for zip-codes. The result is displayed in
search.rhtml. The first version looked like this, I liked the look of
the "add to cart" in the depot-example. :class => ''button1'' is
originally addtocart which I renamed in the .css-file.
<% for city in @cities %>
<%=
2006 Jul 15
4
updating multiple records with form
I have an app that has two models -- products and details. I''m building
a form that allows a user to create a new product and specify a
description, etc.
The form needs to allow for creation of multiple items in the details
model/table. for example, I have a block of form items that collect
info for the men''s version of the product -- inventory count for each
size, etc. And
2006 Apr 08
16
International characters
I am new to Ruby on Rails. I have read a lot, and bought several books,
and now I have started to implement a modified "shopping cart",
following the AWDWR-book, with modifications to suit our application
(subscriptions and memberships).
Having done up to chapter 7 I have had no real problems, except one:
Since our customers are Swedish I need the screen names, texts etc to be
in
2006 May 06
0
RE: Rails Digest, Vol 20, Issue 156
I am looking for a ruby hosting service. Can any one recommend one for me.
-----Original Message-----
From: rails-request@lists.rubyonrails.org [mailto:rails-request@lists.rubyonrails.org]
Sent: Saturday, May 06, 2006 7:37 AM
To: rails@lists.rubyonrails.org
Subject: Rails Digest, Vol 20, Issue 156
Send Rails mailing list submissions to
rails@lists.rubyonrails.org
To subscribe or