I'm doing some editing on an existing rails app and this view;
_tour_listing.html.erb looks like this:
% if @upcoming_tour_requests.blank? %
pNo upcoming tour requests./p
% else %
table
tr
thGroup Name/th
thContact Name/th
thStatus/th
thDate/th
thActions/th
/tr
%= render :partial =
MaD wrote:
when you get the error mentioned above, there should be the rails
trace right on the same page (the part where rails tells you in which
line of your code and on which method the error occurred).
Here is the full trace:
app/models/cart.rb:13:in `initialize'
app/models/cart.rb:13:in
Freddy Andersen wrote:
def add_product(product)
current_item = @items.find {|item| item.product == product}
if current_item
current_item.increment_quantity
else
@items CartItem.new(product)
end
end
Try changing this to
def add_product(product)
It might also be helpful to see my store_controller.rb file:
class StoreController ApplicationController
def index
@products = Product.find_products_for_sale
end
def add_to_cart
@cart = find_cart
product = Product.find(params[:id])
@cart.add_product(product)
end
I'm new to rails so I apologize for my ignorance in advance... I'm
working through a tutorial here but I think it may be written for a
slightly older version of rails. Trying to make a store app.
I'm getting the following error (with application trace shown):
ArgumentError in
Also, my add_to_cart.rhtml view looks like this:
h1The shopping cart/h1
ul
% for item in @cart.items %
li%= cart_item.quantity % times; %= h(item.title) %/li
% end %
/ul
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this
StoreController#add_to_cart
-- doesn't expect any methods, but this is called by the Rails framework
as
an action, and Rails doesn't pass any arguments to the action methods
Cart#add_product
-- expects 1 argument, you're calling it with 1 argument in
StoreController#add_to_cart
Probably.
You could always add a parameter to your CartItem#initialize method.
I'm
not sure that you're heading in the direction you want to be heading,
since
it appears that CartItem is not derived from ActiveRecord::Base -- it's
not
tied to a database.
You might want to go back
a Sorry I see now I was thinking that the CartItem class was an
activerecord class ... The issue is this:
Here you call a new object of CartItem with a product passed
@items CartItem.new(product)
But here in the initialize you do not have a argument for
initialize...
class CartItem
Freddy Andersen wrote:
Where does the cart_item come from? is that in the Store controller?
post the store controller... The view has the @cart object but also
needs the cart_item.. Is that from the session?
cart_item.rb is the name of a model file, the one that starts with class
CartItem
I'm going through a tutorial here and running into an error I'm not sure
how to fix..this is my first foire into sessions.
Trying to create a shopping cart for a store app. I'm getting this
error:
wrong number of arguments (1 for 0)
RAILS_ROOT: script/../config/..
Here is my cart_item.rb
Matt wrote:
You're going to have to isolate what line the error originates from on
your application by going through the Rails trace information,
otherwise we're all going to be here forever trying to figure out what
the problem is.
On Dec 30, 1:22�am, Ryan Ororie rails-mailing-l
permissions to others?
On Mon, Dec 22, 2008 at 4:30 PM, Ryan Ororie
Presumably... it's the admin account - i got no password prompt
regardless though...
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you
So I have been tinkering with Rails all week - I'm a designer, not a
developer, but I'm looking to expand my knowledge. I created an instance
of Radiant, the cms, and am looking to fiddle with it and then try
putting it on a server.
I have the 'radiant project' created here:
RAILS_ROOT:
* Trying * (hard) to get Radiant CMS to work for me here. Based on these
instructions:
http://wiki.radiantcms.org/Database_Configuration
I created my development database, but when I try to use the 'grant all'
command to tell it the user name and pass this is what I get:
mysql grant all on
Newbie here (who else.) I feel confident I can excel in the actual
programming of rails apps. But all the tutorials just glaze over mySQL
which seems to me, by far, the most problematic area for new users.
I have tried a ton of different things here. I know mySQL is installed
and running in
Rick wrote:
Hello Ryan,
� � bio4054059:depot rmorourk$ mysql -uroot depot_development
� � -bash: mysql: command not found
command not found is your shell telling you that whatever directory
you have installed mysql in to is not on your search path.
If you type print $PATH you will
Which simply means MySQL isn't in your PATH. You need to find
where the MySQL executables are installed and add that directory
to your path. Or create symlinks to, say, /usr/local/bin.
First, how do I add it to my PATH? Second, I used this to install mySQL:
http://www.mamp.info/en/index.php
I'd imagine that somewhere under /Applications/MAMP is a directory
with a bunch of files with names starting with mysql. Look around, or
run this from a prompt:
So I found the folder (who's contents I am going to list in my output in
a second) with all the files starting with mysql. It is
set PATH=Applications/MAMP/Library/bin:$PATH
should be
set PATH=/Applications/MAMP/Library/bin:$PATH
looks like it's there and even without setting the path you should be
able to do:
/Applications/MAMP/Library/bin/mysql -u root
So based on this here is what I've done. It seems to
What you really want is:
/Applications/MAMP/Library/bin/mysqladmin -u root -p root create
depot_development
Interesting, thanks... but now I am getting a problem with the password.
Observe:
bio4054059:depot rmorourk$ /Applications/MAMP/Library/bin/mysqladmin -u
root -p root create
I'm following a tutorial here to get some columns in my database. I
generated a model called 'product' then I edited
'db/001_create_products.rb' to have a few columns but when I try to
migrate I get this error:
bio4054059:depot rmorourk$ rake db:migrate
(in /Users/rmorourk/Sites/depot)
==
22 matches
Mail list logo