Re: [Rails] Need help debugging syntax error from Agile Web Development, 3RD Edition

2009-12-04 Thread Christoph Jasinski
That's an easy one, really. You got a typo. ** class Product ActiveRecord::Base validates_presence_of :title, :description, :image_url, validates_numericality_of :price ** remove the last comma from the line

Re: [Rails] Need help debugging syntax error from Agile Web Development, 3RD Edition

2009-12-04 Thread Dhruva Sagar
As far as I can see there is an extra ',' (comma) at the end of the first statement, the statement just before your validates_numericality_of. I have indicated that below within *[]*. Removing that should solve your issue. class Product ActiveRecord::Base validates_presence_of :title,

[Rails] Re: Need help debugging syntax error from Agile Web Development, 3RD Edition

2009-12-04 Thread pauld
Thank you. I'm still getting an error for the second statement: /Users/pdenlinger/Sites/depot/app/models/product.rb:9: syntax error, unexpected tASSOC, expecting kEND ... :message = 'must be a URL for GIF, JPG' ... ^ The code is as follows:

Re: [Rails] Re: Need help debugging syntax error from Agile Web Development, 3RD Edition

2009-12-04 Thread Colin Law
2009/12/4 pauld paul.denlin...@gmail.com: Thank you. I'm still getting an error for the second statement: /Users/pdenlinger/Sites/depot/app/models/product.rb:9: syntax error, unexpected tASSOC, expecting kEND ...                   :message = 'must be a URL for GIF, JPG' ...                

[Rails] Re: Need help debugging syntax error from Agile Web Development, 3RD Edition

2009-12-04 Thread pauld
Hi Colin-- Thanks. Got the errors. Two missing commas. Will try to avoid repeating that mistake in the future. Paul On Dec 4, 4:23 pm, Colin Law clan...@googlemail.com wrote: 2009/12/4 pauld paul.denlin...@gmail.com: Thank you. I'm still getting an error for the second statement:

Re: [Rails] How to show two models output in one page

2009-12-04 Thread suji A
Thank you sir, i got some idea from this. Hereafter i can implement it in my application. The scenario for this is , i have to create one application that should have three part in a one page, in that the first part will show the recent post and the second part will show the video and the third

Re: [Rails] pdf generation

2009-12-04 Thread Borja Martín
Hi, I wrote a plugin to generate pdfs using a view: http://github.com/dagi3d/acts_as_flying_saucer the problem is that you will need java to run it there are other alternatives like http://github.com/lleirborras/render_as_pdf (you will need php) and http://github.com/lleirborras/wicked_pdf wich

[Rails] Need help with rake db:migrate error

2009-12-04 Thread pauld
Trying to do a rake db:migrate command and am getting this error. Your help appreciated. Macintosh:depot pdenlinger$ rake --trace (in /Users/pdenlinger/Sites/depot) ** Invoke default (first_time) ** Invoke test (first_time) ** Execute test ** Invoke test:units (first_time) ** Invoke

Re: [Rails] Re: Need help debugging syntax error from Agile Web Development, 3RD Edition

2009-12-04 Thread Tom Stuart
2009/12/4 pauld paul.denlin...@gmail.com: Thank you. I'm still getting an error for the second statement: /Users/pdenlinger/Sites/depot/app/models/product.rb:9: syntax error, unexpected tASSOC, expecting kEND ...                   :message = 'must be a URL for GIF, JPG' ...                

Re: [Rails] Re: Massive memory eating

2009-12-04 Thread Trausti Thor Johannsson
Does that mean I need to change any more code than is in my model ? I did set GC.start inside Photo.save in the controller. The situation does not go out of hand any more, but the app is using quite a lot of memory none the less. Trausti On Tue, Dec 1, 2009 at 2:21 PM, Peter De Berdt

[Rails] Re: Need help with rake db:migrate error

2009-12-04 Thread pauld
This is the code from the Agile Web Development 3rd Edition, which I pasted into the original db/migrate file, and tried to use rake to migrate to the SQLite DB: c#--- # Excerpted from Agile Web Development with Rails, 3rd Ed., # published by The Pragmatic Bookshelf. # Copyrights apply to this

Re: [Rails] Re: Massive memory eating

2009-12-04 Thread Peter De Berdt
On 04 Dec 2009, at 11:13, Trausti Thor Johannsson wrote: Does that mean I need to change any more code than is in my model ? I did set GC.start inside Photo.save in the controller. The situation does not go out of hand any more, but the app is using quite a lot of memory none the less.

Re: [Rails] Re: Massive memory eating

2009-12-04 Thread Peter De Berdt
On 04 Dec 2009, at 12:42, Peter De Berdt wrote: Does that mean I need to change any more code than is in my model ? I did set GC.start inside Photo.save in the controller. The situation does not go out of hand any more, but the app is using quite a lot of memory none the less.

[Rails] how to convert number to word in ruby on rails

2009-12-04 Thread INDRANIL MUKHERJEE
I m fade up with searching the code to convert number to word in ruby .I found several of them but nothing worked right.please help me -- 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

Re: [Rails] how to convert number to word in ruby on rails

2009-12-04 Thread sanjib dhar
class Fixnum def english_word @h = {0=zero, 1=One, 2=Two, 3=Three, 4=Four, 5=Five,6=six, 7=seven, 8=Eight, 9=Nine,10=Ten,11=Eleven,12=Twelve, 13=Thirteen,14=Fourteen,15=Fifteen, 16=Sixteen,17=Seventeen,18=Eighteen, 19=Nineteen,20=Twenty,30=Thirty, 40=Fourty,50=Fifty,60=Sixty,70=Seventy,

[Rails] Re: Need help with rake db:migrate error

2009-12-04 Thread David Li
You got an extra 'c' at the beginning of the file. ;) -- undefined local variable or method `c' for main:Object --- c#--- --- On Dec 4, 6:22 pm, pauld paul.denlin...@gmail.com wrote: This is the code from the Agile Web Development 3rd Edition, which I pasted into the original db/migrate file,

[Rails] Re: how to convert number to word in ruby on rails

2009-12-04 Thread Steve Elliott
Check out Chris Pine's Book -- Learn to Program from the Pragmatic Programmers He has an English Number example in there: http://pine.fm/LearnToProgram/?Chapter=08 def englishNumber number if number 0 # No negative numbers. return 'Please enter a number that isn\'t negative.' end if

Re: [Rails] need help with CSS codes

2009-12-04 Thread Susan McM. Tucker
As suggested in this email, I install Eric Berrys themes, but it isn't working as expected. The git directory is there. The themes are in the appropriate location. At the top of charges.html.erb, I have added : % use_theme('bitbucket') % In the application_controller.rb I have added:

[Rails] How to generate the scaffold by user defined path

2009-12-04 Thread hitme
when I use ruby script/generate scaffold publisher name:string It's worked correctly. when I use: ruby script/generate scaffold Admin::publisher name:string The command done and no error. Then I add the following code into routes.rb map.namespace :admin do |admin| admin.resources

Re: [Rails] How to generate the scaffold by user defined path

2009-12-04 Thread Colin Law
2009/12/4 hitme yyhac...@gmail.com: when I use ruby script/generate scaffold publisher name:string It's worked correctly. when I use: ruby script/generate scaffold Admin::publisher name:string The command done and no error. Then I add the following code into routes.rb   map.namespace

[Rails] Why do so many Ruby/Rails developers use Macs?

2009-12-04 Thread Jim Knowlton
I am a QA engineer who works in Ruby quite a bit, and I've never been able to figure out...why is there a disproportionately large contingent of Mac users among Ruby developers? Macs are probably 10 percent of the computer market, but every time I go to a Ruby conference, probably 80 percent of

Re: [Rails] Why do so many Ruby/Rails developers use Macs?

2009-12-04 Thread Ron Brinson
Then why is it so hard for me to find just one of you guys for a Delaware spot? I need a ROR Mac Developer for a project with Bank of America in Delaware.. On Fri, Dec 4, 2009 at 1:33 PM, Jim Knowlton jknowlton...@gmail.com wrote: I am a QA engineer who works in Ruby quite a bit, and I've

[Rails] Re: Why do so many Ruby/Rails developers use Macs?

2009-12-04 Thread Frederick Cheung
On Dec 4, 6:33 pm, Jim Knowlton jknowlton...@gmail.com wrote: I am a QA engineer who works in Ruby quite a bit, and I've never been able to figure out...why is there a disproportionately large contingent of Mac users among Ruby developers?  Macs are probably 10 percent of the computer

[Rails] Help! incredible timing differences between dev and production

2009-12-04 Thread phil
We have a method that is just taking a ridiculous amount of time in production: Production: Completed in 84043ms (DB: 35243) | 302 Found [http://x.com/admin/x/ 3262/x] (pid:10052) Dev: Completed in 268ms (DB: 201) | 302 Found [http://c.local/admin/x/3262/ x] (pid:27599) To do this test I dumped

[Rails] Re: Help! incredible timing differences between dev and production

2009-12-04 Thread Frederick Cheung
On Dec 4, 6:47 pm, phil p...@philsmy.com wrote: What can I do to figure out what is going on here? I assume it is perhaps some sort of db locking? But this happens even when no one else is using the production system. I'd start by looking at the difference between explain statements on

[Rails] ActiveRecord::AssociationTypeMismatch exception

2009-12-04 Thread Vasu Kottilil
Hello: I am quite new to Ruby and Rails. Here are the details of a sample use case that I am trying to build. Development environment: (on Ubuntu 9.04) ## Ruby version 1.8.7 (i486-linux) RubyGems version 1.3.1 Rails version 2.1.0

[Rails] Re: ActiveRecord::AssociationTypeMismatch exception

2009-12-04 Thread Frederick Cheung
On Dec 4, 6:58 pm, Vasu Kottilil vasudeva...@gmail.com wrote: {commit=Create,  authenticity_token=1459525ad4fd5ae39be0c011edc5c45fdbff4337,  user={work_phone=,  address={address1=ad1,  city=any town,  address2=line2,  zip=12345,  country=USA,  state=CA},  profile_name=pfname,  

[Rails] Making Asset Caching and Asset Server work together

2009-12-04 Thread Mat
While optimizing one of our sites by mixing the Asset Server feature with a CDN, Asset Caching and the Smurf minification plugin I hit an old problem where the asset server feature essentially prevents you from using the asset caching feature. The problem is described on the original Ruby Trac as

Re: [Rails] Why do so many Ruby/Rails developers use Macs?

2009-12-04 Thread eric7435
the short answer is because they're smart :-). You have to remember that OS X is Unix with the best GUI. The Unix platform is far more mature than the Window core therefore more stable. Also, Unix was originate by programmers for programmers Hope that help. Also, if you'd ever spend some

Re: [Rails] Why do so many Ruby/Rails developers use Macs?

2009-12-04 Thread Niels Meersschaert
Another reason the Mac has continued to be so popular is that has included Ruby, Rails SQLite out of the box for the past few years. This means you can have a working Rails environment on every new machine. You can even do native development (full GUI desktop applications) on the Mac in

Re: [Rails] Why do so many Ruby/Rails developers use Macs?

2009-12-04 Thread Rob Biedenharn
And! you'd probably find that a good portion of the non-Mac laptops at those conferences were running an o/s other than Windows. It's similar to the reason that Graphic Designers are more likely to have Macs. The platform has a better environment, better tools for the actual work that

[Rails] Trying to get the value of a single bit in a variable

2009-12-04 Thread Bob Smith
I'm trying to use @weekly to represent attendance for each week of the month. I wanted to use a bit for each week, but am having no luck finding a way to get a single bit out of the variable after it is set. I already have this code to set the values: @mask = (2 ** @week_number)

Re: [Rails] Why do so many Ruby/Rails developers use Macs?

2009-12-04 Thread Agustin Nicolas Viñao Laseras
So sad that Mac not in countries like Argentina, only have expensive resellers, we must pay price of 150% or more compared with the U.S.. ___ Agustin Viñao www.agustinvinao.com.ar agustinvinao (Skype) On Fri, Dec 4, 2009 at 5:01 PM, Rob Biedenharn

[Rails] Re: Help! incredible timing differences between dev and production

2009-12-04 Thread phil
What I have done is turned on debugging in a console session on production and then executed the methods. They are blazing fast - at least as fast as on dev! Why would executing them via passenger take so much longer. It is a very consistent thing - every request to this certain method often

Re: [Rails] Why do so many Ruby/Rails developers use Macs?

2009-12-04 Thread bill walton
Hi Ron, On Fri, 2009-12-04 at 13:44 -0500, Ron Brinson wrote: Then why is it so hard for me to find just one of you guys for a Delaware spot? I can think of several potential reasons. 1) Your original posting did not follow the forum's convention, clearly posted on the Google Groups home

Re: [Rails] Re: Help! incredible timing differences between dev and production

2009-12-04 Thread Niels Meersschaert
I'd imagine in the console you are only looking at the model end of the stack. Is the response in the browser have a large volume to return lots to render? That will easily account for the difference. On Dec 4, 2009, at 3:07 PM, phil wrote: What I have done is turned on debugging in a

Re: [Rails] Trying to get the value of a single bit in a variable

2009-12-04 Thread Rob Biedenharn
On Dec 4, 2009, at 3:02 PM, Bob Smith wrote: I'm trying to use @weekly to represent attendance for each week of the month. I wanted to use a bit for each week, but am having no luck finding a way to get a single bit out of the variable after it is set. I already have this code to set the

Re: [Rails] Why do so many Ruby/Rails developers use Macs?

2009-12-04 Thread Colin Law
2009/12/4 Agustin Nicolas Viñao Laseras agustinvi...@gmail.com: So sad that Mac not in countries like Argentina, only have expensive resellers, we must pay price of 150% or more compared with the U.S.. ___ Then you could use Ubuntu or one of the other similar distributions.

[Rails] Re: View helpers

2009-12-04 Thread DanC
Fantastic - that worked. Thank you. Dan On Dec 3, 4:29 am, David furb...@gmail.com wrote: def already_voted_arts   !Vote.find_by_user_id_and_category(current_user.id, Arts).blank? end On Dec 2, 10:45 am, DanC d.m.coleg...@durham.ac.uk wrote: Hi all, I am trying to get my head around

Re: [Rails] Re: Help! incredible timing differences between dev and production

2009-12-04 Thread Colin Law
2009/12/4 phil p...@philsmy.com: What I have done is turned on debugging in a console session on production and then executed the methods. They are blazing fast - at least as fast as on dev! Why would executing them via passenger take so much longer. It is a very consistent thing - every

Re: [Rails] Why do so many Ruby/Rails developers use Macs?

2009-12-04 Thread Conrad Taylor
On Fri, Dec 4, 2009 at 10:33 AM, Jim Knowlton jknowlton...@gmail.comwrote: I am a QA engineer who works in Ruby quite a bit, and I've never been able to figure out...why is there a disproportionately large contingent of Mac users among Ruby developers? Macs are probably 10 percent of the

[Rails] Hackme Contest Has Been Started

2009-12-04 Thread John M.Crist
Hi, Finally, Hackme contest's been started: http://www.wablab.com/hackme If you have any comments, suggestions, or feedback, just contact us: http://www.wablab.com/support best regards, -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group.

Re: [Rails] Why do so many Ruby/Rails developers use Macs?

2009-12-04 Thread Steven Elliott Jr
Macs are by fat the easiest way to get going in rails/ruby because it's there out of the box. A few gem commands and you're rockin' and rollin'. Windows and Linux are easy to set up too but require a bit more setup work. Ubuntu is good but you have to use the stuff in the repositories by

[Rails] Re: ActiveRecord::AssociationTypeMismatch exception

2009-12-04 Thread Vasu Kottilil
Hi Fred, Thank you so much for the quick response. It was quite helpful. I really wanted to test this out with out upgrading to the newer version. I made the changes to view/params submittal and the controller code and now it seems to be working. I can see two saved records after a create event.

Re: [Rails] Re: JRuby - How to make a server socket MT

2009-12-04 Thread Paulo Coutinho
I have a game server to my game in flash, but the server is in pure java, using sockets. So i want port it do jruby, because i think its very fast and easy to make database operations and all ruby facilities. What you think about it? Is a good solution? 2009/12/4 Clemens

Re: [Rails] Re: JRuby - How to make a server socket MT

2009-12-04 Thread Paulo Coutinho
I have make a sample, to test ruby thread, but no success. it run like a single thread. t = Thread.new() do |n| puts ==START THREAD sleep 15 puts ==END THREAD end t.join arr = [1,2,3,4,5,6,7,8,9,10] for item in arr puts == Show item: + item.to_s sleep 1 end Thx.

Re: [Rails] Why do so many Ruby/Rails developers use Macs?

2009-12-04 Thread Agustin Nicolas Viñao Laseras
I talked Mac in Argentina (reseller, not direct Mac Store) is expensive to buy the equipment. Whoever knows the benefits of using Mac hardware knows it is not the same team using a different brand with OSX. The price of Macbook Pro 2.66 in Argentina is $ S 3300 and in U.S. u $ s 1999. And the

Re: [Rails] Why do so many Ruby/Rails developers use Macs?

2009-12-04 Thread Conrad Taylor
On Fri, Dec 4, 2009 at 4:16 PM, Agustin Nicolas Viñao Laseras agustinvi...@gmail.com wrote: I talked Mac in Argentina (reseller, not direct Mac Store) is expensive to buy the equipment. Whoever knows the benefits of using Mac hardware knows it is not the same team using a different brand with

[Rails] is it ok if i define my login_as in test_helper.rb ???

2009-12-04 Thread sanjanad
is it ok if i define my login_as in test_helper.rb ??? def login_as(admin) @request.session[:admins] = admin ? admins(admin).id : nil end and then use login_as:sanj in my functional tests..it does not show any errors...but is it logically correct?? -- You received this message because you

[Rails] Re: Learning ruby on Mac - rake create error

2009-12-04 Thread fancybeast
Using a different version of mysql solved this problem for me: 5.1.41 Mac OS X 10.5 (x86_64) --- doesn't work 5.1.41 Mac OS X 10.5 (x86) -- works -- 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] need help for functional testing

2009-12-04 Thread sanjanad
my tests are running with no errors.. but how do i check whether the functional tests i wrote are working..i need please.. require File.dirname(__FILE__) + '/../test_helper' class BooksControllerTest ActionController::TestCase def setup @controller = BooksController.new @request

[Rails] Re: Need help with rake db:migrate error

2009-12-04 Thread pauld
Thank you! That did the trick. Paul On Dec 4, 6:29 pm, David Li tawe...@gmail.com wrote: You got an extra 'c' at the beginning of the file. ;) -- undefined local variable or method `c' for main:Object --- c#--- --- On Dec 4, 6:22 pm, pauld paul.denlin...@gmail.com wrote: This is

