[Rails] Re: wrong number of arguments (3 for 2)

2012-08-01 Thread deal bitte
yaa...but this line throws no error config.nested.add_link(:procedureexecutions, :label = Run, :inline = false) Colin Law wrote in post #1070901: On 1 August 2012 12:02, deal bitte li...@ruby-forum.com wrote: wrong number of arguments (3 for 2) I am getting this error for the following

Re: [Rails] Re: wrong number of arguments (3 for 2)

2012-08-01 Thread Gintautas Šimkus
That's two params: Symbol (:procedureexecutions), followed by a hash (which omits {}): :label = Run, :inline = false ) So that's fine. 2012/8/1 deal bitte li...@ruby-forum.com yaa...but this line throws no error config.nested.add_link(:procedureexecutions, :label = Run, :inline = false)

[Rails] Re: wrong number of arguments (2 for 0..1)

2011-08-09 Thread praveen k.
Kurtis Rainbolt-greene wrote in post #1015633: Try this: https://gist.github.com/1133491 On Mon, Aug 8, 2011 at 10:36 PM, praveen k. li...@ruby-forum.com wrote: wrong number of arguments (2 for 0..1) To unsubscribe from this group, send email to

[Rails] Re: wrong number of arguments error

2010-11-29 Thread Marnen Laibow-Koser
John Merlino wrote in post #964838: Hey all, I did a script/generate controler users in console. Then I added the following to users controller: class UsersController ApplicationController def initialize(first_name, last_name) @first_name = first_name @last_name = last_name

[Rails] Re: wrong number of arguments error

2010-11-29 Thread John Merlino
You are right. It worked. Nevertheless, the behavior was the same. We instantiated an object and called a constructor method of the class. Both User and UsersController are classes. I don't know what is causing the behavior to be different. Are there any good books on MVC design patterns? I

[Rails] Re: wrong number of arguments error

2010-11-29 Thread Frederick Cheung
On Nov 29, 7:34 pm, John Merlino li...@ruby-forum.com wrote: You are right. It worked. Nevertheless, the behavior was the same. We instantiated an object and called a constructor method of the class. Both User and UsersController are classes. I don't know what is causing the behavior to be

[Rails] Re: wrong number of arguments error

2010-11-29 Thread Marnen Laibow-Koser
John Merlino wrote in post #964846: You are right. It worked. Nevertheless, the behavior was the same. We instantiated an object and called a constructor method of the class. Both User and UsersController are classes. I don't know what is causing the behavior to be different. Gee, do you

[Rails] Re: Wrong number of arguments (0 for 1) in callback method

2009-11-15 Thread Kalpesh Patel
Hi Matt, Actually I am trying to connect to already existing DB where mentioned table is readily available. I just need to read it all the time or occasionally write it but I do not create it from my app. The primary key of the table is varchar. I can do nothing about that and if i do not declare

[Rails] Re: Wrong number of arguments (0 for 1) in callback method

2009-11-14 Thread Matt Jones
Somewhat unrelated, but if you're creating a new, simple Rails app, why are you tangling with set_table_name and a noninteger primary key? Working against the Rails conventions will cause no end of trouble, especially if you're just starting out... --Matt Jones On Nov 13, 4:00 am, Kalpesh1

[Rails] Re: Wrong number of arguments (0 for 1) in callback method

2009-11-13 Thread Frederick Cheung
On Nov 13, 9:00 am, Kalpesh1 Patel rails-mailing-l...@andreas-s.net wrote: When I run this in browser, it throws error Wrong number of arguments (0 for 1). Obviously, my method init_name expects one parameter and it doesn't find any while called(by controller??). Basically I want to send

[Rails] Re: Wrong number of arguments (0 for 1) in callback method

2009-11-13 Thread Kalpesh1 Patel
Frederick Cheung wrote: On Nov 13, 9:00�am, Kalpesh1 Patel rails-mailing-l...@andreas-s.net wrote: When I run this in browser, it throws error Wrong number of arguments (0 for 1). Obviously, my method init_name expects one parameter and it doesn't find any while called(by controller??).

