[Rails] Re: How to create a custom time select form element?

2011-08-14 Thread Andrew
I could easily write the HTML to create a few select elements, however, it's the Ruby part that I am not as familiar with. Could you provide an example of what the controller code (or model, helper, etc) would look like to convert the 3 fields into a valid time value ready to store in a

[Rails] Re: sessions store

2011-08-14 Thread Tomas R.
if cookies is permanent i cant verify if signed in is true or false -- 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-talk@googlegroups.com. To

Re: [Rails] Re: RUBY ON RAILS MIGRATION

2011-08-14 Thread Colin Law
On 14 August 2011 05:04, Nagesh Shenoy li...@ruby-forum.com wrote: Thank you Walter and Colin for giving such a good idea. I ll try with foreigner gem and will go through rails guide. 1.)Actually i wanted to confirm whether rails has support for non-integer primary_key? It can be done, but

Re: [Rails] Re: How to create a custom time select form element?

2011-08-14 Thread Dheeraj Kumar
I highly recommend using jQueryUI Datepicker for more usable date selection. However, if you want to have it your way, create fields in your model for all the select boxes, and use the before_save callback to construct the final date field for storing in the database. Refer

Re: [Rails] Re: RUBY ON RAILS MIGRATION

2011-08-14 Thread Dheeraj Kumar
3. Yes. http://compositekeys.rubyforge.org/ On Sun, Aug 14, 2011 at 12:42 PM, Colin Law clan...@googlemail.com wrote: On 14 August 2011 05:04, Nagesh Shenoy li...@ruby-forum.com wrote: Thank you Walter and Colin for giving such a good idea. I ll try with foreigner gem and will go through

Re: [Rails] What Is Wrong With Code - I am beginner- Time Limit Exceed Problem

2011-08-14 Thread Colin Law
On 14 August 2011 05:56, Rahul raikra...@gmail.com wrote: # To change this template, choose Tools | Templates # and open the template in the editor. puts Hello World def squareroot(a)   u=a   l=0   while (l=u)     m = l + (u-1)/2     if (m**2) a     l = m + 1     elsif (m**2) a  

Re: [Rails] What Is Wrong With Code - I am beginner- Time Limit Exceed Problem

2011-08-14 Thread John Winters
On 14/08/11 05:56, Rahul wrote: # To change this template, choose Tools | Templates # and open the template in the editor. puts Hello World def squareroot(a) u=a l=0 while (l=u) m = l + (u-1)/2 puts u = #{u}, l = #{l}, m = #{m} if (m**2) a [snip rest of code]

Re: [Rails] Re: How to create a custom time select form element?

2011-08-14 Thread Colin Law
On 14 August 2011 07:42, Andrew misbehav...@gmail.com wrote: I could easily write the HTML to create a few select elements, however, it's the Ruby part that I am not as familiar with. Could you provide an example of what the controller code (or model, helper, etc) would look like to convert

[Rails] Re: sessions store

2011-08-14 Thread 7stud --
Read this: http://ruby.railstutorial.org/chapters/sign-in-sign-out#sec:sessions -- 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: How to create a custom time select form element?

2011-08-14 Thread 7stud --
however, it's the Ruby part that I am not as familiar with. Then it's time to put rails away and buy a beginning ruby book. -- 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

Re: [Rails] Re: How to create a custom time select form element?

2011-08-14 Thread Dheeraj Kumar
The Ruby Programming Language by Matz is my personal favorite. You might want to try that. On Sun, Aug 14, 2011 at 1:05 PM, 7stud -- li...@ruby-forum.com wrote: however, it's the Ruby part that I am not as familiar with. Then it's time to put rails away and buy a beginning ruby book. --

[Rails] Rails 3 - small route question

2011-08-14 Thread Samhita
Hi, resources :car do resources :wheel resources :engine do resources :piston do .. so a normal url would be localhost:3000/cars/engines/piston... I want to rename these objects to something similar localhost:3000/c/e/ p Basically ONLY in the web url displayed in browser I want

[Rails] problem of creating a new project

2011-08-14 Thread alfredtofu
once it new a project, use this command: rails new demo, and it will run the bundle install command, it takes too long, how to solve it? this problem appears in ubuntu, when i create a project in windows, no such problem. -- You received this message because you are subscribed to the Google

[Rails] Best Rails install for production.

2011-08-14 Thread Yaroslav Govorunov
Hello! Which Ruby on Rails installation scenario is the best for performance and durability in production: - Ubunthu + Apache + Passanger - Ubunthu + Nginx + Unicorn - Ubunthu + Apache + Mongrel - Any other option? And could someone provide links to some best practice or guidelines to install