[Rails] ActionMailer dont function with JRuby?

2009-12-04 Thread Paulo Coutinho
I have application that i send email normal with native ruby. But when i execute the sample application with jruby, it dont send email and dont get error. What can be wrong? -- Atenciosamente, Paulo Coutinho. Blog: www.prsolucoes.com/blog Site: www.prsolucoes.com Msn: pa...@prsolucoes.com --

Re: [Rails] ActionMailer dont function with JRuby?

2009-12-04 Thread Dhruva Sagar
In your config/environments/development.rb, have you configured things properly for ActionMailer ? What is your config for config.action_mailer.raise_delivery_errors ? it should be set to true for it to report errors. You will have to give more details regarding your mail server as well... Thanks

Re: [Rails] ActionMailer dont function with JRuby?

2009-12-04 Thread Paulo Coutinho
Im using the normal configuration in /config/environment.rb: # Configuração do smtp ActionMailer::Base.default_content_type = 'text/html' ActionMailer::Base.delivery_method = :smtp ActionMailer::Base.smtp_settings = { :tls = true, :address = 'smtp.gmail.com', :port = 587, :domain =

Re: [Rails] ActionMailer dont function with JRuby?

2009-12-04 Thread Paulo Coutinho
When i change to show erros from action mailer, i get: wrong # of arguments(3 for 2) D:/www/teste_235/vendor/plugins/action_mailer_optional_tls/lib/smtp_tls.rb:33:in `check_auth_args' D:/www/teste_235/vendor/plugins/action_mailer_optional_tls/lib/smtp_tls.rb:33:in `do_tls_start'

Re: [Rails] ActionMailer dont function with JRuby?

2009-12-04 Thread Dhruva Sagar
Ahhh so you require TLS :). Well firstly you want to add the config I mentioned in the previous email here so that it logs errors for you. Regarding TLS, can you tell me what rails version ruby version are you using ? If your using Ruby version 1.8.x then it turns out that ActionMailer is not

Re: [Rails] ActionMailer dont function with JRuby?

2009-12-04 Thread Paulo Coutinho
Thx for response. But im already have this file smtp_tls.rb, im using a plugin called: action_mailer_optional_tls With normal ruby(native) it run OK, but only when i use jruby it dont send. Im using ruby 1.8.7(come with jruby) and rails 2.3.5 Ty again.

Re: [Rails] ActionMailer dont function with JRuby?

2009-12-04 Thread Dhruva Sagar
I had tried the same plugin as well, but I couldn't get it working for some reason, since I had a short deadline at that time, I didn't investigate much, for me having the tls_smtp.rb file inside *lib* folder and having a require statement worked... Hopefully someone else would have more clarity

Re: [Rails] ActionMailer dont function with JRuby?

2009-12-04 Thread Paulo Coutinho
Yeah. I try copy only the tls_smtp.rb to lib, but i got the same problem. Im searching for it on google, but i found only people with the same problem. If anyone can help or know a solution, please post here :( 2009/12/5 Dhruva Sagar dhruva.sa...@gmail.com I had tried the same plugin as

Re: [Rails] Re: Learning ruby on Mac - rake create error

2009-12-04 Thread Conrad Taylor
On Fri, Dec 4, 2009 at 4:59 PM, fancybeast hug...@gmail.com wrote: Using a different version of mysql solved this problem for me: 5.1.41 Mac OS X 10.5 (x86_64) --- doesn't work 5.1.41 Mac OS X 10.5 (x86) -- works -- I have successfully installed MySQL 5.1.41 on Snow Leopard using

Re: [Rails] Help! incredible timing differences between dev and production

2009-12-04 Thread Jeffrey L. Taylor
Quoting phil p...@philsmy.com: We have a method that is just taking a ridiculous amount of time in production: Production: Completed in 84043ms (DB: 35243) | 302 Found [http://x.com/admin/x/ 3262/x] (pid:10052) Dev: Completed in 268ms (DB: 201) | 302 Found [http://c.local/admin/x/3262/

[Rails] Re: JRuby - How to make a server socket MT

2009-12-04 Thread Clemens
the t.join synchronizes the spawned thread with the main thread (rendez-vous) -- t = Thread.new do puts ==START THREAD sleep 15 puts ==END THREAD end arr = [1,2,3,4,5,6,7,8,9,10] for item in arr puts == Show item: + item.to_s sleep 1 end t.join # - move it here,