[Rails] Re: Wrong number of arguments (0 for 1) in callback method

2009-11-13 Thread Leonardo Mateo
On Fri, Nov 13, 2009 at 10:39 AM, Kalpesh1 Patel rails-mailing-l...@andreas-s.net wrote: Frederick Cheung wrote: On Nov 13, 9:00�am, Kalpesh1 Patel rails-mailing-l...@andreas-s.net wrote: When I run this in browser, it throws error Wrong number of arguments (0 for 1). Obviously, my method

[Rails] Re: Wrong number of arguments (0 for 1) in callback method

2009-11-13 Thread Sijo k g
Hi Kalpesh1 Patel So isn't there any way I can pass some value from controller to model? You can define cname as n attr_writer in model and can set its value from controller like @simple.cname = 'namehere' Sijo -- Posted via http://www.ruby-forum.com/.

[Rails] Re: Wrong number of arguments (0 for 1) in callback method

2009-11-13 Thread Kalpesh1 Patel
Sijo k g wrote: Hi Kalpesh1 Patel So isn't there any way I can pass some value from controller to model? You can define cname as n attr_writer in model and can set its value from controller like @simple.cname = 'namehere' Sijo Thanks sijo! I am able to get/set it using

[Rails] Re: Wrong number of arguments (0 for 1) in callback method

2009-11-13 Thread Kalpesh1 Patel
Leonardo Mateo wrote: On Fri, Nov 13, 2009 at 10:39 AM, Kalpesh1 Patel rails-mailing-l...@andreas-s.net wrote: when callback method is called? Callbacks like before_create can't take any arguments Fred So isn't there any way I can pass some value from controller to model? What do you

[Rails] Re: Wrong number of arguments (0 for 1)

2009-09-16 Thread Frederick Cheung
On Sep 16, 8:05 pm, RubyonRails_newbie craigwest...@googlemail.com wrote: Hi everyone, I am running through the RailsSpace tutorial. I'm trying to figure out the advanced login section, which in short creates a cookie and an authorization token in the users table in the database. My

[Rails] Re: Wrong number of arguments (0 for 1)

2009-09-16 Thread Greg Donald
On Wed, Sep 16, 2009 at 2:05 PM, RubyonRails_newbie craigwest...@googlemail.com wrote: I am running through the RailsSpace tutorial. I'm trying to figure out the advanced login section, which in short creates a cookie and an authorization token in the users table in the database. My trouble

[Rails] Re: wrong number of arguments (0 for 1) in []

2009-07-03 Thread Colin Law
2009/7/3 JannaB mistressja...@hotmail.com: I am creating a multiple-selection list box with :  % form__list1 = [] % %= select_tag, options_for_select([A,B,C,D], selected =A), html_options = {size = 5, multiple = true}) % I get wrong number of arguments (0 for 1) alluding to

[Rails] Re: wrong number of arguments (0 for 1) in []

2009-07-03 Thread Matt Jones
On Jul 3, 12:33 am, JannaB mistressja...@hotmail.com wrote: I am creating a multiple-selection list box with :  % form__list1 = [] % %= select_tag, options_for_select([A,B,C,D], selected =A), html_options = {size = 5, multiple = true}) % I'm not sure what the error that you're getting

[Rails] Re: wrong number of arguments (1 for 0)

2009-06-04 Thread Frederick Cheung
On Jun 4, 10:33 am, springbok e...@infoware.com.au wrote: Hi, I hope someone can help me because this is driving me crazy, I've spent hours trying to track this down. I'm trying to convert a Rails 1.1 to Rails 2.3.2 and I'm getting the following error when trying to save a many to many

[Rails] Re: wrong number of arguments (3 for 2)

2009-03-04 Thread Heinz Strunk
Hey, try: date_select(user, birthday, :start_year = 1926, :end_year = Time.now.year-13) -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post

[Rails] Re: wrong number of arguments (3 for 2)

