[Rails] Nested form with a N-N relation and a predefined list of elements to choose

2010-09-04 Thread Benoit Daloze
Hi, I recently had to deal with nested form, and I found quite complex to handle it with my situation. I have a list of choices and want to allow the user to use some from a predefined list, by using checkboxes. I posted the question on Stack Overflow a few days ago, but nobody answered yet.

[Rails] [newbie question]how to add a new view to a exist controller?

2010-09-04 Thread John Anderson
hello everybody , I am a newbie to Rails' world. I just start reading the book Agile web Development with rails one question. How can I add a new view to a exist controller? we can use code: rails generate controller controller_1_name [view_1_name view_2_name] however. if I wanna add a

Re: [Rails] Pass selected value in combo as a parameter

2010-09-04 Thread Colin Law
On 3 September 2010 11:35, Alfredo Bonilla li...@ruby-forum.com wrote: Hi, I have a select in my form: %= select @issue_type, name, @issue_types.collect {|p| [p.name, p.id]} % What I need to do is execute a method passing the value selected in the combo. I've tried lot of things, but I

[Rails] Re: Objects with versions: how to avoid 1 + n queries?

2010-09-04 Thread Michael Schuerig
On Friday 03 September 2010, Marnen Laibow-Koser wrote: Marnen Laibow-Koser wrote: Well, you learn something new every day! I found the Ambiguous Groups article on the Web and found that the behavior I thought was standard -- returning the first value in the case of multiple values -- is

[Rails] Trying to create a collection to use for a report

2010-09-04 Thread Bob Smith
I have a database of people that have used a local foodbank. The problem I'm having now is that i need a way to put 2 collections into one variable, like rails does it for partials. I want a variable @oxford that does a Household.find_all_by_zip('01540'). This is no problem. The trouble comes

Re: [Rails] Re: Objects with versions: how to avoid 1 + n queries?

2010-09-04 Thread Colin Law
On 4 September 2010 09:14, Michael Schuerig mich...@schuerig.de wrote: On Friday 03 September 2010, Marnen Laibow-Koser wrote: Marnen Laibow-Koser wrote: Well, you learn something new every day!  I found the Ambiguous Groups article on the Web and found that the behavior I thought was

[Rails] File not found: lib when installing rails-3.0.0

2010-09-04 Thread Dongsheng Wang
I got the following error when try to install rails-3.0.0 on my Ubuntu box. Can anybody help? dw...@dwang-bj-ws:~/Projects$ sudo gem install rails Successfully installed rails-3.0.0 1 gem installed Installing ri documentation for rails-3.0.0... File not found: lib dw...@dwang-bj-ws:~/Projects$

[Rails] Re: Objects with versions: how to avoid 1 + n queries?

2010-09-04 Thread Michael Schuerig
On Saturday 04 September 2010, Colin Law wrote: On 4 September 2010 09:14, Michael Schuerig mich...@schuerig.de wrote: On Friday 03 September 2010, Marnen Laibow-Koser wrote: Marnen Laibow-Koser wrote: Well, you learn something new every day! I found the Ambiguous Groups article on

[Rails] Re: how to add a new view to a exist controller?

2010-09-04 Thread Frederick Cheung
On Sep 4, 5:16 am, John Anderson jno...@gmail.com wrote: hello everybody , I am a newbie to Rails' world. I just start reading the book Agile web Development with rails one question. How can I add a new view to a exist controller? we can use code:      rails generate controller

[Rails] Re: Trying to create a collection to use for a report

2010-09-04 Thread Frederick Cheung
On Sep 4, 9:18 am, Bob Smith bsm...@gmail.com wrote: I have a database of people that have used a local foodbank. The problem I'm having now is that i need a way to put 2 collections into one variable, like rails does it for partials. I want a variable @oxford that does a

[Rails] Re: rake background task can not run