[Rails] Re: Best Rails install for production.

2011-08-14 Thread Frederick Cheung
On Aug 14, 10:33 am, Yaroslav Govorunov govoru...@gmail.com wrote: Hello! Which Ruby on Rails installation scenario is the best for performance and durability in production: - Ubunthu + Apache + Passanger - Ubunthu + Nginx + Unicorn - Ubunthu + Apache + Mongrel - Any other option? Well

[Rails] Re: Long polling (comet) on Rails

2011-08-14 Thread Frederick Cheung
On Aug 11, 12:27 pm, Yaroslav G. li...@ruby-forum.com wrote: Hello! I’d like to share some concepts with community regarding asynchronous operations in Rails, hoping for feedback and advice. We (Helicon Tech) currently work on Ruby on Rails implementation for Microsoft IIS. Our goal is to

Re: [Rails] Rails 3 - small route question

2011-08-14 Thread Chris Mear
On 14 Aug 2011, at 04:27, Samhita wrote: Hi, resources :car do resources :wheel resources :engine do resources :piston do .. so a normal url would be localhost:3000/cars/engines/piston... I want to rename these objects to something similar localhost:3000/c/e/ p

[Rails] belongs_to + :inverse_of + accepts_nested_attributes_for causes stack overflow on save

2011-08-14 Thread Alexey Muranov
Hello, i have just submitted a bug report, but maybe anybody has some experience with this problem? Here are the steps to reproduce the error: Create an application with 2 models: $ rails new assoc_test_app $ cd assoc_test_app $ rails generate model Person name:string $ rails generate model

[Rails] Re: Newbie of ROR

2011-08-14 Thread Maese
http://ruby.railstutorial.org/ruby-on-rails-tutorial-book http://guides.rubyonrails.org/ On 12 ago, 07:10, honey ruby emailtohoneyr...@gmail.com wrote: Can any one guide to to learn much easy and to learn great extent .i know the basic concepts of loop, form,link_to , redirect_to.then whats

[Rails] Convention (not for RoR API)

2011-08-14 Thread Daniel
Example RoR API: The file name: (no follows rails name convention): actionpack/lib/action_view/helpers/javascript_helper.rb The Module name (in namespace ActionView::Helpers) : module JavaScriptHelper Our custom code: The file name: App/Helpers/javascript_helper.rb The

[Rails] Re: belongs_to + :inverse_of + accepts_nested_attributes_for causes stack overflow on save

2011-08-14 Thread Alexey Muranov
This bug is not present in rails 3.1! -- 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-talk@googlegroups.com. To unsubscribe from this group, send

[Rails] Re: Long polling (comet) on Rails

2011-08-14 Thread Yaroslav Govorunov
On Aug 14, 1:52 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Aug 11, 12:27 pm, Yaroslav G. li...@ruby-forum.com wrote: Thank you Fred for your answers! Personally I worry slightly about ruby's ability to handle several thousand IO streams. Does it use efficient select

[Rails] Access to asset_path in a model in 3.1

2011-08-14 Thread Martin Wawrusch
Hi guys, I need to access the asset_path helper from within a model to get the full path of an asset. How do I do that? Thanks Martin -- 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] Rspec in rails console

2011-08-14 Thread Nike Mike
Can we able to use rspec in rails console -- 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-talk@googlegroups.com. To unsubscribe from this group,

[Rails] RegExp error:

2011-08-14 Thread Misha Ognev
Hi! This problem(in model): validates :some_digits_collection, :presence = true, :format = { :with = /^\d*$/, :message = Must contain only digits! } So, :some_digits_collection must match only digits. But when I puts 123f(for example) in my form, it matches too and there no errors! Why? --

[Rails] Puzzled with form on multiple table rows

2011-08-14 Thread Michael Baldock
I've got a table of events, and each event has a boolean attribute is_ten_event. On each row of the table is a chekbox to edit the value of is_ten_event, so that multiple rows can be edited with one submit. In order to allow boxes to be un-checked as well, the logic in the controller works like

Re: [Rails] RegExp error:

2011-08-14 Thread Walter Lee Davis
On Aug 14, 2011, at 2:29 PM, Misha Ognev wrote: Hi! This problem(in model): validates :some_digits_collection, :presence = true, :format = { :with = /^\d*$/, :message = Must contain only digits! } So, :some_digits_collection must match only digits. But when I puts 123f(for example) in my