2009-03-04 Thread Frederick Cheung
On 4 Mar 2009, at 01:44, Zqj Zqj wrote: Showing vendor/plugins/community_engine/app/views/users/new.html.haml where line #40 raised: Only time i've seen this is with plugins that fiddle with the date helpers, globalite may well be one of them Fred wrong number of arguments (3 for 2)

[Rails] Re: wrong number of arguments (1 for 0)

2009-02-18 Thread jemminger
change session(:cart).nil? to session[:cart].nil? session is not a method call On Feb 18, 12:30 pm, Sony Sebastian rails-mailing-l...@andreas-s.net wrote: Hello,         I am new to ruby on rails. When I tried to create a session I am getting an error, 'wrong number of arguments (1 for

[Rails] Re: wrong number of arguments (1 for 0)

2009-02-18 Thread Frederick Cheung
On Feb 18, 5:44 pm, jemminger jemmin...@gmail.com wrote: change   session(:cart).nil? to   session[:cart].nil? session is not a method call If we're picking nits it is :-) - you just don't pass any arguments to it. Fred --~--~-~--~~~---~--~~ You received

[Rails] Re: wrong number of arguments (1 for 0)

2009-02-18 Thread Rick
It would be helpful to see the CustomerController code for the new method, but... I have to assume that new should be called as: session[:cart] = SessionCart.new() if session(:cart).nil? On Feb 18, 7:30 am, Sony Sebastian rails-mailing-l...@andreas-s.net wrote: Hello,         I am new to

[Rails] Re: Wrong number of arguments?

2008-12-30 Thread MaD
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). --~--~-~--~~~---~--~~ You received this message because you are

[Rails] Re: Wrong number of arguments?

2008-12-30 Thread Jeffrey L. Taylor
Quoting Ryan Ororie rails-mailing-l...@andreas-s.net: [snip] 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 end Your code is

[Rails] Re: Wrong number of arguments?

2008-12-30 Thread MaD
nice. On 30 Dez., 10:12, Jeffrey L. Taylor r...@abluz.dyndns.org wrote: Quoting Ryan Ororie rails-mailing-l...@andreas-s.net: [snip]   def add_product(product)     current_item = @items.find {|item| item.product == product}     if current_item       current_item.increment_quantity  

[Rails] Re: Wrong number of arguments?

2008-12-30 Thread Ryan Ororie
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

[Rails] Re: Wrong number of arguments?

2008-12-30 Thread Freddy Andersen
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) current_item = @items.find {|item|

[Rails] Re: Wrong number of arguments?

2008-12-30 Thread Ryan Ororie
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)

[Rails] Re: Wrong number of arguments?

2008-12-30 Thread Ryan Ororie
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

[Rails] Re: Wrong number of arguments?

2008-12-30 Thread Freddy Andersen
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

[Rails] Re: Wrong number of arguments?

2008-12-29 Thread Matt
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...@andreas-s.net wrote:

[Rails] Re: Wrong number of arguments?

2008-12-29 Thread Ryan Ororie
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] Re: wrong number of arguments (0 for 1) error.... Help!!!