2010-09-04 Thread Frederick Cheung
On Sep 4, 5:38 am, boblu bobl...@gmail.com wrote: I want to use rake background task in rails like this system(cd #{Rails.root} RAILS_ENV=#{Rails.env} rake abc:def -- trace 21 #{Rails.root}/log/rake.log ) This is ok in development environment, but will not work in production mode. What

[Rails] Re: Using ActiveRecord Find with associations

2010-09-04 Thread Pito Salas
Ar Chron wrote: Pito Salas wrote: Here's an example: class LineItem ActiveRecord::Base belongs_to :order end class Order ActiveRecord::Base has_many :line_items end my_line_item = LineItem.find(:zipcode = 12345) Order.find_by_line_item(my_line_item) # doesn't work

[Rails] Re: how to add a new view to a exist controller?

2010-09-04 Thread John Anderson
Thank you for replying. Yes. I can just create a view_3.html.erb and add a new definition for view_3 as def view_3 # some code end Is there no way to create all of them just by enter single line command ? Maybe in Rails 4 :D ? On Sep 4, 5:31 pm, Frederick Cheung

[Rails] Re: Using ActiveRecord Find with associations

2010-09-04 Thread KlausG
Probably not explaining this clearly enough (I blame the distillery masters at Lagavulin), but: Wish I was there! Which of their Beer is available in the US? Lol, Lagavulin is a famous WHISKY destillery By the way, my_order.find_by_line_item fails with no such method, not just by

[Rails] its easy but i forgot all

2010-09-04 Thread ashu
my models borrower- has_many :loans loan -belongs_to :borrower my loans _controller def new @borrower = Borrower.find(params[:borrower_id]) logger.debug ' @borrower.id' logger.debug @borrower.id @loan = Loan.new respond_to do |format|

Re: [Rails] 2.3.5 guide

2010-09-04 Thread Colin Law
On 3 September 2010 18:21, Philip Hallstrom phi...@pjkh.com wrote: It seems the guide at http://guides.rubyonrails.org/ has been updated to 3.0. I am still using 2.3.5 with plans of upgrading. Any ideas on how I can get the older guide? http://guides.rubyonrails.org/v2.3.8/ It would help if

[Rails] Re: Using ActiveRecord Find with associations

2010-09-04 Thread pepe
As I am sure you know the 'find_by*' methods are all dynamic. They are based on the field/column name, not on the type of object the column is supposed to reference (if any). AR will do the magic of finding the ID value if you pass an object to the method but apparently it will not be magic enough

[Rails] Re: Triggering Javascript from a Ruby form

2010-09-04 Thread pepe
I think one of the things you might need is a 'timer', which will let your code 'sleep' before calling again your 'how_finished' function. I have never done this but remember reading about it, I googled for 'javascript sleep timer' and one of the links I found was this:

Re: [Rails] Using ActiveRecord Find with associations

2010-09-04 Thread Colin Law
On 4 September 2010 01:27, Pito Salas li...@ruby-forum.com wrote: Here's an example: class LineItem ActiveRecord::Base  belongs_to :order end class Order ActiveRecord::Base  has_many :line_items end my_line_item = LineItem.find(:zipcode = 12345) Order.find_by_line_item(my_line_item)

[Rails] Dynamic Filters with AJAX (like Redmine/Trac)

2010-09-04 Thread Fernando Brito
Hello Guys, I have a model Person with lots of columns (date, int, string, so on) and right now I need to make a filter for my costumer. My goal is something like this: http://www.redmine.org/projects/redmine/issues. Or, even better: http://trac.edgewall.org/demo-0.12/query. The most

[Rails] Re: Upload file attachment with rest or xml

2010-09-04 Thread Luke Cowell
I'll see if I can help. Can you explain what you want to see happen that's not? What do the logs tell us? If you're able to make this work in some situations, compare the log output to a failed request and see if the differences give us any clues. Luke On Sep 2, 10:55 pm, Rodrigo Dominguez

Re: [Rails] Re: rails 2 or ralis 3, which is better for a new project in real life?

2010-09-04 Thread Rob Biedenharn
On Sep 3, 2010, at 7:27 PM, Philip Hallstrom wrote: On Sep 3, 2010, at 3:44 PM, Cuz Ican wrote: On Sep 3, 2010, at 6:00 AM, 侯健 wrote: Hi, Our team decided to use rails to develop our new web application project. Some of our team members think we should ues rails 3 for our new

[Rails] CSRF protection not working with jquery ajax post request

2010-09-04 Thread Manos
Hallo, I want to test the csrf protection of my application but forgery protection is not working with jquery ajax request. I have used Unobtrusive Javascript with jquery I have removed the %= csrf_meta_tag % so that my application do not include authenticity token. In my view I have the

[Rails] Store a single variable / row in database

2010-09-04 Thread Shea Barton
What would be the best way in rails to store a single variable and have it persist. Like a have a variable that says total_visits that counts the total number of page loads. The only solution I can think of is having a table with a single row. -- Posted via http://www.ruby-forum.com/. -- You

[Rails] Cannot seem to display Comments on User Show Page

2010-09-04 Thread Kelp Kelp
Hello, I have added a comment form to my article show page, but after I submit the comment, I get the following error: Couldn't find Article without an ID. I think it is because the Comments controller does not know which article to add the new comment. comments_controller: def create

[Rails] Re: Cannot seem to display Comments on User Show Page

2010-09-04 Thread PsiPro
It would help to know the URL your being redirected to... but I see one potential issue: if @comment.save flash[:success] = Comment saved. redirect_to articles_path(@article) else render 'show' end Lets pretened your comment failed to save... your rendering show...

[Rails] What does mean in a sql query?

2010-09-04 Thread Pito Salas
This is from the rails log: SELECT district_sets.id FROM district_sets WHERE (district_sets.ident = 'juris-60c8bcea56c0dfa02d121691e0e72152' AND district_sets.id 12) LIMIT 1 I am confused by the operator. Can anyone clarify that for me please? Thanks! -- Pito -- Posted via

[Rails] Re: Store a single variable / row in database

2010-09-04 Thread PsiPro
IMHO The biggest problem with rails is the fact that it makes working easy and fun as long as your work can follow the MVC system. If you try to do it your way it won't be the rails way (at least as far as I know). If you want to track any more information other then number of pages views, create

[Rails] Re: What does mean in a sql query?

2010-09-04 Thread PsiPro
http://dev.mysql.com/doc/refman/5.0/en/non-typed-operators.html not equals On Sep 4, 2:06 pm, Pito Salas li...@ruby-forum.com wrote: This is from the rails log: SELECT district_sets.id FROM district_sets WHERE (district_sets.ident = 'juris-60c8bcea56c0dfa02d121691e0e72152' AND

[Rails] Re: What does mean in a sql query?

2010-09-04 Thread Fernando Perez
!= -- 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 to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to

[Rails] Re: File not found: lib when installing rails-3.0.0

2010-09-04 Thread PsiPro
I can verify this on ubuntu using those specs. I installed rails 3 using ruby 1.9.2 and RVM. I suggest that as well. http://rvm.beginrescueend.com/ There is a railscsts on rvm as well. Brian On Sep 4, 4:36 am, Dongsheng Wang li...@ruby-forum.com wrote: I got the following error when try to

[Rails] Re: rake background task can not run

2010-09-04 Thread PsiPro
My first suspicion would be that you need the full path to rake but no promises :) On Sep 4, 5:36 am, Frederick Cheung frederick.che...@gmail.com wrote: On Sep 4, 5:38 am, boblu bobl...@gmail.com wrote: I want to use rake background task in rails like this system(cd #{Rails.root}

[Rails] Nothing is being inserted into the database...help!

2010-09-04 Thread Zack Nathan
Hello all, for some reason nothing is being inserted into the database. I have no idea why not! Here is my action: def create @information = CalorieKing.new @information = CalorieKing.get_information(params[:id]) @information = @information['food']['servings']

[Rails] Re: YM4R - convert variable to string error

2010-09-04 Thread fonemstr
I had the same problem. In mapping.rb of the plugin, add this function to class Variable def to_str @variable + ; end Appears to work fine after this fix. Dave -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group,

[Rails] Re: What does mean in a sql query?

2010-09-04 Thread Pito Salas
Fernando Perez wrote: != Thanks... The reason I didn't think that is what it meant (although I believe you :) is that I saw it here: [Development] ap j #DistrictSet:0x105568550 { :id = 3, :display_name = ds2, :created_at = Sat, 04 Sep 2010 11:21:36 PDT

Re: [Rails] Re: What does mean in a sql query?

2010-09-04 Thread Colin Law
On 4 September 2010 20:49, Pito Salas li...@ruby-forum.com wrote: Fernando Perez wrote: != Thanks... The reason I didn't think that is what it meant (although I believe you :) is that I saw it here: [Development] ap j #DistrictSet:0x105568550 {                   :id = 3,        

[Rails] Pass a value from controller to model

2010-09-04 Thread Pål Bergström
I'm trying to pass a value from a cookie from the controller into model by using attr_accessor. But it doesn't work and I suspect I do something wrong. Is this on the right path? class Test ActiveRecord::Base attr_accessor :key key .. end class TestController ApplicationController

[Rails] about routes

2010-09-04 Thread trencaclosques
Hello everyone, I'm trying to map a controller actions with the name as a action. I've got it well: match /home = main#home, :as = :home match /contact = main#contact, :as = :contact match /whoweare = main#whoweare, :as = :whoweare But I want to do this with only one line of code. I've tried it

[Rails] Moving ROR Dev from one windows PC to another

2010-09-04 Thread DMaster
Is it possible to move the complete ROR install/development directory or directories to new PC and continue to work/dev as the original one? Are there any registry entries that would preclude this working on the new PC? Thanks! -- You received this message because you are subscribed to the

[Rails] Re: Nothing is being inserted into the database...help!

2010-09-04 Thread Frederick Cheung
On 4 Sep, 20:23, Zack Nathan li...@ruby-forum.com wrote: Hello all, for some reason nothing is being inserted into the database. I have no idea why not! Here is my action: Did you check for any validations failing Fred   def create     @information = CalorieKing.new     @information =

[Rails] Decimal numbers pain

2010-09-04 Thread Fernando Perez
Hi, What do you guys use to definitely handle decimal numbers? This is getting me crazy! I use BigDecimal, but it craps out of the input number is something like 14,53, Rails transforms it as 14.0 Any solution? -- Posted via http://www.ruby-forum.com/. -- You received this message because

[Rails] Re: What does mean in a sql query?

2010-09-04 Thread Fernando Perez
Do you understand what it means? It's probably a validates_uniqueness_of that adds that additional query. -- 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 to this group, send email to

[Rails] Re: Pass a value from controller to model

2010-09-04 Thread Fernando Perez
It should work. What makes you think it doesn't? -- 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 to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this

[Rails] Re: Decimal numbers pain

2010-09-04 Thread Greg Willits
What do you guys use to definitely handle decimal numbers? This is getting me crazy! I use BigDecimal, but it craps out of the input number is something like 14,53, Rails transforms it as 14.0 Any solution? Are you really using the comma in the data? This IRB session suggests what might

[Rails] Re: Nothing is being inserted into the database...help!

2010-09-04 Thread Greg Willits
for some reason nothing is being inserted into the database. I have no idea why not! Here is my action: The most common cause is that validations are failing, and you're just not seeing that. -- gw -- Posted via http://www.ruby-forum.com/. -- You received this message because you are

[Rails] Re: Cannot seem to display Comments on User Show Page

2010-09-04 Thread Kelp Kelp
I figured out the problem with the original post, but I have a new problem. When a user submits an invalid comment(if the title or content does not validate correctly), they get sent back to the article. There are two problems, though. 1. The form does not keep the previous field content, so

[Rails] Re: Store a single variable / row in database

2010-09-04 Thread Greg Willits
What would be the best way in rails to store a single variable and have it persist. Like a have a variable that says total_visits that counts the total number of page loads. The only solution I can think of is having a table with a single row. One answer would be yes, pretty much if you

[Rails] Re: Cannot seem to display Comments on User Show Page

2010-09-04 Thread Fernando Perez
You almost have it all correct, just in your view: %= form_for([...@article, @comment]) do |f| % -- http://digiprof.tv -- 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 to this group,

[Rails] Re: Nothing is being inserted into the database...help!

2010-09-04 Thread Fernando Perez
And your controller should be put on a diet... -- http://digiprof.tv -- 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 to this group, send email to rubyonrails-t...@googlegroups.com. To

[Rails] Re: Decimal numbers pain

2010-09-04 Thread Fernando Perez
It seems Rails does it a bit differently. Anyway I was able to find a solution: http://gem-session.com/2010/03/how-to-use-the-comma-as-decimal-separator-in-rails-activerecord-columns-and-text-fields -- http://digiprof.tv -- Posted via http://www.ruby-forum.com/. -- You received this

[Rails] Re: Authlogic user login and register new user side-by-side

2010-09-04 Thread Fernando Perez
and then rendering a partial of the login form on the 'new' action of users. Am I in the right direction? Yes, simply render a partial for registration on login page or vice-versa. See this example: http://suivauto.com/login -- Posted via http://www.ruby-forum.com/. -- You received this

[Rails] Re: Store a single variable / row in database

2010-09-04 Thread Shea Barton
Well, specifically what it would be for is an app which parses / collects stats on twitter. I want to have a persistant of the ID (twitter side) of the most recent parsed tweet, so I know where to start at the next startup, or in case it gets interrupted. I don't what to log every tweet I

[Rails] sqlite3/sqlite3_native (LoadError)

2010-09-04 Thread Dani Dani
Hi, I have installed ruby 1.9.2, rubygems 1.3.7 and rails 3.0. created a demo application. when I start 'rails server' I get: 'require': no such file to load -- sqlite3/sqlite3_native (LoadError) any idea ? Thank you. Dani -- Posted via http://www.ruby-forum.com/. -- You received this

[Rails] Re: about routes

2010-09-04 Thread trencaclosques
I forgot to say that I'm using Rails 3 and Ruby 1.9.2 . -- 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 rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to

Re: [Rails] Store a single variable / row in database

2010-09-04 Thread Charles A. Lopez
change your question to how can count the total number of page loads for ? For what? On 4 September 2010 13:26, Shea Barton li...@ruby-forum.com wrote: What would be the best way in rails to store a single variable and have it persist. Like a have a variable that says total_visits

[Rails] Rails friendly Forex broker?

2010-09-04 Thread Jeff Pritchard
I'm starting a new hobby. Going to learn about and have a try at building some automated trading systems for forex and other markets. So far I've been very disappointed with the results of my googling looking for a broker and/or third-party product to use as a bridge between the software I will

[Rails] Developing a web chat using Rails 3

2010-09-04 Thread Maurizio De Santis
Hi! I'm trying to develop a web chat (like the facebook one, but much simpler) that works inside Rails 3, and so I'm inquiring about the methods used for this scope. I had some success applying this guide http://www.web2media.net/laktek/2010/02/16/building-real-time-web-apps-with-rails3/ , so now