From testmyeclipse at ua.fm Tue Feb 5 01:40:38 2008 From: testmyeclipse at ua.fm (Igor K.) Date: Tue, 5 Feb 2008 07:40:38 +0100 Subject: [Rails I18n] NEED: Translate/localize RoR site Message-ID: Hello, I need a localization tool/plugin for my rails application that work with REST, can translate whole web pages(or i can create 2 different pages for 2 languages), and fast. Thanks for any suggestions!!!! -- Posted via http://www.ruby-forum.com/. From chris.sepic at gmail.com Tue Feb 5 10:44:06 2008 From: chris.sepic at gmail.com (Chris Sepic) Date: Tue, 5 Feb 2008 16:44:06 +0100 Subject: [Rails I18n] default value on a column w/ a sequence - Postgres Message-ID: I recently modified the customer_number field in my Users table in a migration: remove_column :users, :customer_number execute "CREATE SEQUENCE user_customer_number_seq MINVALUE 10000;" execute "ALTER TABLE users ADD customer_number integer " + "DEFAULT nextval('user_customer_number_seq') NOT NULL UNIQUE;" I want the default value (next in sequence) to be used when I create a new user. I thought Rails would handle this, but instead I'm getting: PGError: ERROR: null value in column "customer_number" violates not-null constraint I want to keep the NOT NULL constraint. I thought about something like this: before_validation_on_create :set_customer_number def set_customer_number cust_no = next_sequence_value('user_customer_number_seq') self.customer_number = cust_no end Although that's not quite right. next_sequence_value is not defined in the Postgres adapter. How would I write set_customer_number? Or would removing the null constraint and relying on validates_presence_of :customer_number be enough? -- Posted via http://www.ruby-forum.com/. From chris.sepic at gmail.com Tue Feb 5 15:12:27 2008 From: chris.sepic at gmail.com (Chris Sepic) Date: Tue, 5 Feb 2008 21:12:27 +0100 Subject: [Rails I18n] default value on a column w/ a sequence - Postgres In-Reply-To: References: Message-ID: <8ea006ff0304c0b1dda19cafd17989ce@ruby-forum.com> Chris Sepic wrote: > I recently modified the customer_number field in my Users table in a > migration: > > remove_column :users, :customer_number > execute "CREATE SEQUENCE user_customer_number_seq MINVALUE 10000;" > execute "ALTER TABLE users ADD customer_number integer " + > "DEFAULT nextval('user_customer_number_seq') NOT NULL UNIQUE;" > > I want the default value (next in sequence) to be used when I create a > new user. I thought Rails would handle this, but instead I'm getting: > > PGError: ERROR: null value in column "customer_number" violates > not-null constraint > > I want to keep the NOT NULL constraint. I thought about something like > this: > > before_validation_on_create :set_customer_number > > def set_customer_number > cust_no = next_sequence_value('user_customer_number_seq') > self.customer_number = cust_no > end > > Although that's not quite right. next_sequence_value is not defined in > the Postgres adapter. How would I write set_customer_number? Or would > removing the null constraint and relying on validates_presence_of > :customer_number be enough? Ok, figured it out: def set_customer_number customer_number_sequence = 'user_customer_number_seq' cust_no = connection.select_value("select nextval('#{customer_number_sequence}')") self.customer_number = cust_no end Actually ended up getting rid of the null constraint, but I still need the above for validation in one of my models. -- Posted via http://www.ruby-forum.com/. From brad.carson at gmail.com Tue Feb 12 22:32:31 2008 From: brad.carson at gmail.com (Brad Carson) Date: Wed, 13 Feb 2008 04:32:31 +0100 Subject: [Rails I18n] no unicode in rails console Message-ID: I'm unable to enter characters like ? (in Caf?) into script/console but they work just fine in the regular terminal. I can't seem to find anyone ever having an issue with this out there. I'd be so grateful for any ideas. # in config/environment.rb ENV['LANG'] # => 'en_US.UTF-8' ENV['LC_CTYPE'] # => 'en_US.UTF-8' # from terminal: # locale LANG="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_CTYPE="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_ALL="en_US.UTF-8" System config: Rails 2.0.2 Ruby 1.8 Mac OS X Leopard Regards, Brad -- Posted via http://www.ruby-forum.com/. From ij.rubylist at gmail.com Mon Feb 25 09:59:04 2008 From: ij.rubylist at gmail.com (Izidor Jerebic) Date: Mon, 25 Feb 2008 15:59:04 +0100 Subject: [Rails I18n] no unicode in rails console In-Reply-To: References: Message-ID: <3C3F7204-0B51-4724-8532-1B3FBD9E1AEE@gmail.com> Just to confirm - I could not enter anything outside ASCII either. It seems that the irb (which is used by script/console) input code is a bit dumb... I forgot exact solution but I thing I did something like simple redirection with pipe 'cat | irb' or 'cat | script/console' and I could enter the characters.... izidor On 13.2.2008, at 4:32, Brad Carson wrote: > I'm unable to enter characters like ? (in Caf?) into script/console > but > they work just fine in the regular terminal. I can't seem to find > anyone ever having an issue with this out there. > > I'd be so grateful for any ideas. > > # in config/environment.rb > ENV['LANG'] # => 'en_US.UTF-8' > ENV['LC_CTYPE'] # => 'en_US.UTF-8' > > # from terminal: > # locale > LANG="en_US.UTF-8" > LC_COLLATE="en_US.UTF-8" > LC_CTYPE="en_US.UTF-8" > LC_MESSAGES="en_US.UTF-8" > LC_MONETARY="en_US.UTF-8" > LC_NUMERIC="en_US.UTF-8" > LC_TIME="en_US.UTF-8" > LC_ALL="en_US.UTF-8" > > System config: > Rails 2.0.2 > Ruby 1.8 > Mac OS X Leopard > > Regards, > Brad > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Railsi18n-discussion mailing list > Railsi18n-discussion at rubyforge.org > http://rubyforge.org/mailman/listinfo/railsi18n-discussion From brad.carson at gmail.com Mon Feb 25 10:17:14 2008 From: brad.carson at gmail.com (Brad Carson) Date: Mon, 25 Feb 2008 16:17:14 +0100 Subject: [Rails I18n] no unicode in rails console In-Reply-To: <3C3F7204-0B51-4724-8532-1B3FBD9E1AEE@gmail.com> References: <3C3F7204-0B51-4724-8532-1B3FBD9E1AEE@gmail.com> Message-ID: Izidor Jerebic wrote: > Just to confirm - I could not enter anything outside ASCII either. It > seems that the irb (which is used by script/console) input code is a > bit dumb... > > I forgot exact solution but I thing I did something like simple > redirection with pipe 'cat | irb' or 'cat | script/console' and I > could enter the characters.... > > izidor Interesting. I was eventually able to get it working by following these steps: http://www.macosxhints.com/article.php?story=20060825071728278 Hopefully this will help someone in a similar situation. Thank you for responding. Brad -- Posted via http://www.ruby-forum.com/. From jerome at yayel.com Mon Feb 25 11:26:00 2008 From: jerome at yayel.com (=?UTF-8?Q?J=C3=A9r=C3=B4me_Lipowicz?=) Date: Mon, 25 Feb 2008 17:26:00 +0100 Subject: [Rails I18n] no unicode in rails console In-Reply-To: References: Message-ID: <8a7ce02e0802250826r58a082caq6db19f5ef087d68d@mail.gmail.com> On Wed, Feb 13, 2008 at 4:32 AM, Brad Carson wrote: > I'm unable to enter characters like ? (in Caf?) into script/console but > they work just fine in the regular terminal. I can't seem to find > anyone ever having an issue with this out there. The input is not related to rails but to your terminal itself. Make sure you also set "Unicode" in Preferences > Settings > Advanced tab > International. Hoping it will fix your issue. -- J?r?me Lipowicz From satyadasa at gmail.com Wed Feb 27 10:49:03 2008 From: satyadasa at gmail.com (John Ruby) Date: Wed, 27 Feb 2008 16:49:03 +0100 Subject: [Rails I18n] no unicode in rails console In-Reply-To: References: <3C3F7204-0B51-4724-8532-1B3FBD9E1AEE@gmail.com> Message-ID: <7475f77a1d86d1e58bb320297fc7ab0a@ruby-forum.com> Brad Carson wrote: > Izidor Jerebic wrote: >> Just to confirm - I could not enter anything outside ASCII either. It >> seems that the irb (which is used by script/console) input code is a >> bit dumb... >> >> I forgot exact solution but I thing I did something like simple >> redirection with pipe 'cat | irb' or 'cat | script/console' and I >> could enter the characters.... >> >> izidor > > Interesting. I was eventually able to get it working by following these > steps: http://www.macosxhints.com/article.php?story=20060825071728278 > > Hopefully this will help someone in a similar situation. Thank you for > responding. > > Brad I have the same problem and followed the steps at macosxhints regarding .profile, .inputrc, and .MacOSX/environment.plist, but it still doesn't work. I'm using Leopard 10.5.2, Ruby 1.8.6., Rails 2.0.2. -- Posted via http://www.ruby-forum.com/. From ranju.bkr at gmail.com Thu Feb 28 05:37:34 2008 From: ranju.bkr at gmail.com (Ranjan Rao) Date: Thu, 28 Feb 2008 11:37:34 +0100 Subject: [Rails I18n] Page not displaying Message-ID: <8ad26d8188eeeffe299affb036c20eb6@ruby-forum.com> Hi, I have following db schema: Seminars (id, ...) has_many :seminars_presentations has_many presentations, :through => seminar_presentations Presentations (id, ...) has_many :seminar_presentations has_many :seminars, :through => seminar_presentations seminars_presentations (seminar_id, presentation_id,......) belongs_to :presentation belongs_to :seminar Now, I would like to implement as below: Assumption: Presentations & Seminars tables has few records. I need to show the proposed (future) Seminar dates as links. To register an exisintg presentation to the seminar, the user clicks on a future date link. Then already registered presentations for that (just selected) seminar should be displayed and there should be option to add one more presentation to it. Once the user selectes a new presentation to register and clicks the "Register Presentation" link, that presentation should get registered with the seminar (from seminar date we can reach the seminar_id and use it to register). I have used Query string to get the proposed (future) Seminar date and then that date I use it to display on the view. Now, my problem is when I try to add a presentation to the seminar, rails gives error nil.date. So, now I cannot register the presentation to the seminar. Please help me. Thanks. -- Posted via http://www.ruby-forum.com/.