2008-12-10 Thread Jay Mark
Frederick Cheung wrote: On Dec 10, 5:36�am, Jay Mark [EMAIL PROTECTED] wrote: Rails? Is subselect not supported in Rails? For the sake of argument you can do @books = Books.find_by_sql [SELECT * FROM books WHERE title IN (SELECT title FROM authors WHERE name = ?),

[Rails] Re: wrong number of arguments (0 for 1) error.... Help!!!

2008-12-09 Thread Jay Mark
Here is the result from ruby script/console Author.new = #Author id: nil, name: , title: , book_id: nil Book.new = #Book id: nil, title: , isbn: Ryan Bigg wrote: Ok... then you're on your own if you don't know how to type ruby script/console into a command prompt window and then type

[Rails] Re: wrong number of arguments (0 for 1) error.... Help!!!

2008-12-09 Thread Jay Mark
Ryan Bigg wrote: And finally, what version of Rails? - Ryan Bigg Freelancer http://frozenplague.net I am using 2.0.2 with mysql database Cypray -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are

[Rails] Re: wrong number of arguments (0 for 1) error.... Help!!!

2008-12-09 Thread Ryan Bigg
I have no clue. Author.find_by_name should be working when it (apparently) is not. Something is broken. - Ryan Bigg Freelancer http://frozenplague.net On 10/12/2008, at 8:44 AM, Jay Mark wrote: Ryan Bigg wrote: And finally, what version of Rails? - Ryan Bigg Freelancer

[Rails] Re: wrong number of arguments (0 for 1) error.... Help!!!

2008-12-09 Thread Jay Mark
Ryan Bigg wrote: I have no clue. Author.find_by_name should be working when it (apparently) is not. Something is broken. - Ryan Bigg Freelancer http://frozenplague.net I think so too. Thanks for your help. Why is it so hard to find the correct syntax for doing a subselect in Rails? Is

[Rails] Re: wrong number of arguments (0 for 1) error.... Help!!!

2008-12-09 Thread Ryan Bigg
It's supported. It's the syntax I showed you before: Author.find_by_name(Blah).books, will get you all the books by that author. - Ryan Bigg Freelancer http://frozenplague.net On 10/12/2008, at 3:36 PM, Jay Mark wrote: Ryan Bigg wrote: I have no clue. Author.find_by_name should

[Rails] Re: wrong number of arguments (0 for 1) error.... Help!!!

2008-12-08 Thread Frederick Cheung
On 8 Dec 2008, at 16:30, Jay Mark wrote: I am using Rails 2.0.2 with mysql database I am getting this error when running a query with Find_by_sql: wrong number of arguments (0 for 1) Here are my queries: @authors = Author.find_by_sql[SELECT * FROM authors WHERE name = ?', name] Also

[Rails] Re: wrong number of arguments (0 for 1) error.... Help!!!

2008-12-08 Thread Jay Mark
Thanks for your help Fred. The wrong number of argument problem is gone. The queries are still not working. Using find_all_by_name give me method not found error This one below returns no data but gives no error. But it works fine when I put it in mysql directly. @authors =

[Rails] Re: wrong number of arguments (0 for 1) error.... Help!!!

2008-12-08 Thread Frederick Cheung
On Dec 8, 7:31 pm, Jay Mark [EMAIL PROTECTED] wrote: Thanks for your help Fred. The wrong number of argument problem is gone. The queries are still not working. Using find_all_by_name give me method not found error That should work as long as the argument you pass it exists (and as long

[Rails] Re: wrong number of arguments (0 for 1) error.... Help!!!

2008-12-08 Thread Jay Mark
Thanks again Fred. NO, I am not asking for the author whose name is the exact string 'name'. Name is the attribute or column in the authors table which has name values like James, John, etc. The user will select a name, say John, then I am passing that name as a condition to the query. After a

[Rails] Re: wrong number of arguments (0 for 1) error.... Help!!!

2008-12-08 Thread Frederick Cheung
On 8 Dec 2008, at 22:53, Jay Mark wrote: Thanks again Fred. NO, I am not asking for the author whose name is the exact string 'name'. Name is the attribute or column in the authors table which has name values like James, John, etc. The user will select a name, say John, then I am passing

[Rails] Re: wrong number of arguments (0 for 1) error.... Help!!!

2008-12-08 Thread Ryan Bigg
If it's coming in dynamically, wouldn't it be params[:author][:name] or something similar? A bit hard to guess without seeing more code. - Ryan Bigg Freelancer http://frozenplague.net On 09/12/2008, at 9:30 AM, Frederick Cheung wrote: On 8 Dec 2008, at 22:53, Jay Mark wrote:

[Rails] Re: wrong number of arguments (0 for 1) error.... Help!!!

2008-12-08 Thread Frederick Cheung
On 8 Dec 2008, at 23:36, Ryan Bigg wrote: If it's coming in dynamically, wouldn't it be params[:author][:name] or something similar? A bit hard to guess without seeing more code. D'oh of course, not sure why I wrote author[:name] Fred - Ryan Bigg Freelancer http://frozenplague.net

[Rails] Re: wrong number of arguments (0 for 1) error.... Help!!!

2008-12-08 Thread Jay Mark
Thanks guys, the first query is working fine now. Rails is still rejecting the syntax of this subselect: @books = Books.find_by_sql [SELECT * FROM books WHERE title IN SELECT title FROM authors WHERE name = ?, params[:author][:name]] I know the inner select should be in (), but its not taking

[Rails] Re: wrong number of arguments (0 for 1) error.... Help!!!

2008-12-08 Thread Ryan Bigg (Radar)
Stop using find_by_sql! You can just do: author = Author.find_by_name(params[:author][:name]) books = author.books.find(:all, :select = title) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk

[Rails] Re: wrong number of arguments (0 for 1) error.... Help!!!

2008-12-08 Thread Jay Mark
I am using find_by_sql because I get this error when I use find_by_name or find_all_by_name undefined method `find_by_name' for #Class: I get it again when I put in the code in the last post. Is there a way to solve the undefined method problem? Cypray Ryan Bigg wrote: Stop using

[Rails] Re: wrong number of arguments (0 for 1) error.... Help!!!

2008-12-08 Thread Ryan Bigg
pastie your models please - Ryan Bigg Freelancer http://frozenplague.net On 09/12/2008, at 2:14 PM, Jay Mark wrote: I am using find_by_sql because I get this error when I use find_by_name or find_all_by_name undefined method `find_by_name' for #Class: I get it again when I

[Rails] Re: wrong number of arguments (0 for 1) error.... Help!!!

2008-12-08 Thread Jay Mark
Here are my models: class Author ActiveRecord::Base belongs_to :book end class Book ActiveRecord::Base has_many :authors end Ryan Bigg wrote: pastie your models please - Ryan Bigg Freelancer http://frozenplague.net -- Posted via http://www.ruby-forum.com/.

[Rails] Re: wrong number of arguments (0 for 1) error.... Help!!!

2008-12-08 Thread Ryan Bigg
And in the console do Author.new and Book.new and show me the output of each please. - Ryan Bigg Freelancer http://frozenplague.net On 09/12/2008, at 2:44 PM, Jay Mark wrote: Here are my models: class Author ActiveRecord::Base belongs_to :book end class Book

[Rails] Re: wrong number of arguments (0 for 1) error.... Help!!!

2008-12-08 Thread Jay Mark
It says: Author.new is not recognized as an internal or external command, operable program or batch file. same for Book. Ryan Bigg wrote: And in the console do Author.new and Book.new and show me the output of each please. - Ryan Bigg Freelancer http://frozenplague.net -- Posted

[Rails] Re: wrong number of arguments (0 for 1) error.... Help!!!

2008-12-08 Thread Ryan Bigg
I meant doing it in ruby script/console, not just in the command - Ryan Bigg Freelancer http://frozenplague.net On 09/12/2008, at 3:03 PM, Jay Mark wrote: It says: Author.new is not recognized as an internal or external command, operable program or batch file. same for Book.

[Rails] Re: wrong number of arguments (0 for 1) error.... Help!!!

2008-12-08 Thread Ryan Bigg
Ok... then you're on your own if you don't know how to type ruby script/console into a command prompt window and then type some more stuff - Ryan Bigg Freelancer http://frozenplague.net On 09/12/2008, at 3:16 PM, Jay Mark wrote: I am using InstantRails. All I have is the command

[Rails] Re: Wrong number of arguments (2 of 0)

2008-10-24 Thread Thierry Delbart
Juste before trying to migrate thie table clubs, I did it fine with league: class CreateLeagues ActiveRecord::Migration def self.up create_table :leagues do |t| t.columns :name, :string t.columns :ref, :string t.columns :description, :string t.columns :category,

[Rails] Re: Wrong number of arguments (2 of 0)

2008-10-24 Thread Philip Hallstrom
On Oct 24, 2008, at 9:40 AM, Thierry Delbart wrote: Juste before trying to migrate thie table clubs, I did it fine with league: class CreateLeagues ActiveRecord::Migration def self.up create_table :leagues do |t| t.columns :name, :string t.columns :ref, :string