Re: [Rails] Puzzled with form on multiple table rows

2011-08-14 Thread Walter Lee Davis
On Aug 14, 2011, at 2:58 PM, Michael Baldock wrote: I've got a table of events, and each event has a boolean attribute is_ten_event. On each row of the table is a chekbox to edit the value of is_ten_event, so that multiple rows can be edited with one submit. In order to allow boxes to be

Re: [Rails] RegExp error:

2011-08-14 Thread Rafael Ubaldo
It matches because it's true. The expressions states any number of digits before the end of line. It does not state exclusively digits. On Aug 14, 2011, at 12:19 PM, Walter Lee Davis wrote: On Aug 14, 2011, at 2:29 PM, Misha Ognev wrote: Hi! This problem(in model): validates

Re: [Rails] RegExp error:

2011-08-14 Thread Walter Lee Davis
On Aug 14, 2011, at 4:42 PM, Rafael Ubaldo wrote: It matches because it's true. The expressions states any number of digits before the end of line. It does not state exclusively digits. That wasn't what I got from it on Rubular. The ^ and $ surrounding the \d* mean the entire line is

[Rails] Import CSV directly to Database Rails 3.x

2011-08-14 Thread Alpha Blue
In case anyone likes to import .csv files, or you need to do some single table exports through csv and then re-import them later on, you can use the following code I created. The first file is the rake file and the second file is the lib file. The command to use is: rake

[Rails] Re: Puzzled with form on multiple table rows

2011-08-14 Thread Michael Baldock
Walter, thanks for helping, Try doing it without any special effort in the controller. Not sure what you mean I should do, I understand what you're saying, but I'm not sure what the 'normal' / simple way to do this is. This is what I've got in the controller after trying to simplify like you

Re: [Rails] Rspec in rails console

2011-08-14 Thread Leonardo Mateo
On Sun, Aug 14, 2011 at 3:17 PM, Nike Mike li...@ruby-forum.com wrote: Can we able to use rspec in rails console Start your console in the test environment rails console test -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google

Re: [Rails] Re: Puzzled with form on multiple table rows

2011-08-14 Thread Walter Lee Davis
On Aug 14, 2011, at 5:31 PM, Michael Baldock wrote: Walter, thanks for helping, Try doing it without any special effort in the controller. Not sure what you mean I should do, I understand what you're saying, but I'm not sure what the 'normal' / simple way to do this is. This is what

[Rails] Re: RegExp error:

2011-08-14 Thread Misha Ognev
Perhaps the input value is being cast to an integer for storage, and so the trailing letters are being stripped out. This is one simple way to check this: puts f123 to field. f123.to_i = 0 123f.to_i = 123 But in Rails validation, f123 is validates too. Michael -- Posted via

[Rails] Re: Building a webservice with ruby on rails

2011-08-14 Thread Ronaldo Paiva
Thank you so much, works! -- 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-talk@googlegroups.com. To unsubscribe from this group, send email to

[Rails] Re: sessions store

2011-08-14 Thread Tomas R.
i dont need the cookie for the current user, but for every user. So a user can see if someone else is connected or not -- 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

Re: [Rails] Re: RegExp error:

2011-08-14 Thread Walter Lee Davis
But 0 passes this regex -- it's one digit. If you wanted to ensure that you had n or more digits, you would use a regex like this: ^\d{2,}$ to match two or more digits. Or, you could check to see if the first digit was larger than a 0 if that first digit cannot ever be 0: ^[1-9]\d*$

Re: [Rails] Re: sessions store

2011-08-14 Thread Walter Lee Davis
On Aug 14, 2011, at 9:55 PM, Tomas R. wrote: i dont need the cookie for the current user, but for every user. So a user can see if someone else is connected or not Read up on storing the session in a database in the Rails Guide. That way you can query the database to find out who's on

Re: [Rails] Building a webservice with ruby on rails

2011-08-14 Thread Fernando Almeida
Examples with authentication http://www.justinbritten.com/work/2009/05/rails-api-authentication-using-restful-authentication/ http://www.whatcodecraves.com/articles/2008/11/25/how_to_make_an_api_for_a_rails_app/ 2011/8/13 Ronaldo Paiva li...@ruby-forum.com Hi, i'm new in this forum. I

[Rails] Re: sessions store

2011-08-14 Thread 7stud --
Tomas R. wrote in post #1016683: i dont need the cookie for the current user, but for every user. Adding requirements at this late date voids our contract. I quit. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby