Re: [Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
On 7 December 2010 01:06, Rob Th li...@ruby-forum.com wrote: Thanks pepe, RobsMacAir:~ rob$ rails -v Rails 2.3.8 RobsMacAir:~ rob$ gem uninstall my_gem -v=2.3.8 ERROR: While executing gem ... (Gem::InstallError) Unknown gem my_gem = 2.3.8 You have to put the name of the gem you want to uninstall instead of my_gem. That was just an example. Are you sure you are cut out for this? In your case you want to uninstall the rails gem, so gem uninstall rails. Dependant on which environment you are running in you may have to use sudo on the front. Do that if you used sudo to install it. gem list will show all the gems you have installed by the way. Colin -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] saravanan
I have one dought...I want use list box..when clicked the list value it automaticaly set in the textbox.how to write coding for this -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Design Question - re: Polymorphic association
Curious about the best direction or design pattern to use here - looking for opinions. I have a store with products diced into categories. Should I create a polymorphic model 'Product' and have individual models for the product types? Reason is - the products differ quite a bit in columns/profile etc... I could keep in one table but feel it will get horizontally fat quickly as these different product types get modified. Question is - I'll need to access these different products so would I simply delegate attributes to the Product model so I can access each related model's attributes? For instance, I'll need to fetch all of a certain type through the Product model. I guess I could use STI for this but seems polymorphic would perform better. Appreciate any feedback on whether this is practical or way off. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] beginning web development with ror, how?
Hi everyone, I just realized that on my shared web hosting, RoR is supported. What to expect from this in terms of developing a simple HTML5 web page to advanced portal that includes forum board and mailing list? How do I begin. I have a shell access to this hosting, but not as root. P/S: I'm not really a programmer, more of a sysadmin although I had learned a bit of programming (java, c++, python, bash scripting php) during my schooling years. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: ROR and Drupal
On Dec 7, 7:13 am, Koteswara rao Vuyyuru li...@ruby-forum.com wrote: I have a website in Ruby on Rails which is now supposed to be Integrated with Drupal where the main contents of the page will be served from Drupal, header and footer will be in ROR. Wanted to know if there is any API provided in drupal that can access 'Node' contents of the drupal page directly from ROR page by including an iframe or anything else. More of a drupal question that a rails question. I believe drupal has an xml-rpc interface, but you'll probably have more luck finding out about it by asking on a group related to drupal. Fred Any help related to it will be good.Thanks in advance!! Regards Koteswara Rao. -- Posted viahttp://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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: ROR and Drupal
I think you are doing in a wrong way. Drupal is a complete CMS and not worth being called from ROR. If it is the other way round, ie, Calling RoR from Drupal will be not only useful, will make the website more maintainable. All you need to do is make RoR webservices, then make some drupal modules to attach the RoR feeds into drupal. On 7 December 2010 09:22, Frederick Cheung frederick.che...@gmail.comwrote: On Dec 7, 7:13 am, Koteswara rao Vuyyuru li...@ruby-forum.com wrote: I have a website in Ruby on Rails which is now supposed to be Integrated with Drupal where the main contents of the page will be served from Drupal, header and footer will be in ROR. Wanted to know if there is any API provided in drupal that can access 'Node' contents of the drupal page directly from ROR page by including an iframe or anything else. More of a drupal question that a rails question. I believe drupal has an xml-rpc interface, but you'll probably have more luck finding out about it by asking on a group related to drupal. Fred Any help related to it will be good.Thanks in advance!! Regards Koteswara Rao. -- Posted viahttp://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 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- -- Nandri(Thanks in Tamil), Amala Singh -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Need to add path to routes.rb
Dear Folks, I am Web developer and have experience mainly with the Django Web framework for Python and wish to learn ROR. I am currently using Rails 3.0.3 and was getting a routing error whenever I added a view to a controller until I found out I had to add the path to the routes.rb file under the config directory. Is this new in Rails 3? I am asking this because I was following the example in Agile Web Development with Rails 3rd Edition which uses Rails 2 and getting the routing error. I also find that if use the rails generate command the routes.rb file is automatically updated. Does this mean that the proper way to create views and controllers is to use the above command. If so how do I create a view function in an existing controller without having it being overwritten or is the manual way the only way to do this? I hope that is clear. Thanks. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] saravanan
Use javascript to achieve your goal. I have used jQuery library. $(function() { $(#list_box_id).live(change, function() { var e = $(this); var selectedValue = e.val(); e.hide(); $(#input_field).show().find(input).val(selectedValue); }) }); this is not the perfect solution you have to code it according to ur requirement. thanks abhis On Tue, Dec 7, 2010 at 10:58 AM, Saravanan Ravi arslo...@gmail.com wrote: I have one dought...I want use list box..when clicked the list value it automaticaly set in the textbox.how to write coding for this -- 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 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Need to add path to routes.rb
depends on your requirement use collection or member in your route. thanks abhis On Tue, Dec 7, 2010 at 3:27 PM, Nandakumar Chandrasekhar li...@ruby-forum.com wrote: Dear Folks, I am Web developer and have experience mainly with the Django Web framework for Python and wish to learn ROR. I am currently using Rails 3.0.3 and was getting a routing error whenever I added a view to a controller until I found out I had to add the path to the routes.rb file under the config directory. Is this new in Rails 3? I am asking this because I was following the example in Agile Web Development with Rails 3rd Edition which uses Rails 2 and getting the routing error. I also find that if use the rails generate command the routes.rb file is automatically updated. Does this mean that the proper way to create views and controllers is to use the above command. If so how do I create a view function in an existing controller without having it being overwritten or is the manual way the only way to do this? I hope that is clear. Thanks. -- 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 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Emacs tips
My first suggestion is to try org-mode if you haven't already. If you have already looked at it, but haven't given it a try, then now is the time! Org-mode offers a lot of functionality, but you can easily learn it a little bit at a time. There are also a good list of tips here: http://www.masteringemacs.org/ -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Is this error related to connection pool
Hi My environment is ruby 1.8.6 rails 2.2.2 mysql 5.1 windowsXP I have a very lengthy controller action which fetch mail from pop server. But some times I get error. Mainly three error. And I have to restart the application again to remove this errors. But after some time the same errors again happens 1) Mysql::Error (Can't connect to MySQL server on 'localhost' (10048)): C:/Ruby186/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/mysql_adapter.rb:548:in `real_connect' C:/Ruby186/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/mysql_adapter.rb:548:in `connect' C:/Ruby186/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/mysql_adapter.rb:198:in `initialize' --etc 2) Mysql::Error (Can't connect to MySQL server on 'localhost' (10055)): etc C:/Ruby186/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/mysql_adapter.rb:74:in `mysql_connection' C:/Ruby186/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `send' 3) Errno::ENOTCONN (A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied.): /lib/pop_ssl.rb:535:in `connect' /lib/pop_ssl.rb:535:in `do_start' /lib/pop_ssl.rb:507:in `start' /lib/pop_ssl.rb:382:in `start' Please help to solve this issue -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Re: iframe for Ruby on Rails
On 7 December 2010 05:28, Koteswara rao Vuyyuru li...@ruby-forum.com wrote: Please do not top post, it makes it difficult to follow the thread. Insert your reply into the previous post. Thanks. Dear Marnen and Colin I already said, -- I am creating one site using Ruby on Rails Framework. --- And another one is creating on Drupal Framework.So in my ruby on rails site having some features and Drupal site having some features. --Finally i am integrate all the features on one framework that is drupal Framework. That is not what you said at the start of _this_ thread, you said: oteswara rao Vuyyuru wrote in post #966461: Is it possible to use iframes for integrating two sites . I have two ruby on rails application.Then how to ingrate these two application . So is it two rails apps or a drupal and a rails? So finally i want to see all the features in my drupal site for this how to put Ruby on Rails Features in Drupal site or how to access Ruby on rails application from Drupal site. Do you mean you want the rails site to be embedded within a page on the drupal site? If so I think others have suggested that iframes might be the best way to go. Have you looked into this? Did it not offer what you want? Colin -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Render partial generate unwanted spaces
On 7 December 2010 07:11, Julien julien.ap...@gmail.com wrote: Well i guess the conclusion of all this is that if you encounter unwanted spaces in your partials, check your editor :) It would be interesting to inspect the file with a hex editor to see exactly what the non-printing chars are. They are not tabs are they? Colin -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Need to add path to routes.rb
On 7 December 2010 09:57, Nandakumar Chandrasekhar li...@ruby-forum.com wrote: Dear Folks, I am Web developer and have experience mainly with the Django Web framework for Python and wish to learn ROR. I am currently using Rails 3.0.3 and was getting a routing error whenever I added a view to a controller until I found out I had to add the path to the routes.rb file under the config directory. Is this new in Rails 3? I am asking this because I was following the example in Agile Web Development with Rails 3rd Edition which uses Rails 2 and getting the routing error. You are liable to run into a lot of problems if the version of rails you are using is not close to that of your tutorial. You could have a look at railstutorial.org with has a good rails 3 tutorial. It is free to work through online, or pay for the book I think. Also work through the Rails Guides, starting with Getting Started of course. I also find that if use the rails generate command the routes.rb file is automatically updated. Does this mean that the proper way to create views and controllers is to use the above command. For beginners at least probably yes. If so how do I create a view function in an existing controller without having it being overwritten or is the manual way the only way to do this? You can only use the generators the first time, then it is up to you. Colin -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
Thanks, Colin. I live in literalville. I tried as I think you suggested and got this. Select gem to uninstall: 1. rails-2.3.8 2. rails-2.3.8 3. All versions 3 Remove executables: rails in addition to the gem? [Yn] Removing rails Successfully uninstalled rails-2.3.8 Remove executables: rails in addition to the gem? [Yn] Removing rails Successfully uninstalled rails-2.3.8 RobsiMac:~ rob$ rails -v -bash: /usr/bin/rails: No such file or directory RobsiMac:~ rob$ gem list --local *** LOCAL GEMS *** actionmailer (2.3.8, 2.3.5, 2.2.2, 1.3.6) actionpack (2.3.8, 2.3.5, 2.2.2, 1.13.6) actionwebservice (1.2.6) activerecord (2.3.8, 2.3.5, 2.2.2, 1.15.6) activeresource (2.3.8, 2.3.5, 2.2.2) activesupport (2.3.8, 2.3.5, 2.2.2, 1.4.4) acts_as_ferret (0.4.3) capistrano (2.5.2) cgi_multipart_eof_fix (2.5.0) daemons (1.0.10) dnssd (0.6.0) fastthread (1.0.1) fcgi (0.8.7) ferret (0.11.6) gem_plugin (0.2.3) highline (1.5.0) hpricot (0.6.164) libxml-ruby (1.1.2) mongrel (1.1.5) needle (1.3.0) net-scp (1.0.1) net-sftp (2.0.1, 1.1.1) net-ssh (2.0.4, 1.1.4) net-ssh-gateway (1.0.0) rack (1.1.0, 1.0.1) rails (2.3.5, 2.2.2, 1.2.6) rake (0.8.3) RedCloth (4.1.1) ruby-openid (2.1.2) ruby-yadis (0.3.4) rubynode (0.1.5) rvm (1.1.3) sqlite3-ruby (1.2.4) termios (0.9.4) xmpp4r (0.4) RobsiMac:~ rob$ ruby -v ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0] RobsiMac:~ rob$ rails -v -bash: rails: command not found I expected after deinstalling rails 2.3.8 gem list local would find the other rails versions. But did this blow away all rails? I admit I am in learning mode. I thought this was a place to help out beginners. I have been programming in Assembler, C, and tons of SQL and now some PHP and writing shell scripts since the late 70s, and the complexity and impreciseness of the books and tutorials are amazing RoR, Is there a way to just go into the file system, and delete all the directories for Rails and just do a fresh reinstall. I cannot figure out rvm, -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Render partial generate unwanted spaces
Julien wrote in post #966777: [...] My gut tells me it's not an matter of line endings since the strange digit appears at the very beggining of the inclusion of the partial (or the yield). I don't know much about file system but i suppose Komodo was created on Linux and uses some file headers which are not correctly understood by Webrick on Windows which then tries to print them. Since you don't know much about the filesystem, perhaps you shouldn't be making silly speculations. Komodo does no such thing AFAIK. What *might* be going on is that your file is being saved as UTF-8 with a byte order mark (BOM) at the beginning. That shouldn't cause problems, but try changing the encoding to UTF-8 without BOM and see what happens. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org Sent from my iPhone -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Search Fullname, in two fields firstname, lastname.
Hi, I have a Model named User. It has two columns firstname, lastname. There a record with id=1, firstname=srikanth and lastname=Jeeva While Using search: keyword = Srikanth Jeeva And I write a Query: User.find(:all, :conditions=[firstname like ? or lastname like ?, '%keyword%', '%keyword%']) Ofcourse this will give 0 result, as firstname is srikanth and i'm searching for Srikanth Jeeva How can i write query for firstname and lastname, so that I can get the record. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Search Fullname, in two fields firstname, lastname.
Srikanth Jeeva wrote in post #966858: [...] User.find(:all, :conditions=[firstname like ? or lastname like ?, '%keyword%', '%keyword%']) Ofcourse this will give 0 result, as firstname is srikanth and i'm searching for Srikanth Jeeva How can i write query for firstname and lastname, so that I can get the record. Check your DB's documentation for how to do case-insensitive searches. Usually there's a keyword such as ilike, or you may need to transform the case on the DB side before doing the comparison. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org Sent from my iPhone -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
On 7 December 2010 13:25, Rob Th li...@ruby-forum.com wrote: Thanks, Colin. I live in literalville. I tried as I think you suggested and got this. Select gem to uninstall: 1. rails-2.3.8 2. rails-2.3.8 3. All versions 3 Remove executables: rails in addition to the gem? [Yn] Removing rails Successfully uninstalled rails-2.3.8 Remove executables: rails in addition to the gem? [Yn] Removing rails Successfully uninstalled rails-2.3.8 RobsiMac:~ rob$ rails -v -bash: /usr/bin/rails: No such file or directory RobsiMac:~ rob$ gem list --local *** LOCAL GEMS *** actionmailer (2.3.8, 2.3.5, 2.2.2, 1.3.6) actionpack (2.3.8, 2.3.5, 2.2.2, 1.13.6) actionwebservice (1.2.6) activerecord (2.3.8, 2.3.5, 2.2.2, 1.15.6) activeresource (2.3.8, 2.3.5, 2.2.2) activesupport (2.3.8, 2.3.5, 2.2.2, 1.4.4) acts_as_ferret (0.4.3) capistrano (2.5.2) cgi_multipart_eof_fix (2.5.0) daemons (1.0.10) dnssd (0.6.0) fastthread (1.0.1) fcgi (0.8.7) ferret (0.11.6) gem_plugin (0.2.3) highline (1.5.0) hpricot (0.6.164) libxml-ruby (1.1.2) mongrel (1.1.5) needle (1.3.0) net-scp (1.0.1) net-sftp (2.0.1, 1.1.1) net-ssh (2.0.4, 1.1.4) net-ssh-gateway (1.0.0) rack (1.1.0, 1.0.1) rails (2.3.5, 2.2.2, 1.2.6) Note the above rake (0.8.3) RedCloth (4.1.1) ruby-openid (2.1.2) ruby-yadis (0.3.4) rubynode (0.1.5) rvm (1.1.3) sqlite3-ruby (1.2.4) termios (0.9.4) xmpp4r (0.4) RobsiMac:~ rob$ ruby -v ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0] RobsiMac:~ rob$ rails -v -bash: rails: command not found I expected after deinstalling rails 2.3.8 gem list local would find the other rails versions. But did this blow away all rails? No, 2.3.5, 2.2.2 and 1.2.6 are still installed as noted above I admit I am in learning mode. I thought this was a place to help out beginners. I have been programming in Assembler, C, and tons of SQL and now some PHP and writing shell scripts since the late 70s, and the complexity and impreciseness of the books and tutorials are amazing RoR, I can't say that I agree with you here. What _is_ confusing is that there are so many out of date tutorials and mailing list archive entries that are found when searching for data on rails. This is inevitable unfortunately if you want to experiment with fast moving technologies like Rails. All the ones you mention have been little changed for decades so the documentation is stable. Is there a way to just go into the file system, and delete all the directories for Rails and just do a fresh reinstall. I cannot figure out rvm, I don't understand why you want to that. What is the problem you are having? Having multiple versions of things is not an issue provided you have the versions you need and they are specified in your app. It will then use those versions. Looking back at the OP I see that you are trying to get an existing app running. Why not just concentrate on that and sort out the problems as you come to them? Colin -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Render partial generate unwanted spaces
On 7 December 2010 13:38, Marnen Laibow-Koser li...@ruby-forum.com wrote: Julien wrote in post #966777: [...] My gut tells me it's not an matter of line endings since the strange digit appears at the very beggining of the inclusion of the partial (or the yield). I don't know much about file system but i suppose Komodo was created on Linux and uses some file headers which are not correctly understood by Webrick on Windows which then tries to print them. Since you don't know much about the filesystem, perhaps you shouldn't be making silly speculations. Komodo does no such thing AFAIK. What *might* be going on is that your file is being saved as UTF-8 with a byte order mark (BOM) at the beginning. That shouldn't cause problems, but try changing the encoding to UTF-8 without BOM and see what happens. Jumping the gun I know, but if it were the BOM then would that be a bug in rails as a BOM at the start of a partial should not be sent out to the browser, should it? Colin -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Search Fullname, in two fields firstname, lastname.
On 7 December 2010 13:38, Srikanth Jeeva li...@ruby-forum.com wrote: Hi, I have a Model named User. It has two columns firstname, lastname. There a record with id=1, firstname=srikanth and lastname=Jeeva While Using search: keyword = Srikanth Jeeva And I write a Query: User.find(:all, :conditions=[firstname like ? or lastname like ?, '%keyword%', '%keyword%']) Ofcourse this will give 0 result, as firstname is srikanth and i'm searching for Srikanth Jeeva How can i write query for firstname and lastname, so that I can get the record. Split the keyword into parts and use the two parts separately in the query. Have a look at the split method of ruby String class. Colin -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Render partial generate unwanted spaces
Colin Law wrote in post #966863: On 7 December 2010 13:38, Marnen Laibow-Koser li...@ruby-forum.com wrote: making silly speculations. Komodo does no such thing AFAIK. What *might* be going on is that your file is being saved as UTF-8 with a byte order mark (BOM) at the beginning. That shouldn't cause problems, but try changing the encoding to UTF-8 without BOM and see what happens. Jumping the gun I know, but if it were the BOM then would that be a bug in rails as a BOM at the start of a partial should not be sent out to the browser, should it? It actually shouldn't matter. The BOM was chosen rather cleverly: it's U+FEFF ZERO-WIDTH NONBREAKING SPACE, so it should have no typographical effect whatsoever. But maybe the browser is detecting it as whitespace, or maybe there's a further encoding issue. Or maybe something else is going on. Colin Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org Sent from my iPhone -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Search Fullname, in two fields firstname, lastname.
Colin Law wrote in post #966865: On 7 December 2010 13:38, Srikanth Jeeva li...@ruby-forum.com wrote: keyword = Srikanth Jeeva record. Split the keyword into parts and use the two parts separately in the query. Have a look at the split method of ruby String class. Quite right. I misunderstood the question. Colin Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org Sent from my iPhone -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
No, 2.3.5, 2.2.2 and 1.2.6 are still installed as noted above Whoops. Yeah I bought two books on RoR and google like crazy to find help and information. The tutorials online assume one is pretty much up to speed kind of like a cooking show half way in (what white sauce we just made?) The books deal with programming fairly well but not the config stuff - especially Mac. I would just feel 100% more confident going into getting this app running if I knew the environment was clean and pure. And only one version of the software loaded. As you mention this stuff changes a lot. For example why is rails -v not working. As you said the command left the other versions. BTW, I do not agree that this is merely a time issue. I programmed on C on a PDP when there was exactly one book. Writing and compiling C is a piece of cake compared to RoR. So I appreciate asking why, but I would just love a how. How do I blow away all RoR completely and then I think a gem install of version 2.2.2 would work. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Search Fullname, in two fields firstname, lastname.
keyword = Srikanth Jeeva record. Split the keyword into parts and use the two parts separately in the query. Have a look at the split method of ruby String class. Thanks for response. After splitting i write query like this, keyword = Srikanth Jeeva splitted_word = keyword.split( ) User.find(:all, :conditions=[firstname like ? or lastname like ? or firstname like ? or lastname like ?, '%splitted_word[0]%', '%splitted_word[0]%', '%splitted_word[1]%', '%splitted_word[1]%']) Is there any better way of doing this? Thanks. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
Rob Th wrote in post #966868: [...] The books deal with programming fairly well but not the config stuff - especially Mac. Then you're reading the wrong books. Most Rails developers work on Mac OS. I would just feel 100% more confident going into getting this app running if I knew the environment was clean and pure. And only one version of the software loaded. Right. So create a pristine gemset with RVM for your project and have done with it. [...] Why is there such a resistance to blowing away - deleting - RoR? Is it that no one actually knows how to do it? Or is there some sort of religious thing about deleting old versions of Rails? Neither. We do know how to do it, and several of us have told you how. But we have also told you that it unnecessary in your particular situation -- gems are designed to coexist in multiple versions, and anyway RVM can make a pristine environment for you any time you want. Why is there such a resistance to following the advice of more experienced developers? Really, we *do* know what we're talking about here, and by your own admission, you don't. So follow our advice to get up to speed with how Rails usually works, then go experiment all you like! Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org Sent from my iPhone -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Search Fullname, in two fields firstname, lastname.
Srikanth Jeeva wrote in post #966869: keyword = Srikanth Jeeva record. Split the keyword into parts and use the two parts separately in the query. Have a look at the split method of ruby String class. Thanks for response. After splitting i write query like this, keyword = Srikanth Jeeva splitted_word = keyword.split( ) User.find(:all, :conditions=[firstname like ? or lastname like ? or firstname like ? or lastname like ?, '%splitted_word[0]%', '%splitted_word[0]%', '%splitted_word[1]%', '%splitted_word[1]%']) Is there any better way of doing this? Yes. Use named placeholders in the query string so you don't have to repeat yourself. Thanks. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org Sent from my iPhone -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
RobsMacAir:~ rob$ gem uninstall my_gem -v=2.3.8 ERROR: While executing gem ... (Gem::InstallError) Unknown gem my_gem = 2.3.8 Sorry, I forgot to tell the group to e-mail me updates on the post. I'm sorry, Colin is right, what I wrote was just an example. I expected after deinstalling rails 2.3.8 gem list local would find the other rails versions. But did this blow away all rails? The gem command is being cautious. It doesn't want to delete anything but the absolutely necessary. I personally would not want to remove a gem and find out that the command blew away 10 other gems just because they are either required by the one I just deleted or compatible with it. What if I wanted to keep them because they serve me for other purposes? Removing gems is a little boring but it shouldn't take you more than 10 or 15 minutes to remove all the ones you need to remove once you get the hang of it. I admit I am in learning mode. I thought this was a place to help out beginners. Absolutely. I have had great help in this forum from day 1. I have been programming in Assembler, C, and tons of SQL and now some PHP and writing shell scripts since the late 70s, and the complexity and impreciseness of the books and tutorials are amazing RoR, I can't say that I agree with you here. What _is_ confusing is that there are so many out of date tutorials and mailing list archive entries that are found when searching for data on rails. This is inevitable unfortunately if you want to experiment with fast moving technologies like Rails. All the ones you mention have been little changed for decades so the documentation is stable. +1 with Colin here Is there a way to just go into the file system, and delete all the directories for Rails and just do a fresh reinstall. I cannot figure out rvm, After reading an entry on the internet I tried just that a week or so ago as the entry specified that it _might_ be possible. However, after I blew away all folders in the gem directory and asked for the gem list all the gems were still there and I had to run the commands manually anyway to make sure everything was gone as it should. I didn't want to have problems during re-installation. You're going to need to uninstall the gems manually and probably selectively I'm afraid, but if you find a way to do it all at once, please let me (us) know. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Proper way to back out a bad migration?
Typically I do rake db:migrate VERSION=0 But that also gave me the same error about Primary key is not allowed in a has_and_belongs_to_many join table So I then fired up dbconsole and manually dropped the table. But now I even if I run rake db:migrate the join table isn't created - probably because it 'think' it had run it previously. I believe the problem you've been running into is that your schema migrations table still has the number of the migration(s) you removed manually. When the rake task runs it sees the numbers there and says OK, that one is done so it skips the migration. I think the best thing to do in that case is to manually delete the record(s) in the schema migrations table in order to be able to rerun them. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Proper way to back out a bad migration?
On Dec 6, 2010, at 11:47 PM, Rick R wrote: I'm curious on the best practice to remedy this situation... I created a habtm migration but forgot the :id = false I ran the migration (rake db:migrate) I tried to run my tests and then go the error that made me realize I forgot the :id = false. The question is how do I back out my changes? Typically I do rake db:migrate VERSION=0 But that also gave me the same error about Primary key is not allowed in a has_and_belongs_to_many join table So I then fired up dbconsole and manually dropped the table. But now I even if I run rake db:migrate the join table isn't created - probably because it 'think' it had run it previously. I also can't run db:migrate VERSION=0, since it tries to call the drop table on the table that I manually dropped. I managed to get things working by commented out my drop_table command in my migration and then running db:migrate VERSION=0, then doing rake db:migrate and now I'm ok, but I'd think there would have been easier approach to fix things? -- Rick R Well, there are at least two ways: 1) Create a table with the same name so that the down migration will be able to DROP it and then recreate it. rake db:migrate:redo might work for this (since you didn't specify your rails version) 2) Make db:migrate think that you're at the right version 2a) for older ActiveRecord, set the version in the schema_info table from the database console update schema_info set version = ###; 2b) for newer ActiveRecord, remove the migration from the schema_migrations table delete from schema_migrations where version = 201012ddhhmmss; Then you can run your db:migrate (which you've already fixed). -Rob Rob Biedenharn r...@agileconsultingllc.com http://AgileConsultingLLC.com/ r...@gaslightsoftware.com http://GaslightSoftware.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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
-- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org Sent from my iPhone You are not helpful. Please stop. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
pepe, Removing gems is a little boring but it shouldn't take you more than 10 or 15 minutes to remove all the ones you need to remove once you get the hang of it. How, I tried the RobsiMac:~ rob$ sudo gem uninstall rails -v 2.3.8 Select gem to uninstall: 1. rails-2.3.8 2. rails-2.3.8 3. All versions 3 Remove executables: rails in addition to the gem? [Yn] Removing rails Successfully uninstalled rails-2.3.8 Remove executables: rails in addition to the gem? [Yn] Removing rails Successfully uninstalled rails-2.3.8 RobsiMac:~ rob$ rails -v -bash: /usr/bin/rails: No such file or directory I seem to have messed up somehow. (i.e. I expected after running sudo gem uninstall rails -v 2.3.8 I would get rails -v saying the next most current version.) It seems like it uninstalled more than 2.3.8 but on gem list there are version still around there. Eww. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] cygwin rvm and jruby
Hi, I try to get a ruby on rails environment in cygwin running. We use jruby(1.5.3), rvm, rails3 and several gems. I installed rvm in cygwin and installed the desired jruby version via rvm. It worked. But when I now install gems they are not installed in the appropriated folder. And a `gem list` shows me no local gems?! Here some output: snip tpors...@vporschberg ~/cobra-we $ which ruby /home/TPorschb/.rvm/rubies/jruby-1.5.3/bin/ruby tpors...@vporschberg ~/cobra-we $ which gem /home/TPorschb/.rvm/rubies/jruby-1.5.3/bin/gem tpors...@vporschberg ~/cobra-we $ gem install bundler JRuby limited openssl loaded. http://jruby.org/openssl gem install jruby-openssl for full support. Successfully installed bundler-1.0.7 1 gem installed tpors...@vporschberg ~/cobra-we $ gem install haml JRuby limited openssl loaded. http://jruby.org/openssl gem install jruby-openssl for full support. Successfully installed haml-3.0.24 1 gem installed tpors...@vporschberg ~/cobra-we $ gem list *** LOCAL GEMS *** snip The installed gems are only in the cache directory not in .rvm/gems/jruby-1@rails3/gems .rvm/gems/jruby-1@rails3/ keeps empty. snip tpors...@vporschberg ~/.gem/jruby/1.8/cache $ ls bouncy-castle-java-1.5.0145.2.gem haml-3.0.24.gem rake-0.8.7.gem bundler-1.0.7.gem jruby-openssl-0.7.2.gem snip Any ideas? Best regards Thomas -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
Rob Th wrote in post #966879: -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org Sent from my iPhone You are not helpful. Please stop. You know, I had decided I wasn't going to post further answers here, but then it seemed like you actually had started listening to what people were telling you. I guess I was wrong. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org Sent from my iPhone -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
Rob Th wrote in post #966881: pepe, Removing gems is a little boring but it shouldn't take you more than 10 or 15 minutes to remove all the ones you need to remove once you get the hang of it. How, I tried the RobsiMac:~ rob$ sudo gem uninstall rails -v 2.3.8 Select gem to uninstall: 1. rails-2.3.8 2. rails-2.3.8 3. All versions 3 Remove executables: rails in addition to the gem? [Yn] Removing rails Successfully uninstalled rails-2.3.8 Remove executables: rails in addition to the gem? [Yn] Removing rails Successfully uninstalled rails-2.3.8 RobsiMac:~ rob$ rails -v -bash: /usr/bin/rails: No such file or directory I seem to have messed up somehow. (i.e. I expected after running sudo gem uninstall rails -v 2.3.8 I would get rails -v saying the next most current version.) It seems like it uninstalled more than 2.3.8 but on gem list there are version still around there. Eww. I recently had this happen as well. If I tell you what I think is going on, will you actually pay attention, or will you just give me the brush-off again? If the latter, I'm not going to waste my time writing an explanation; if the former, I'll be happy to. Your choice; just let me know how you'd like to do things. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org Sent from my iPhone -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
Rob Th wrote in post #966852: I expected after deinstalling rails 2.3.8 gem list local would find the other rails versions. But did this blow away all rails? I admit I am in learning mode. I thought this was a place to help out beginners. I have been programming in Assembler, C, and tons of SQL and now some PHP and writing shell scripts since the late 70s, and the complexity and impreciseness of the books and tutorials are amazing RoR, Is there a way to just go into the file system, and delete all the directories for Rails and just do a fresh reinstall. I cannot figure out rvm, Hopefully this will help clear things up for you. The installation of Ruby on Rails on Mac OS X is a bit different than on other platforms. A version of both Ruby and Rails are pre-installed either with the operating system or Xcode (not sure which since I always install Xcode on all my systems). Some (usually older) versions of a number of gems are installed in the Mac OS X system library (/System/Library/). The gem command (even using sudo) cannot be used to uninstall these system gems. It might be possible to use the root user to delete the framework that contains those gems, but I don't know what you might break in doing so. With RVM you can effectively replace all the pre-installed system gems with gemsets that you can fully manage. Installing and learning RVM is actually easier than trying to manage the system installed gems (including the Rails ones). -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
How, I tried the RobsiMac:~ rob$ sudo gem uninstall rails -v 2.3.8 Select gem to uninstall: 1. rails-2.3.8 2. rails-2.3.8 3. All versions 3 Remove executables: rails in addition to the gem? [Yn] Removing rails Successfully uninstalled rails-2.3.8 Remove executables: rails in addition to the gem? [Yn] Removing rails Successfully uninstalled rails-2.3.8 RobsiMac:~ rob$ rails -v -bash: /usr/bin/rails: No such file or directory I seem to have messed up somehow. (i.e. I expected after running sudo gem uninstall rails -v 2.3.8 I would get rails -v saying the next most current version.) I believe the problem might lie in leaving the '=' sign out of the command: gem uninstall rails -v=2.3.8 (what I would have typed) vs. gem uninstall rails -v 2.3.8 (what you actually typed) I'm not sure, but *maybe* you had 2 different versions of 2.3.8 installed (if that is possible)? I guess it's possible that when you answered with option 3 it went out and blanketed out the rails versions and now you don't have any of them. :( If that is the case and since you need rails installed you can install it by just specifying the version you want: gem install rails -v=x.x.x (replace the x.x.x with the version you need). That should install any other dependencies it might need if you still don't have them. If you have problems or more questions I think it might be helpful if you post the list of gems you have now to give us a better idea about what mismatches you could have. There is something you should know I am not sure you are aware of. Different versions of Ruby and Rails have different dependencies. For example, a given version of rails might need a minimum (and maybe maximum) version of activerecord. Just having _any_ version of activerecord will not do. In my opinion the best thing you could do if you want to have a clean environment is remove everything you have and install what you need. The process *shouldn't* be difficult. I believe the prior mentions to RVM were meant to indicate to you that there are ways of keeping separate environments if you need them. For example, you might have an application that runs under Ruby 1.8.6 and Rails 2.3.5 and another one under the latest Ruby and Rails versions. The activerecord and related gems you need are going to be different for sure for between both environments. RVM will help you to keep those 2 environments separate. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Search Fullname, in two fields firstname, lastname.
Srikanth Jeeva wrote in post #966869: User.find(:all, :conditions=[firstname like ? or lastname like ? or firstname like ? or lastname like ?, '%splitted_word[0]%', '%splitted_word[0]%', '%splitted_word[1]%', '%splitted_word[1]%']) Is there any better way of doing this? Another option, depending on your database and your particular needs, is to use full-text search. http://dev.mysql.com/doc/refman/5.0/en/fulltext-natural-language.html -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Handling File on Upload
On Dec 6, 2010, at 6:50 PM, David Kahn wrote: You are mistaken, and although I came late to the Paperclip party, I can't recall a time when it was true. You can edit the model without modifying the image (just don't upload another image) and everything stays the same in the image, or you can upload a new image and it will overwrite the previous version. It's all managed when you save the model that the image is attached to. Right, but what I wanted was to be able to load a model instance, change the file (say I encrypt a portion of the text) and have Paperclip update that file on its own when I call model#save. I am pretty sure Paperclip does not do this. Right, you can re-save the file but it requires manual action beyond calling model#save. If you code your transformation within a Paperclip Processor, you can have any number of different transformed versions. Here's one that extracts the text from an uploaded PDF: #lib/paperclip_processors/text.rb module Paperclip # Handles extracting plain text from PDF file attachments class Text Processor attr_accessor :whiny # Creates a Text extract from PDF def make src = @file dst = Tempfile.new([...@basename, 'txt'].compact.join(.)) command = -end_command #{ File.expand_path(src.path) } #{ File.expand_path(dst.path) } end_command begin success = Paperclip.run(/usr/bin/pdftotext -nopgbrk, command.gsub(/\s+/, )) Rails.logger.info Processing #{src.path} to #{dst.path} in the text processor. rescue PaperclipCommandLineError raise PaperclipError, There was an error processing the text for #...@basename} if @whiny end dst end end end You call it from your model, like this: #app/models/document.rb ... has_attached_file :pdf,:styles = { :text = { :fake = 'variable' } }, :processors = [:text] ... The :fake = 'variable' part is just in there to get the offset correct for the processors variable. I am not sure if it's still needed, but I have been doing it this way since early this summer. Later, you can access that version of the file as you would any other paperclip-attached model attribute. In this example, this might look like document.pdf.url(:text). Your untouched original will always be at document.pdf.url(:original). Walter -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
Robert Walker wrote in post #966886: Rob Th wrote in post #966852: I expected after deinstalling rails 2.3.8 gem list local would find the other rails versions. But did this blow away all rails? I admit I am in learning mode. I thought this was a place to help out beginners. I have been programming in Assembler, C, and tons of SQL and now some PHP and writing shell scripts since the late 70s, and the complexity and impreciseness of the books and tutorials are amazing RoR, Is there a way to just go into the file system, and delete all the directories for Rails and just do a fresh reinstall. I cannot figure out rvm, Hopefully this will help clear things up for you. The installation of Ruby on Rails on Mac OS X is a bit different than on other platforms. A version of both Ruby and Rails are pre-installed either with the operating system or Xcode (not sure which since I always install Xcode on all my systems). Some (usually older) versions of a number of gems are installed in the Mac OS X system library (/System/Library/). The gem command (even using sudo) cannot be used to uninstall these system gems. It might be possible to use the root user to delete the framework that contains those gems, but I don't know what you might break in doing so. With RVM you can effectively replace all the pre-installed system gems with gemsets that you can fully manage. Installing and learning RVM is actually easier than trying to manage the system installed gems (including the Rails ones). I tried rvm and I just don't get it. Sorry. I think you are right. I think Xcode installed some of this. Actually I do not recall any other install. I was pretty surprised to see all these versions. Not sure where they came from. This whole RoR thing makes me nervous. I own a bunch of heavy equipment and I have operators and mechanics. Most RoR types are users, not mechanics. I think I am leaking hydro and need a wrencher not an operator. :) I appreciate your help. I did de-intall xcode last night using the script from Apple and it did not clean this up either. Can you explain why after doing a de-install of 2.3.8, ruby -v says no ruby? See above. If I reinstall Mac OS do you think that would make this go away and I could do a new install with just ruby 1.8.7 and rails 2.2.2. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
pepe wrote in post #966887: Pepe, Thanks. If you have problems or more questions I think it might be helpful if you post the list of gems you have now to give us a better idea about what mismatches you could have. RobsiMac:~ rob$ gem list --local *** LOCAL GEMS *** actionmailer (2.3.8, 2.3.5, 2.2.2, 1.3.6) actionpack (2.3.8, 2.3.5, 2.2.2, 1.13.6) actionwebservice (1.2.6) activerecord (2.3.8, 2.3.5, 2.2.2, 1.15.6) activeresource (2.3.8, 2.3.5, 2.2.2) activesupport (2.3.8, 2.3.5, 2.2.2, 1.4.4) acts_as_ferret (0.4.3) capistrano (2.5.2) cgi_multipart_eof_fix (2.5.0) daemons (1.0.10) dnssd (0.6.0) fastthread (1.0.1) fcgi (0.8.7) ferret (0.11.6) gem_plugin (0.2.3) highline (1.5.0) hpricot (0.6.164) libxml-ruby (1.1.2) mongrel (1.1.5) needle (1.3.0) net-scp (1.0.1) net-sftp (2.0.1, 1.1.1) net-ssh (2.0.4, 1.1.4) net-ssh-gateway (1.0.0) rack (1.1.0, 1.0.1) rails (2.3.5, 2.2.2, 1.2.6) rake (0.8.3) RedCloth (4.1.1) ruby-openid (2.1.2) ruby-yadis (0.3.4) rubynode (0.1.5) rvm (1.1.3) sqlite3-ruby (1.2.4) termios (0.9.4) xmpp4r (0.4) RobsiMac:~ rob$ ruby -v ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0] RobsiMac:~ rob$ rails -v -bash: rails: command not found There is something you should know I am not sure you are aware of. Different versions of Ruby and Rails have different dependencies. For example, a given version of rails might need a minimum (and maybe maximum) version of activerecord. Just having _any_ version of activerecord will not do. Thanks. I am pretty sure this is true. Some people think that is a good thing. I am not so sure. In my opinion the best thing you could do if you want to have a clean environment is remove everything you have and install what you need. That is where I got started. But instead people are trying to convince me to keep multiple versions, but if this is screwed up why? The process *shouldn't* be difficult. I wish I could figure out how. Not just what tool to work. I believe the prior mentions to RVM were meant to indicate to you that there are ways of keeping separate environments if you need them. No kidding. For example, you might have an application that runs under Ruby 1.8.6 and Rails 2.3.5 and another one under the latest Ruby and Rails versions. The activerecord and related gems you need are going to be different for sure for between both environments. RVM will help you to keep those 2 environments separate. I only need one environment ruby 1.8.7 and rails 2.2.2. Pepe, thanks again. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
Rob Th wrote in post #966894: [...] I tried rvm and I just don't get it. Sorry. What don't you get? Perhaps if you were to say what trouble you're having, we could help. But don't just give up on it. I think you are right. I think Xcode installed some of this. Correct. Ruby and Rails come with the Mac OS development tools, which are installed with Xcode. Actually I do not recall any other install. I was pretty surprised to see all these versions. Not sure where they came from. This whole RoR thing makes me nervous. In what respect? I own a bunch of heavy equipment and I have operators and mechanics. Most RoR types are users, not mechanics. I think I am leaking hydro and need a wrencher not an operator. :) And when you get a mechanic, you ignore his advice. :) I appreciate your help. I did de-intall xcode last night using the script from Apple and it did not clean this up either. Yikes! Now you have more problems. You need the Mac OS developer tools (in particular a C compiler) to be able to use Ruby effectively. You may have deleted your C compiler by removing Xcode. What do you get if you type gcc -v ? Can you explain why after doing a de-install of 2.3.8, ruby -v says no ruby? See above. What deinstallation command did you use? It wouldn't surprise me if removing Xcode removes Ruby. If I reinstall Mac OS do you think that would make this go away and I could do a new install with just ruby 1.8.7 and rails 2.2.2. Probably not. Instead, learn to remove the gems you have, or better yet, set up RVM (help is available if you need it) and learn to use it. If this is beyond you, you're not ready to work with Rails. That's not meant as an insult of any sort, merely a statement of fact. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: render :partial with :collection
Abhishek shukla wrote in post #964036: hey Vineeth, As mentioned by others about understand the concept of partial first thats true. But the collection object can be accessable by the name of partial in you case you can access using %= form.attribute_name % %= render :partial = '/comment/form', :collection=@blog.comments % But if in-case you don't want the object name form then you can parse as = object_name while calling partial. there are few more options like form_counter etc if you want to display it. Thanks Abhis Thanks, that's quite a lot of useful information. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Search Fullname, in two fields firstname, lastname.
On 7 December 2010 14:04, Srikanth Jeeva li...@ruby-forum.com wrote: keyword = Srikanth Jeeva record. Split the keyword into parts and use the two parts separately in the query. Have a look at the split method of ruby String class. Thanks for response. After splitting i write query like this, keyword = Srikanth Jeeva splitted_word = keyword.split( ) User.find(:all, :conditions=[firstname like ? or lastname like ? or firstname like ? or lastname like ?, '%splitted_word[0]%', '%splitted_word[0]%', '%splitted_word[1]%', '%splitted_word[1]%']) Don't forget to include checks to make sure you have two words and adjust the query accordingly, unless you know exactly the format of keyword of course. Colin -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
On Dec 7, 2010, at 10:25 AM, Rob Th wrote: Can you explain why after doing a de-install of 2.3.8, ruby -v says no ruby? See above. Try which ruby in Terminal to see if you don't in fact have a Ruby binary in your path. Then try locate ruby to find one. Correct your path as necessary, and try again. If I reinstall Mac OS do you think that would make this go away and I could do a new install with just ruby 1.8.7 and rails 2.2.2. I think if you re-image this machine (which will leave you with Apple's Ruby 1.8.6), then go to the first chapter of version 3 of the Agile book (which does deal with Rails 2, and has a nice install section to it) you will be able to install the precise version of Rails you desire, by using sudo gem install rails -v 2.2.2. I believe Ruby 1.8.7 came well after Rails 2.2, so you would probably be chasing errors in Rails if you tried to run it that way. But to reiterate what others have said over and over here -- RVM is designed from its very foundation to support precisely what you state you want to do. You have a 2.2.2 application you want to get up and running and start working on. We are all trying to reach out to you and offer the slender twig of RVM because we also suspect you want to do this without hobbling your machine to more modern versions of the Rails framework. Once you do get this application up and running, you're probably going to want to develop something else in Rails 3, and that requires at minimum 1.8.7 of Ruby. Walter -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
On 7 December 2010 14:32, Rob Th li...@ruby-forum.com wrote: pepe, Removing gems is a little boring but it shouldn't take you more than 10 or 15 minutes to remove all the ones you need to remove once you get the hang of it. How, I tried the RobsiMac:~ rob$ sudo gem uninstall rails -v 2.3.8 Select gem to uninstall: 1. rails-2.3.8 2. rails-2.3.8 3. All versions 3 Remove executables: rails in addition to the gem? [Yn] Removing rails I think the above may be why rails -v no longer works, I think you have removed the executable 'rails' aswell as the gem rails 2.3.8. I don't know how this all works on a mac though Successfully uninstalled rails-2.3.8 Remove executables: rails in addition to the gem? [Yn] Removing rails Successfully uninstalled rails-2.3.8 RobsiMac:~ rob$ rails -v -bash: /usr/bin/rails: No such file or directory I seem to have messed up somehow. (i.e. I expected after running sudo gem uninstall rails -v 2.3.8 I would get rails -v saying the next most current version.) It seems like it uninstalled more than 2.3.8 but on gem list there are version still around there. Eww. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
On 7 December 2010 15:47, Colin Law clan...@googlemail.com wrote: On 7 December 2010 14:32, Rob Th li...@ruby-forum.com wrote: pepe, Removing gems is a little boring but it shouldn't take you more than 10 or 15 minutes to remove all the ones you need to remove once you get the hang of it. How, I tried the RobsiMac:~ rob$ sudo gem uninstall rails -v 2.3.8 Select gem to uninstall: 1. rails-2.3.8 2. rails-2.3.8 3. All versions 3 Remove executables: rails in addition to the gem? [Yn] Removing rails I think the above may be why rails -v no longer works, I think you have removed the executable 'rails' aswell as the gem rails 2.3.8. I don't know how this all works on a mac though I think I must concur with the others here that you have got things in rather a mess and the easiest thing would be to use rvm to sort it out. If however you have uninstalled the development tools (compilers and so an as Marmen fears) then you will need to get them back first. Colin -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Which RoR to run on Mac OS X for a particular RoR app.
Colin Law wrote in post #966901: I don't know how this all works on a mac though That makes two of us. At least two of us that know what we don't know. Installing xcode is not an issue. It is easy. I pondered that question: 1. rails-2.3.8 2. rails-2.3.8 3. All versions 3 Remove executables: rails in addition to the gem? [Yn] Removing rails It just not make sense to me that if you are removing a version of software you would keep the executable. Right? I have Agile book and the O'reilly Learning book and can follow those to try an install fresh if I can just make sure I am working with a clean slate. Seem like as pepe mentioned there are lots of dependencies. I am not sure how this Mac or the other one got so many versions of rails on it. It just makes me nervous. I never let a mechanic touch my equipment unless I understand what he is going to do and most of the time I just do it myself. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Accessing url_for from a custom helper c lassccdaææææøøøæøæ¥00
Gudleik Rasch wrote in post #966781: I have some custom helper classes under lib/ that need to access the routes (link_to/url_for/etc): http://gist.github.com/520529 But when I call %= magic_link Product.first % NEVER DO THAT! Product.first does a database call. Therefore, it should *never* be used in the view. The view should never, ever touch the database under any circumstances. Instead, make the database call in the controller and set an @instance variable. from the view it renders the error What error? You'll probably need to include ActionController::UrlWriter in your helper. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
Never, this is the one and only rails app ever. I do want to get 1.8.7 on this machine and rails 2.2.2 to match the source machine. I would actually like to eventually find a programmer to convert it off rails. If you are thinking about getting a programmer anyway maybe it might be wiser if you get one now to get your RoR environment straight and your application running as it should. If what you are unhappy about is the trouble you're having with it, you not being an expert, but the application is doing what it is supposed to at your satisfaction when the setup is correct I think converting the application might be a mistake. You probably will end up spending a lot more money rewriting the application than paying somebody to get your application environment straight. That's your call, though, of course. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Which RoR to run on Mac OS X for a particular RoR app.
Walter Davis wrote in post #966900: On Dec 7, 2010, at 10:25 AM, Rob Th wrote: Can you explain why after doing a de-install of 2.3.8, ruby -v says no ruby? See above. Try which ruby in Terminal to see if you don't in fact have a Ruby binary in your path. Then try locate ruby to find one. Correct your path as necessary, and try again. If I reinstall Mac OS do you think that would make this go away and I could do a new install with just ruby 1.8.7 and rails 2.2.2. I think if you re-image this machine What is re-image? Once you do get this application up and running, you're probably going to want to develop something else in Rails 3, and that requires at minimum 1.8.7 of Ruby. Walter Never, this is the one and only rails app ever. I do want to get 1.8.7 on this machine and rails 2.2.2 to match the source machine. I would actually like to eventually find a programmer to convert it off rails. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: beginning web development with ror, how?
Umarzuki Bin Mochlis Moktar wrote in post #966803: Hi everyone, I just realized that on my shared web hosting, RoR is supported. What to expect from this in terms of developing a simple HTML5 web page to advanced portal that includes forum board and mailing list? How do I begin. By reading the Rails Guides at http://guides.rubyonrails.org . If you're not already familiar with Ruby as a language, you'll also want to read Programming Ruby ( http://ruby-doc.org/docs/ProgrammingRuby ). http://tryruby.org might also be helpful. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Re: Which RoR to run on Mac OS X for a particular RoR app.
On Dec 7, 2010, at 11:20 AM, Rob Th wrote: I think if you re-image this machine What is re-image? Use the OS install disks to wipe the machine blank and re-install your target OS. Given that the Ruby libraries are part of the core OS, not just Xcode, this may be your only way forward now that you have nuked your Apple Ruby. Or, you could follow one or another of the fine Hivelogic install tutorials: google hivelogic install ruby Leopard (or Snow Leopard, if you're using 10.6). Walter -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Re: Which RoR to run on Mac OS X for a particular RoR app.
On 7 December 2010 16:41, Walter Lee Davis wa...@wdstudio.com wrote: On Dec 7, 2010, at 11:20 AM, Rob Th wrote: I think if you re-image this machine What is re-image? Use the OS install disks to wipe the machine blank and re-install your target OS. Given that the Ruby libraries are part of the core OS, not just Xcode, this may be your only way forward now that you have nuked your Apple Ruby. Or, you could follow one or another of the fine Hivelogic install tutorials: google hivelogic install ruby Leopard (or Snow Leopard, if you're using 10.6). I am not sure you have nuked ruby. You said in an earlier post that ruby -v failed, but I think you meant rails -v. If that is true then rvm should still be an option, provided you have not removed the development tools (or can get them back). Colin -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Raw SQL in Migration
Hi, I'm using MySQL for development and Oracle for testing and production. I need to create a database view with migrations and this feature is not available through migration DSL, so, to create the view, I'll need to put raw SQL code in migration. What is the best way to do this, keeping the migration working for Oracle and MySQL? Thanks, Gustavo Honorato -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Raw SQL in Migration
Gustavo de Sá Carvalho Honorato gustavohonorato wrote in post #966922: Hi, I'm using MySQL for development and Oracle for testing and production. I need to create a database view with migrations and this feature is not available through migration DSL, so, to create the view, I'll need to put raw SQL code in migration. No you won't. Just use the rails_sql_views plugin. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
pepe wrote in post #966915: Never, this is the one and only rails app ever. I do want to get 1.8.7 on this machine and rails 2.2.2 to match the source machine. I would actually like to eventually find a programmer to convert it off rails. If you are thinking about getting a programmer anyway maybe it might be wiser if you get one now to get your RoR environment straight and your application running as it should. If what you are unhappy about is the trouble you're having with it, you not being an expert, but the application is doing what it is supposed to at your satisfaction when the setup is correct I think converting the application might be a mistake. You probably will end up spending a lot more money rewriting the application than paying somebody to get your application environment straight. That's your call, though, of course. This app is a web front end to a very large piece of other open source code that is written in Java. It is very database oriented and more than that I cannot say at this time... It should have been done in java, but it was not my call at that time. I want to get the app over to a mac to be able to demo the concept and to be a guideline (working prototype) for the eventual conversion. I have many, many years of software but I just do not get rails. I see no issue with SQL for example. I know rails is a religion to a lot of folks but for this app it is just not practical long term. Horses for courses. See how complicated this question got. I asked how can I get rid of all the other versions and simplify my environment and I got more complexity of rvm. Colin, correct I miss-typed Ruby is still there it is rails that does not show up in rails -v but gem list local thinks I still have it. And it looks like de-installing xcode does not remove ruby! Also, I never heard the term re-image in the context of Mac OS X. I suppose I am OK with ruby, it is the version I want. Maybe there is a directory that has all this rails and I can just delete it? Then reinstall. Can I just do a cmd-find rails and delete everything it finds? Also I have been looking for a programmer to convert this but it has not been easy and this is not my primary project. I just said, let me grab the app off the ubuntu before it goes away and smack here I am. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Re: Which RoR to run on Mac OS X for a particular RoR app.
Walter Davis wrote in post #966917: On Dec 7, 2010, at 11:20 AM, Rob Th wrote: I think if you re-image this machine What is re-image? Use the OS install disks to wipe the machine blank and re-install your target OS. Walter Ouch, this Mac has a lot more than ruby and rails on it. Cannot do that. I have a back up of course but what to restore to make sure I get rid of all rails, there has to be an easier way. If I know which directories/files to not restore to keep from restoring a version of rails, I should be able to just delete these directories/files. I cannot fine documentation as to where on a Mac the rails stuff goes. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Re: Re: Which RoR to run on Mac OS X for a particular RoR app.
On Tue, Dec 7, 2010 at 11:54 AM, Rob Th li...@ruby-forum.com wrote: I cannot fine documentation as to where on a Mac the rails stuff goes. It doesn't matter. You can leave everything where it is and alter your environment variables to use another version of ruby/rails installed where ever you like. You DO NOT need to re-image the machine just to alter the shell's $PATH variable. export PATH=/path/to/my/ruby:$PATH It's that simple. -- Greg Donald destiney.com | gregdonald.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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] I can't start Webrick
I'm following a book and I just created a project. I'm in the project directory (on Windows 7) and in cmd line I typed:(as per instructions) ruby script/server Webrick I get the following error: ruby: no such file or directory --script/server (LoadError) Can someone please explain what I'm doing wrong. I have Apache installed also but it's not running right now. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
On 7 December 2010 17:51, Rob Th li...@ruby-forum.com wrote: See how complicated this question got. I asked how can I get rid of all the other versions and simplify my environment and I got more complexity of rvm. Correct me if I am wrong but your fundamental problem is that somehow the rails environment is messed up. Your proposed solution is to delete it all and start again. No-one seems to know how to do this, though you do know how to remove individual gems (you did it for rails 2.3.8) so you could do this for each of the gems you do not want. You still have the problem that somehow rails -v does not work so somehow you have lost the rails startup script. As everyone keeps advising a much better solution is to completely ignore the current installation and use rvm. You can then install just the versions of everything that you want within rvm and run your app within that environment. It appears that you tried that and had some problems, but why not try again and ask for help here if you run into problems. It seems to me it is much better than risking the integrity of your whole machine. Colin -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Raw SQL in Migration
Thanks Marnen, I didn't know this plugin. I've read the documentation, but in his example I can't see how to change the columns names of the view. Is it possible? Thanks again, Gustavo On Tue, Dec 7, 2010 at 3:44 PM, Marnen Laibow-Koser li...@ruby-forum.comwrote: Gustavo de Sá Carvalho Honorato gustavohonorato wrote in post #966922: Hi, I'm using MySQL for development and Oracle for testing and production. I need to create a database view with migrations and this feature is not available through migration DSL, so, to create the view, I'll need to put raw SQL code in migration. No you won't. Just use the rails_sql_views plugin. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] I can't start Webrick
Hi, have you created the Rails project using 'rails projectname' command? Regards, Gustavo On Tue, Dec 7, 2010 at 4:06 PM, Tara Keane li...@ruby-forum.com wrote: I'm following a book and I just created a project. I'm in the project directory (on Windows 7) and in cmd line I typed:(as per instructions) ruby script/server Webrick I get the following error: ruby: no such file or directory --script/server (LoadError) Can someone please explain what I'm doing wrong. I have Apache installed also but it's not running right now. -- 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 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] I can't start Webrick
hi which version of rails you you are using! -- Thanks, Irfan Ahmed Rizvi (Sagar) cell Numbers: +880 1676 246 991 +880 1723 712 888 http://www.welltreat.us http://restaurant.welltreat.us/ http://isp.welltreat.us/ -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: I can't start Webrick
I downloaded the latest version of rails but I don't know how to check that... I did create a project already. Then I went into the main folder and tried to run the server from there but no luck... -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Use assert_select to test for the occurence of a string
Hi, How would I use assert select to test for the occurrence of the string 'DUS' in a 'p' tag about half way down my view? I tried: def test_should_display_airport_names_in_show get :show, :id = flights(:dus_muc).id assert_select 'p', 'DUS' end but Rails is just finding the first 'p' tag (which isn't the one I'm looking for) and returning false. 1) Failure: test_should_display_airport_names_in_show(FlightsControllerTest) [/test/functional/flights_controller_test.rb:75]: DUS expected but was Nr:\n RA447. false is not true. Thanks in advance. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: I can't start Webrick
type rails -v in console to check its version. For Rails 3 (latest version) try this command: rails server On Tue, Dec 7, 2010 at 11:47 PM, Tara Keane li...@ruby-forum.com wrote: I downloaded the latest version of rails but I don't know how to check that... I did create a project already. Then I went into the main folder and tried to run the server from there but no luck... -- 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 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
On Tue, Dec 7, 2010 at 10:06 AM, Colin Law clan...@googlemail.com wrote: Correct me if I am wrong but your fundamental problem is that somehow the rails environment is messed up. Your proposed solution is to delete it all and start again. No-one seems to know how to do this, though you do know how to remove individual gems (you did it for rails 2.3.8) so you could do this for each of the gems you do not want. You still have the problem that somehow rails -v does not work so somehow you have lost the rails startup script. Uh, somehow?? It was deleted when the gem was uninstalled, as a previous post showed. - Select gem to uninstall: 1. rails-2.3.8 2. rails-2.3.8 3. All versions 3 Remove executables: rails in addition to the gem? [Yn] Removing rails Successfully uninstalled rails-2.3.8 - The easiest thing to do would be `sudo gem uninstall rails` to get rid of *all* the rails versions and then install the one you want. I would certainly do that before trying to manually remove the gems, though that's trivial (use `gem env` to find where they are and delete). -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Raw SQL in Migration
Please quote when replying. Gustavo de Sá Carvalho Honorato gustavohonorato wrote in post #966932: Thanks Marnen, I didn't know this plugin. I've read the documentation, but in his example I can't see how to change the columns names of the view. Is it possible? I don't know. I've never used it. But the example sort of implies that you could use AS in the select statement. Thanks again, Gustavo Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org Sent from my iPhone -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Design Question - re: Polymorphic association
Hi Randy, Hard to say for sure without knowing the specific needs/requirements/ demands of your app, but... if your app is a typical biz or ecomm app backed by an rdbms where most of the usage (for end users and for analysis) of the app is spent doing reads vs writes, when it comes to the design of the db, ime, regardless of caching strategy, I always try and error on the side of faster reads (and slower writes) vs faster writes (and slower reads). So, assuming a read-dominent app, if you're asking should I go with one table for all products, or one table per product type?, if I were the developer, I'd probably go with the one (wide/sparse) table strategy. I'd define/handle the different needs/rules of the various product types in app model(s) code, but have the Product model ob handle core persistence of all of those various types of products (stored in the products db table). The less round trips to the db, the less joins in the db, the more denormalized the db, the more indexed the db, ... all of these should help make direct db reads faster (at the cost of slower writes on such wide/sparse/denormalized tables). Jeff On Dec 6, 9:50 pm, Randy Clark ra...@trail10.com wrote: Curious about the best direction or design pattern to use here - looking for opinions. I have a store with products diced into categories. Should I create a polymorphic model 'Product' and have individual models for the product types? Reason is - the products differ quite a bit in columns/profile etc... I could keep in one table but feel it will get horizontally fat quickly as these different product types get modified. Question is - I'll need to access these different products so would I simply delegate attributes to the Product model so I can access each related model's attributes? For instance, I'll need to fetch all of a certain type through the Product model. I guess I could use STI for this but seems polymorphic would perform better. Appreciate any feedback on whether this is practical or way off. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: I can't start Webrick
it's Rails 3.0.3 and that instruction worked. Thanks a million - back to the books... -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Advice on data design idea
I'm about to embark on a project and am seeking advice on my approach. I have an automotive site that needs to have shared categories. I've checked out different nested set, ancestral, acts_as_tree, acyclic plugins but feel they don't exactly fit. So I am about to roll my own simple solution. Any feedback as to whether this looks good is appreciated. Essentially I have: Sections - Automotive, Marine, Air Groups - Cars, Trucks, Bikes Categories - Pickup, SUV, Utility Truck The categories need to be able to be under multiple groups and/or sections. So I am thinking on having a series of HABTM associations: sections_groups sections_categories groups_categories This will allow me to add new groups/categories/sections with highly flexible associations. @section.groups or @section.categories etc... Does this seem right or am I way off? I'm also concerned whether it will perform well. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Design Question - re: Polymorphic association
Randy Clark wrote in post #966805: Curious about the best direction or design pattern to use here - looking for opinions. I have a store with products diced into categories. Should I create a polymorphic model 'Product' and have individual models for the product types? Reason is - the products differ quite a bit in columns/profile etc... Do the simplest thing that could possibly work. Right now, that would probably be one product table, unless you *already* have different information to store for different product types. I could keep in one table but feel it will get horizontally fat quickly as these different product types get modified. I feel is usually not a great justification. Design for what you have now, not what you might have. If you start ending up with a lot of divergent data, refactor at that time. Question is - I'll need to access these different products so would I simply delegate attributes to the Product model so I can access each related model's attributes? For instance, I'll need to fetch all of a certain type through the Product model. I guess I could use STI for this but seems polymorphic would perform better. Or perhaps something similar to Jeff's suggestion: have a products table with core information, but a has_one relationship to other records as needed. Or (last resort) a serialized hash of additional attributes. Appreciate any feedback on whether this is practical or way off. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: I can't start Webrick
Please quote when replying. Tara Keane wrote in post #966943: it's Rails 3.0.3 and that instruction worked. Thanks a million - back to the books... Not back to the books you've been using. Don't try to learn Rails 3 from a Rails 2 book. A lot changed in version 3. Try http://guides.rubyonrails.org , http://railstutorial.org , or a paper Rails 3 book. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Can't install Rails 3.0
Hello. I have problem. I can't install rails 3(on windows) If I put gem install rails it install 2.2.3 version. If I put gem update rails it update 2.2.3 to 2.2.3 version. ruby -v: 1.9.2 What I must do to install rails 3? -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Advice on data design idea
Randy Clark wrote in post #966944: I'm about to embark on a project and am seeking advice on my approach. I have an automotive site that needs to have shared categories. I've checked out different nested set, ancestral, acts_as_tree, acyclic plugins but feel they don't exactly fit. As I said in your other thread, programming is not about what you feel. So I am about to roll my own simple solution. Any feedback as to whether this looks good is appreciated. Essentially I have: Sections - Automotive, Marine, Air Groups - Cars, Trucks, Bikes Categories - Pickup, SUV, Utility Truck The categories need to be able to be under multiple groups and/or sections. In what way do you mean this? Will you actually have multiple parents for one category? Can you give an example of the way your hierarchy will look. So I am thinking on having a series of HABTM associations: sections_groups sections_categories groups_categories This will allow me to add new groups/categories/sections with highly flexible associations. @section.groups or @section.categories etc... Does this seem right or am I way off? I'm also concerned whether it will perform well.. I think you're way off. Sounds like you have a hierarch which is either a tree or an arbitrary graph (not sure which, pending your answer to my question above). In either case, all you need is one model (call it Category). Use awesome_nested_set if it's a tree. Done. If it's a graph, things might get a bit harder, but http://www.artfulsoftware.com/mysqlbook/sampler/mysqled1ch20.html may give you an overview of what you could do. http://www.dweebd.com/sql/modeling-bidirectional-graph-edges-in-rails/ is a Rails-specific implementation of one of those ideas (though it implements bidirectional edges and you probably only need unidirectional ones). There may be a Rails plugin that abstracts this. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Re: Windows new installation - Always problems
On Mon, Dec 6, 2010 at 1:36 PM, Marnen Laibow-Koser li...@ruby-forum.com wrote: Oh, that's too bad. I had the impression (though I've never used it) that the Glassfish gem in particular was amazing. A correction: the GF gem is no longer being developed by Oracle, but at least one fork is: https://github.com/BanzaiMan/glassfish-gem/ Just updated, too :-) -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Can't install Rails 3.0
On Dec 7, 2010, at 1:52 PM, Misha Ognev wrote: Hello. I have problem. I can't install rails 3(on windows) If I put gem install rails it install 2.2.3 version. If I put gem update rails it update 2.2.3 to 2.2.3 version. ruby -v: 1.9.2 What I must do to install rails 3? Could you type gem env in a terminal and paste back what you get? Walter -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Which RoR to run on Mac OS X for a particular RoR app.
Hassan Schroeder wrote in post #966940: On Tue, Dec 7, 2010 at 10:06 AM, Colin Law clan...@googlemail.com wrote: Correct me if I am wrong but your fundamental problem is that somehow the rails environment is messed up. Your proposed solution is to delete it all and start again. No-one seems to know how to do this, though you do know how to remove individual gems (you did it for rails 2.3.8) so you could do this for each of the gems you do not want. You still have the problem that somehow rails -v does not work so somehow you have lost the rails startup script. Uh, somehow?? It was deleted when the gem was uninstalled, as a previous post showed. - Select gem to uninstall: 1. rails-2.3.8 2. rails-2.3.8 3. All versions 3 Remove executables: rails in addition to the gem? [Yn] Removing rails Successfully uninstalled rails-2.3.8 - The easiest thing to do would be `sudo gem uninstall rails` to get rid of *all* the rails versions and then install the one you want. I would certainly do that before trying to manually remove the gems, though that's trivial (use `gem env` to find where they are and delete). -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan I thought uninstalling rails 2.3.8 would uninstall that version then a different version would be current. I paused at that question. I have to admit. BTW... gem list --local *** LOCAL GEMS *** actionmailer (2.3.5, 2.2.2, 1.3.6) actionpack (2.3.5, 2.2.2, 1.13.6) actionwebservice (1.2.6) activerecord (2.3.5, 2.2.2, 1.15.6) activeresource (2.3.5, 2.2.2) activesupport (2.3.5, 2.2.2, 1.4.4) acts_as_ferret (0.4.3) capistrano (2.5.2) cgi_multipart_eof_fix (2.5.0) daemons (1.0.10) dnssd (0.6.0) fastthread (1.0.1) fcgi (0.8.7) ferret (0.11.6) gem_plugin (0.2.3) highline (1.5.0) hpricot (0.6.164) libxml-ruby (1.1.2) mongrel (1.1.5) needle (1.3.0) net-scp (1.0.1) net-sftp (2.0.1, 1.1.1) net-ssh (2.0.4, 1.1.4) net-ssh-gateway (1.0.0) rack (1.0.1) rails (2.3.5, 2.2.2, 1.2.6) rake (0.8.3) RedCloth (4.1.1) ruby-openid (2.1.2) ruby-yadis (0.3.4) rubynode (0.1.5) rvm (1.1.3) sqlite3-ruby (1.2.4) termios (0.9.4) xmpp4r (0.4) Looks like several versions of rails are still hanging around! But... sudo gem uninstall rails ERROR: While executing gem ... (Gem::InstallError) cannot uninstall, check `gem list -d rails` And... gem list -d rails *** LOCAL GEMS *** rails (2.3.5, 2.2.2, 1.2.6) Author: David Heinemeier Hansson Rubyforge: http://rubyforge.org/projects/rails Homepage: http://www.rubyonrails.org Installed at (2.3.5): /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8 (2.2.2): /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8 (1.2.6): /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8 Web-application framework with template engine, control-flow layer, and ORM. FYI So it looks like heading over to /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8 and deleting gems/* may do it. In this directory there is an alias to /Library/Ruby/Site and one to /Library/Ruby/Gems, which has some interesting content. So, Mr Schroeder, given this: gem env RubyGems Environment: - RUBYGEMS VERSION: 1.3.5 - RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0] - INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8 - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby - EXECUTABLE DIRECTORY: /usr/bin - RUBYGEMS PLATFORMS: - ruby - universal-darwin-10 - GEM PATHS: - /Library/Ruby/Gems/1.8 - /Users/rob/.gem/ruby/1.8 - /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8 - GEM CONFIGURATION: - :update_sources = true - :verbose = true - :benchmark = false - :backtrace = false - :bulk_threshold = 1000 - REMOTE SOURCES: - http://gems.rubyforge.org/ What do I drag to the trash? Looks like the stuff in the three GEM PATHS? -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Re: Which RoR to run on Mac OS X for a particular RoR app.
On Tue, Dec 7, 2010 at 11:07 AM, Rob Th li...@ruby-forum.com wrote: I thought uninstalling rails 2.3.8 would uninstall that version then a different version would be current. It would have if you'd answered no :-) Looks like several versions of rails are still hanging around! But... sudo gem uninstall rails ERROR: While executing gem ... (Gem::InstallError) cannot uninstall, check `gem list -d rails` mmm, surprising. What happens if you try explicitly uninstalling e.g. 2.3.5 ? It would be preferable to removing directories willy-nilly, IMO. If that works, uninstall the others also, then re-install 2.2.2. -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: missing attribute during initialization
Sorry for the late answer ... I had to simplyfy my model somehow to really test that is not an other interaction that causes that problem. That seems very strange. Are you absolutely sure that this what is happening? valid? cannot be fetching the object from the db as it must exist before you call valid? Or are you talking about fetching associated objects that are checked within valid? Do you have a repeatable situation where you see it? Yes, I guess so. My Model: class MyModel ActiveRecord::Base after_initialize :init_token validates :token, :uniqueness = true def init_token puts init token if self.token.blank? self.token = ActiveSupport::SecureRandom.hex(10) end end end And a simple case where it happens: m1 = MyModel.create m1.token.should_not be_empty m2 = MyModel.new m2.token.should_not be_empty m2.token = m1.token m2.valid? # where the exception is thrown (also init token is called) Full trace below. If so what happens for example if you use ruby-debug to break in just before the call of valid? and then inspect the object and call valid? from the console. I never used the debugger yet, but I will try to. But maybe you already know of the above info what is going on here? Kai Error trace: ActiveModel::MissingAttributeError: missing attribute: token from /home/zeus/projects/myproject/app/models/my_model.rb:9:in `init_token' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activesupport-3.0.3/lib/active_support/callbacks.rb:415:in `_run_initialize_callbacks' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activerecord-3.0.3/lib/active_record/base.rb:1453:in `init_with' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activerecord-3.0.3/lib/active_record/base.rb:909:in `instantiate' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activerecord-3.0.3/lib/active_record/base.rb:467:in `find_by_sql' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activerecord-3.0.3/lib/active_record/base.rb:467:in `collect!' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activerecord-3.0.3/lib/active_record/base.rb:467:in `find_by_sql' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activerecord-3.0.3/lib/active_record/relation.rb:64:in `to_a' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activerecord-3.0.3/lib/active_record/relation/finder_methods.rb:333:in `find_first' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activerecord-3.0.3/lib/active_record/relation/finder_methods.rb:122:in `first' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activerecord-3.0.3/lib/active_record/relation/finder_methods.rb:180:in `exists?' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activerecord-3.0.3/lib/active_record/validations/uniqueness.rb:39:in `validate_each' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activemodel-3.0.3/lib/active_model/validator.rb:154:in `validate' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activemodel-3.0.3/lib/active_model/validator.rb:151:in `each' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activemodel-3.0.3/lib/active_model/validator.rb:151:in `validate' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activesupport-3.0.3/lib/active_support/callbacks.rb:314:in `send' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activesupport-3.0.3/lib/active_support/callbacks.rb:314:in `_callback_before_1265' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activesupport-3.0.3/lib/active_support/callbacks.rb:414:in `_run_validate_callbacks' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activemodel-3.0.3/lib/active_model/validations.rb:212:in `run_validations!' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activemodel-3.0.3/lib/active_model/validations/callbacks.rb:67:in `run_validations!' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activesupport-3.0.3/lib/active_support/callbacks.rb:413:in `_run_validation_callbacks' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activemodel-3.0.3/lib/active_model/validations/callbacks.rb:67:in `run_validations!' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activemodel-3.0.3/lib/active_model/validations.rb:179:in `valid?' from /home/zeus/.rvm/gems/ruby-1.8.7-p...@rails/gems/ activerecord-3.0.3/lib/active_record/validations.rb:55:in `valid?' from (irb):103 -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] style question: update or create active record
I find that I'm frequently writing code that could be described in english as If there is an incumbent ActiveRecord that meets some specific criteria, then update one or more of its fields. Otherwise create a new record with the same criteria and new field values. ActiveRecord's dynamic finder methods (find_or_create_by_xxx) are not usually expressive enough to do this. But I haven't been able to create a general method that smells right. It's been bugging me, so I turn to the mavens of style in this forum for suggestions. As an example, I just wrote this monstrosity: def set_xattribute(name, value) symbol_name = self.class.intern_symbol_name(name) incumbent = SymbolValue. where(:symbol_values = {:symbol_name_id = symbol_name.id}). where(:symbol_values = {:owner_id = self.id}). where(:symbol_values = {:xclass_id = self.class.xclass_id}).first if (incumbent) incumbent.update_attribute(:value, value) else SymbolValue.create(:symbol_name_id = symbol_name.id, :owner_id = self.id, :xclass_id = self.class.xclass_id, :value = value) end end Note the huge amount of repetition between the finder (incumbent = ...) and the creator (SymbolValue.create(...)). I can think of a few approaches to DRYing this code (e.g. scopes), but what do the mavens of style in this forum suggest? - ff -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Re: Which RoR to run on Mac OS X for a particular RoR app.
Hassan Schroeder wrote in post #966954: On Tue, Dec 7, 2010 at 11:07 AM, Rob Th li...@ruby-forum.com wrote: I thought uninstalling rails 2.3.8 would uninstall that version then a different version would be current. It would have if you'd answered no :-) Looks like several versions of rails are still hanging around! But... sudo gem uninstall rails ERROR: While executing gem ... (Gem::InstallError) cannot uninstall, check `gem list -d rails` mmm, surprising. What happens if you try explicitly uninstalling e.g. 2.3.5 ? It would be preferable to removing directories willy-nilly, IMO. If that works, uninstall the others also, then re-install 2.2.2. -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan gem uninstall rails -v=2.3.5 ERROR: While executing gem ... (Gem::InstallError) cannot uninstall, check `gem list -d rails` gem list --local *** LOCAL GEMS *** actionmailer (2.3.5, 2.2.2, 1.3.6) actionpack (2.3.5, 2.2.2, 1.13.6) actionwebservice (1.2.6) activerecord (2.3.5, 2.2.2, 1.15.6) activeresource (2.3.5, 2.2.2) activesupport (2.3.5, 2.2.2, 1.4.4) acts_as_ferret (0.4.3) capistrano (2.5.2) cgi_multipart_eof_fix (2.5.0) daemons (1.0.10) dnssd (0.6.0) fastthread (1.0.1) fcgi (0.8.7) ferret (0.11.6) gem_plugin (0.2.3) highline (1.5.0) hpricot (0.6.164) libxml-ruby (1.1.2) mongrel (1.1.5) needle (1.3.0) net-scp (1.0.1) net-sftp (2.0.1, 1.1.1) net-ssh (2.0.4, 1.1.4) net-ssh-gateway (1.0.0) rack (1.0.1) rails (2.3.5, 2.2.2, 1.2.6) rake (0.8.3) RedCloth (4.1.1) ruby-openid (2.1.2) ruby-yadis (0.3.4) rubynode (0.1.5) rvm (1.1.3) sqlite3-ruby (1.2.4) termios (0.9.4) xmpp4r (0.4) -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] style question: update or create active record
I find that I'm frequently writing code that could be described in English as If there is an incumbent ActiveRecord that meets some specific criteria, then update one or more of its fields. Otherwise create a new record with the same criteria and new field values. ActiveRecord's dynamic finder methods (find_or_create_by_xxx) are not usually expressive enough to do this. But I haven't been able to create a general method that smells right. It's been bugging me, so I turn to the mavens of style in this forum for suggestions. As an example, I just wrote this monstrosity: def set_xattribute(name, v1, v2) symbol_name = self.class.intern_symbol_name(name) incumbent = SymbolValue. where(:symbol_values = {:symbol_name_id = symbol_name.id}). where(:symbol_values = {:owner_id = self.id}). where(:symbol_values = {:xclass_id = self.class.xclass_id}).first if (incumbent) incumbent.update_attributes(:v1 = v1, :v2 = v2) else SymbolValue.create(:symbol_name_id = symbol_name.id, :owner_id = self.id, :xclass_id = self.class.xclass_id, :v1 = v1, :v2 = v2) end end Note the code fragments repeated among the finder (incumbent = ...), the updater (update_attributes(...), and the creator (SymbolValue.create(...)). There may be a clever way to use scopes for this, but what do the mavens of style in this forum suggest? - ff -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Search Fullname, in two fields firstname, lastname.
On 7 December 2010 15:37, Colin Law clan...@googlemail.com wrote: On 7 December 2010 14:04, Srikanth Jeeva li...@ruby-forum.com wrote: keyword = Srikanth Jeeva Thanks for response. After splitting i write query like this, Don't forget to include checks to make sure you have two words and adjust the query accordingly, unless you know exactly the format of keyword of course. yes... what if the user-supplied search word is only one name, or three names? The solution to the problem that I use is this snippet (where value is a user-entered search value, and the following chunk of code is just part of a larger search/sort/order query, but all the important parts are here): conditions_sql = [] conditions_values = [] value.split( ).flatten.uniq.each do |name_part| conditions_sql (people.firstname LIKE ? OR people.lastname LIKE ? OR people.othernames LIKE ?) 3.times {conditions_values %#{name_part}%} end conditions_values.unshift conditions_sql.join( AND ) Person.find(:conditions = conditions_values) (And after looking at it for the first time in ages myself; as Marnen points out, I could probably replace the 3.times do ... bit with named placeholders to streamline it a little more.) -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Advice on data design idea
Correct I would like to support multiple parents per a given category. For instance: Automotive Trailers Cargo Trailer Marine/boating Misc. Cargo Trailer 'Cargo Trailers' may be accessed through different hierarchies. I have considered using a graph but through the implementation may be a bit overkill or complex. Curious if somehow to do this via awesome_nested_set or ancestry? btw - thanks for the help. On Dec 7, 1:53 pm, Marnen Laibow-Koser li...@ruby-forum.com wrote: Randy Clark wrote in post #966944: I'm about to embark on a project and am seeking advice on my approach. I have an automotive site that needs to have shared categories. I've checked out different nested set, ancestral, acts_as_tree, acyclic plugins but feel they don't exactly fit. As I said in your other thread, programming is not about what you feel. So I am about to roll my own simple solution. Any feedback as to whether this looks good is appreciated. Essentially I have: Sections - Automotive, Marine, Air Groups - Cars, Trucks, Bikes Categories - Pickup, SUV, Utility Truck The categories need to be able to be under multiple groups and/or sections. In what way do you mean this? Will you actually have multiple parents for one category? Can you give an example of the way your hierarchy will look. So I am thinking on having a series of HABTM associations: sections_groups sections_categories groups_categories This will allow me to add new groups/categories/sections with highly flexible associations. @section.groups or @section.categories etc... Does this seem right or am I way off? I'm also concerned whether it will perform well.. I think you're way off. Sounds like you have a hierarch which is either a tree or an arbitrary graph (not sure which, pending your answer to my question above). In either case, all you need is one model (call it Category). Use awesome_nested_set if it's a tree. Done. If it's a graph, things might get a bit harder, buthttp://www.artfulsoftware.com/mysqlbook/sampler/mysqled1ch20.htmlmay give you an overview of what you could do.http://www.dweebd.com/sql/modeling-bidirectional-graph-edges-in-rails/ is a Rails-specific implementation of one of those ideas (though it implements bidirectional edges and you probably only need unidirectional ones). There may be a Rails plugin that abstracts this. Best, -- Marnen Laibow-Koserhttp://www.marnen.org mar...@marnen.org -- Posted viahttp://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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
Even odder. sudo gem uninstall rails -v 2.3.5 ERROR: While executing gem ... (Gem::InstallError) cannot uninstall, check `gem list -d rails` RobsiMac:~ rob$ sudo gem install rails -v 2.3.5 Successfully installed rails-2.3.5 1 gem installed Installing ri documentation for rails-2.3.5... Installing RDoc documentation for rails-2.3.5... RobsiMac:~ rob$ sudo gem uninstall rails -v 2.3.5 Successfully uninstalled rails-2.3.5 RobsiMac:~ rob$ rails -v Rails 2.3.5 -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: style question: update or create active record
Fearless Fool wrote in post #966959: I find that I'm frequently writing code that could be described in English as If there is an incumbent ActiveRecord that meets some specific criteria, then update one or more of its fields. Otherwise create a new record with the same criteria and new field values. ActiveRecord's dynamic finder methods (find_or_create_by_xxx) are not usually expressive enough to do this. find_or_create_by_* will do exactly this. You can specify additional fields for the create part of the action. Please see the docs. If that won't do the trick, then please explain further. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Can't install Rails 3.0
Walter, please see attached. Michael Attachments: http://www.ruby-forum.com/attachment/5526/nnm.gif -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
Rob Th wrote in post #966961: Even odder. sudo gem uninstall rails -v 2.3.5 ERROR: While executing gem ... (Gem::InstallError) cannot uninstall, check `gem list -d rails` RobsiMac:~ rob$ sudo gem install rails -v 2.3.5 Successfully installed rails-2.3.5 1 gem installed Installing ri documentation for rails-2.3.5... Installing RDoc documentation for rails-2.3.5... RobsiMac:~ rob$ sudo gem uninstall rails -v 2.3.5 Successfully uninstalled rails-2.3.5 RobsiMac:~ rob$ rails -v Rails 2.3.5 Compare the output of gem env and sudo gem env. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] style question: update or create active record
On Dec 7, 2010, at 11:34 AM, Fearless Fool wrote: I find that I'm frequently writing code that could be described in English as If there is an incumbent ActiveRecord that meets some specific criteria, then update one or more of its fields. Otherwise create a new record with the same criteria and new field values. ActiveRecord's dynamic finder methods (find_or_create_by_xxx) are not usually expressive enough to do this. But I haven't been able to create a general method that smells right. It's been bugging me, so I turn to the mavens of style in this forum for suggestions. As an example, I just wrote this monstrosity: def set_xattribute(name, v1, v2) symbol_name = self.class.intern_symbol_name(name) incumbent = SymbolValue. where(:symbol_values = {:symbol_name_id = symbol_name.id}). where(:symbol_values = {:owner_id = self.id}). where(:symbol_values = {:xclass_id = self.class.xclass_id}).first if (incumbent) incumbent.update_attributes(:v1 = v1, :v2 = v2) else SymbolValue.create(:symbol_name_id = symbol_name.id, :owner_id = self.id, :xclass_id = self.class.xclass_id, :v1 = v1, :v2 = v2) end end Note the code fragments repeated among the finder (incumbent = ...), the updater (update_attributes(...), and the creator (SymbolValue.create(...)). There may be a clever way to use scopes for this, but what do the mavens of style in this forum suggest? You might play around with find_or_instantiator_by_attributes http://apidock.com/rails/ActiveRecord/FinderMethods/find_or_instantiator_by_attributes -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.
On Tue, Dec 7, 2010 at 11:39 AM, Rob Th li...@ruby-forum.com wrote: RobsiMac:~ rob$ sudo gem install rails -v 2.3.5 Successfully installed rails-2.3.5 1 gem installed RobsiMac:~ rob$ sudo gem uninstall rails -v 2.3.5 Successfully uninstalled rails-2.3.5 RobsiMac:~ rob$ rails -v Rails 2.3.5 So what happens now if you `sudo gem uninstall rails` ? -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Advice on data design idea
Please quote when replying. Randy Clark wrote in post #966962: Correct I would like to support multiple parents per a given category. For instance: Automotive Trailers Cargo Trailer Marine/boating Misc. Cargo Trailer 'Cargo Trailers' may be accessed through different hierarchies. Er, why? Why does a cargo trailer belong in a boating category? I have the impression, here as in your earlier post, that your category hierarchy may be in need of some normalization. I have considered using a graph but through the implementation may be a bit overkill or complex. How can it be overkill? It's the exact data structure you're talking about. Will it be complex? Yes. If you could normalize your categories so that each has only one parent, you'd have a tree, and that would be a lot easier to implement. (Whether you can in fact do this for your data is another question.) Curious if somehow to do this via awesome_nested_set No. That only allows for each node to have one parent. or ancestry? I've never heard of that one. However, having looked up the docs, it appears that Ancestry uses the materialized path pattern. That generally only supports one parent per node; it's another way of doing trees. Unless you can make your data into a tree, you need a directed graph structure. btw - thanks for the help. You're welcome! Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: style question: update or create active record
BTW, the best I've come with so far is: file: ar_extensions.rb = class ActiveRecord::Base def self.create_or_update(attrs_to_match, attrs_to_update = {}) if (incumbent = self.first(:conditions = attrs_to_match)) incumbent.update_attributes(attrs_to_update) incumbent else self.create!(attrs_to_match.merge(attrs_to_update)) end end end = ... but maybe there is something more appropriate in the new query interface or AREL models? -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Render partial generate unwanted spaces
I'm not sure it's the editor; my own issues are coming with Notepad+ +. Still, I'm glad I checked back into this thread. It's given me some stuff to try out. If I find the magic solution (or if I don't) I'll check back in. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Which RoR to run on Mac OS X for a particular RoR app.
Hassan Schroeder wrote in post #966968: On Tue, Dec 7, 2010 at 11:39 AM, Rob Th li...@ruby-forum.com wrote: RobsiMac:~ rob$ sudo gem install rails -v 2.3.5 Successfully installed rails-2.3.5 1 gem installed RobsiMac:~ rob$ sudo gem uninstall rails -v 2.3.5 Successfully uninstalled rails-2.3.5 RobsiMac:~ rob$ rails -v Rails 2.3.5 So what happens now if you `sudo gem uninstall rails` ? -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan gem list --local *** LOCAL GEMS *** actionmailer (2.3.5, 2.2.2, 1.3.6) actionpack (2.3.5, 2.2.2, 1.13.6) actionwebservice (1.2.6) activerecord (2.3.5, 2.2.2, 1.15.6) activeresource (2.3.5, 2.2.2) activesupport (2.3.5, 2.2.2, 1.4.4) acts_as_ferret (0.4.3) capistrano (2.5.2) cgi_multipart_eof_fix (2.5.0) daemons (1.0.10) dnssd (0.6.0) fastthread (1.0.1) fcgi (0.8.7) ferret (0.11.6) gem_plugin (0.2.3) highline (1.5.0) hpricot (0.6.164) libxml-ruby (1.1.2) mongrel (1.1.5) needle (1.3.0) net-scp (1.0.1) net-sftp (2.0.1, 1.1.1) net-ssh (2.0.4, 1.1.4) net-ssh-gateway (1.0.0) rack (1.0.1) rails (2.3.5, 2.2.2, 1.2.6) rake (0.8.3) RedCloth (4.1.1) ruby-openid (2.1.2) ruby-yadis (0.3.4) rubynode (0.1.5) rvm (1.1.3) sqlite3-ruby (1.2.4) termios (0.9.4) xmpp4r (0.4) RobsiMac:~ rob$ sudo gem uninstall rails Select gem to uninstall: 1. rails-2.2.2 2. rails-2.2.2 3. All versions Ouch. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Advice on data design idea
Thanks Marnen - Er, why? Why does a cargo trailer belong in a boating category? I have the impression, here as in your earlier post, that your category hierarchy may be in need of some normalization. I may need to rethink the data structure, but as of now the site calls for categories to be able to be found under multiple sections. Customers sometimes search for items under different categories kind of like aliases. So in the case of the cargo trailer its definitely automotive, but some marinas may be used to finding tool/cargo trailers within the marine category. Rather than have duplicate categories, it would be best to share the same category. How can it be overkill? It's the exact data structure you're talking about. Understood but after looking into various DAG databases and methods I think it would be better to find a way to normalize or restructure the data to utilize something better supported such as one parent per node setup such as awesome_nested_set or ancestry. I am wondering, what about simply manually defining the categories for my root sections? For instance: automotive = [cat1, cat2, cat3, etc...] Essentially create 'virtual' sections. This will keep my categories simple yet allow me to 'group' a category into multiple virtual sections when the needed. Can I get an amen or should I go stand back in the corner? :-) -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Advice on data design idea
Randy Clark wrote in post #966977: Thanks Marnen - Er, why? Why does a cargo trailer belong in a boating category? I have the impression, here as in your earlier post, that your category hierarchy may be in need of some normalization. I may need to rethink the data structure, but as of now the site calls for categories to be able to be found under multiple sections. Customers sometimes search for items under different categories kind of like aliases. So in the case of the cargo trailer its definitely automotive, but some marinas may be used to finding tool/cargo trailers within the marine category. Rather than have duplicate categories, it would be best to share the same category. Really, or would it be better to have an item belong to multiple categories? [...] I am wondering, what about simply manually defining the categories for my root sections? For instance: automotive = [cat1, cat2, cat3, etc...] Essentially create 'virtual' sections. This will keep my categories simple yet allow me to 'group' a category into multiple virtual sections when the needed. Can I get an amen or should I go stand back in the corner? :-) Go stand back in the corner. :) If you're creating a DAG, make it an actual DAG. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Re: Raw SQL in Migration
On Tue, Dec 7, 2010 at 4:29 PM, Marnen Laibow-Koser li...@ruby-forum.com wrote: Please quote when replying. Gustavo de Sá Carvalho Honorato gustavohonorato wrote in post #966932: Thanks Marnen, I didn't know this plugin. I've read the documentation, but in his example I can't see how to change the columns names of the view. Is it possible? I don't know. I've never used it. But the example sort of implies that you could use AS in the select statement. It seems that rails_sql_view doesn't work with JRuby (I'm using JRuby and Rails 2.3). When I installed the gem, I'm getting the following error: undefined method `base_tables' for #ActiveRecord::ConnectionAdapters::JdbcAdapter:0x40eca3 /home/gustavo/.rvm/gems/jruby-1.5.2/gems/rails_sql_views-0.8.0/lib/rails_sql_views/schema_dumper.rb:98:in `tables_with_views_excluded' /home/gustavo/.rvm/gems/jruby-1.5.2/gems/activerecord-2.3.8/lib/active_record/schema_dumper.rb:25:in `dump' /home/gustavo/.rvm/gems/jruby-1.5.2/gems/rails_sql_views-0.8.0/lib/rails_sql_views/schema_dumper.rb:27:in `dump_with_views' /home/gustavo/.rvm/gems/jruby-1.5.2/gems/activerecord-2.3.8/lib/active_record/schema_dumper.rb:19:in `dump' Do you have any idea? Thanks again, Gustavo Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org Sent from my iPhone -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Re: Which RoR to run on Mac OS X for a particular RoR app.
On Tue, Dec 7, 2010 at 12:05 PM, Rob Th li...@ruby-forum.com wrote: RobsiMac:~ rob$ sudo gem uninstall rails Select gem to uninstall: 1. rails-2.2.2 2. rails-2.2.2 3. All versions Ouch. So select 3 and keep going :-) You can always add back the version you want later. -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.