[Rails] Re: Form_for problem after upgrading
%= form_for @user_session, :url = user_session_path do |f| % Email br/ %= text_field_tag :login %br/ Password br/ %= f.password_field :password %br/ Remember Me %= f.check_box :remember_me % br/ %= f.submit Login % % end % replace %= text_field_tag :login %br/ with %= f.text_field :login % what is the output in the log? %= form_for @user_session, :url = user_session_path do |f| % p%= f.label( :login , Email ) %br / %= f.text_field :login %/p p%= f.label :password %br / %= f.password_field :password %/p p%= f.label :remember_me%br / %= f.text_field :remember_me%/p p%= f.submit Login %/p % end % -- 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: Forcing rails to output HTML4 rather then XHTML?
What I'm trying to find out is specifically how IE 6 breaks (as in incorrectly renders the page) when using valid HTML 5 markup (including self-closing tags) with !DOCTYPE html. Again assume no HTML 5 only features only markup syntax. I'm asking because I don't personally use any version of IE, much less IE 6. I'd really like to know if IE 6 actually has problems rending HTML 5 markup. It does not break. The only thing that doctype affects in IE6 is rendering mode. HTML5 doctype forces IE6 into standards compliant mode, see [1] for more details. In fact, because unknown doctype (which html5 doctype was for earlier browsers) forces them to use standards rendering mode is THE reason HTML5 has doctype at all. You can omit doctype for your XHTML5 pages, because they MUST be served with application/xhtml+xml MIME type and then it is this MIME that tells browsers how to treat you document, no doctype necessary. So if your web page was using any of doctypes which would cause IE to be in standards compliant mode it will behave just the same with HTML5 doctype. However, if your page was developed for quirks mode, HTML5 doctype will switch IE6 into standards compliant rendering and things may (will?) break horribly. The most probable case is different box model, but there are other differences too, see the link below for the details. [1] http://msdn.microsoft.com/en-us/library/bb250395(VS.85).aspx Regards, Rimantas -- http://rimantas.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] Rails 3 - Creating a JSON response to display Search Results
On 27 Oct 2010, at 07:23, CuriousNewbie wrote: Hello, I'm working to have Rails 3 respond with a JSON request which will then let the app output the search results with the jQuery template plugin... For the plugin to work, it needs this type of structure: [ { title: The Red Violin, url: /adadad/123/ads, desc: blah yada }, { title: Eyes Wide Shut, url: /adadad/123/ads, desc: blah yada }, { title: The Inheritance, url: /adadad/123/ads, desc: blah yada } ] In my Rails 3 controller, I'm getting the search results which come back as @searchresults, which contain either 0 , 1 , or more objects from the class searched. My question is how to convert that to the above structure (JSON)... Thank you! ... The front-end search page will need to work for multiple models which have different db columns. That's why I'd like to learn how to convert that to the above to normalize the results, and send back to the user. Something like this should work: http://gist.github.com/648637 We are using a similar concept in our main application, but much more complex (generating tree structures out of complex node relationships). This is a basic implementation, but you can easily make it do more and yet all functionality is nicely encapsulated. Hope this helps. Best regards Peter De Berdt -- 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: Trubelshooting MS Sql database connection
I finally got it working after a lot of googeling around big thanks to http://github.com/rails-sqlserver/activerecord-sqlserver-adapter/wiki/Platform-Installation---Windows for pointing me towards ruby-odbc which was the final peice to solve my puzzle How to get Ruby on Rails working with MS SQLServer2008 and windows server 2003 This mini tutorial assumes MS SQLServer2008 is installed and running i will be using mongrel to deploy 1. Install ruby via www.rubyinstaller.org (i used 1.8.7 version) 2. Install the DevKit (otherwise all gems won´t install properly) 3. Start a command promt with ruby via the start menu 4. Install rails gem install rails 5. Get a cup of coffee this will take a while 6. install mongrel gem install mongrel --pre (2010-10-27 this was the way to do it, this will change) 7. install ruby-odbc gem install ruby-odbc 8. install activerecord-sqlserver-adapter gem install activerecord-sqlserver-adapter 9. install dbi gem install dbi 10. install rails-dbi gem install rails-dbi NOTE: the reason for installing rails dbi and putting gem 'rails- dbi', :require = 'dbi' in the gem file is a conflict with the dbi and the deprecated gems. This issue migth be resolved in the future. 11. Now its time to get on with editing our gemfile put this in it gem 'rails-dbi', :require = 'dbi' gem 'ruby-odbc' gem 'activerecord-sqlserver-adapter' gem 'mongrel', '1.2.0.pre2' #this line will probably change in the future this is written 2010-10-27 Then you need a connection string this will be in your config/ database.yml file development: adapter: sqlserver driver: Sql Client mode: odbc database: DatabaseName host: localhost/SQLSERVER2008 dsn: dsn_name autocommit: true username: user password: pass NOTE: # localhost migth suffice or if you have mutilple named instances like me you have to include that as well About dsn: the dsn is created via the Data Sources(ODBC) tool under administrative tools Create a System DSN with the same name as dsn: dsn_name under client configuration use TCP/IP(this should be default just adding this so you know that this is correct) now try to create a new project and a scaffold do a bundle install and rake db:migrate if all went well you should be able to start your server via rails server and start doing som CRUD against your SQLServer2008 database On 26 Okt, 15:18, Rodolinux rodoli...@gmail.com wrote: It's not my tutorial. Just I found it some days ago On Tue, Oct 26, 2010 at 9:41 AM, Fredrik TiC Jansson fredrikjansson1...@gmail.com wrote: Thanks seems rather comprehensive i will go through your tutorial. On 26 Okt, 13:18, Rodolinux rodoli...@gmail.com wrote: On Tue, Oct 26, 2010 at 5:41 AM, Fredrik TiC Jansson fredrikjansson1...@gmail.com wrote: Hello i have been atempting to move a project from sqlite database to a sql server database with absolutly no success. i am now going to document my entire process so that mabey someone can se the error of my ways. And if some one else has this problem this migth act as a troubleshooting guide. OS: windows server 2003 latest sp Sql: Sql server 2008 1. Install ruby 192.p0 fromhttp://rubyinstaller.com/downloads(ticked both boxes ie add to PATH and associate files) installation folder is c:/ruby192 2.Install rails via gem install rails 3. Install mongrel via gem install mongrel --pre 4. install the sql adapter via gem install activerecord-swlserver-adapter 5. install dbd-odbc via gem install dbd-odbc this also installed the dbi gem so i wont install this from a separate command Ok now everything i need to start RoR with mongrel and Sql Server should be installed as far as i know on to the gem file gem 'rails'#, '3.0.1' require 'activerecord-sqlserver-adapter' gem 'mongrel', '1.2.0.pre2' require 'dbi' and then the database.yml development: adapter: sqlserver mode: odbc database: NameOfMyDB host: localhost dsn: name_of_my_db autocommit: true username: something password: something Notes about this conf dsn is the same name as the dsn i created with the odbc data source administrator tool this is a system DSN by the way i have also tried with file DSN Ok now on to running my app i go to the directory wich is located as follows D:/projects/railsdev/projectname/ so i go there and execute bundle install the result of this is Error require: no such file to load --activerecord-sqlserver-adapter if i change my require to a gem command everything is installed and the server starts when i try to connect to the database i get another error LoadError (no such file to load --odbc) i have been loosing sleep over this please tell me what am i doing wrong ? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to
[Rails] Virtual model
Hello, I would like to create a simple ActiveRecord model, but working without table... Is that possible? I think we can this a virtual model. And I would like to be able to use relations (like has_many :users, etc) with this model (named App for instance), such as: App.first.users Thanks for any ideas. -- 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: Trubelshooting MS Sql database connection
I finally got it working after a lot of googeling around big thanks to http://github.com/rails-sqlserver/activerecord-sqlserver-adapter/wiki/Platform-Installation---Windows for pointing me towards ruby-odbc which was the final peice to solve my puzzle How to get Ruby on Rails working with MS SQLServer2008 and windows server 2003 This mini tutorial assumes MS SQLServer2008 is installed and running i will be using mongrel to deploy 1. Install ruby via www.rubyinstaller.org (i used 1.8.7 version) 2. Install the DevKit (otherwise all gems won´t install properly) 3. Start a command promt with ruby via the start menu 4. Install rails gem install rails 5. Get a cup of coffee this will take a while 6. install mongrel gem install mongrel --pre (2010-10-27 this was the way to do it, this will change) 7. install ruby-odbc gem install ruby-odbc 8. install activerecord-sqlserver-adapter gem install activerecord-sqlserver-adapter 9. install dbi gem install dbi 10. install rails-dbi gem install rails-dbi NOTE: the reason for installing rails dbi and putting gem 'rails- dbi', :require = 'dbi' in the gem file is a conflict with the dbi and the deprecated gems. This issue migth be resolved in the future. 11. Now its time to get on with editing our gemfile put this in it gem 'rails-dbi', :require = 'dbi' gem 'ruby-odbc' gem 'activerecord-sqlserver-adapter' gem 'mongrel', '1.2.0.pre2' #this line will probably change in the future this is written 2010-10-27 Then you need a connection string this will be in your config/ database.yml file development: adapter: sqlserver driver: Sql Client mode: odbc database: DatabaseName host: localhost/SQLSERVER2008 dsn: dsn_name autocommit: true username: user password: pass NOTE: # localhost migth suffice or if you have mutilple named instances like me you have to include that as well About dsn: the dsn is created via the Data Sources(ODBC) tool under administrative tools Create a System DSN with the same name as dsn: dsn_name under client configuration use TCP/IP(this should be default just adding this so you know that this is correct) now try to create a new project and a scaffold do a bundle install and rake db:migrate if all went well you should be able to start your server via rails server and start doing som CRUD against your SQLServer2008 database On 26 Okt, 15:18, Rodolinux rodoli...@gmail.com wrote: It's not my tutorial. Just I found it some days ago On Tue, Oct 26, 2010 at 9:41 AM, Fredrik TiC Jansson fredrikjansson1...@gmail.com wrote: Thanks seems rather comprehensive i will go through your tutorial. On 26 Okt, 13:18, Rodolinux rodoli...@gmail.com wrote: On Tue, Oct 26, 2010 at 5:41 AM, Fredrik TiC Jansson fredrikjansson1...@gmail.com wrote: Hello i have been atempting to move a project from sqlite database to a sql server database with absolutly no success. i am now going to document my entire process so that mabey someone can se the error of my ways. And if some one else has this problem this migth act as a troubleshooting guide. OS: windows server 2003 latest sp Sql: Sql server 2008 1. Install ruby 192.p0 fromhttp://rubyinstaller.com/downloads(ticked both boxes ie add to PATH and associate files) installation folder is c:/ruby192 2.Install rails via gem install rails 3. Install mongrel via gem install mongrel --pre 4. install the sql adapter via gem install activerecord-swlserver-adapter 5. install dbd-odbc via gem install dbd-odbc this also installed the dbi gem so i wont install this from a separate command Ok now everything i need to start RoR with mongrel and Sql Server should be installed as far as i know on to the gem file gem 'rails'#, '3.0.1' require 'activerecord-sqlserver-adapter' gem 'mongrel', '1.2.0.pre2' require 'dbi' and then the database.yml development: adapter: sqlserver mode: odbc database: NameOfMyDB host: localhost dsn: name_of_my_db autocommit: true username: something password: something Notes about this conf dsn is the same name as the dsn i created with the odbc data source administrator tool this is a system DSN by the way i have also tried with file DSN Ok now on to running my app i go to the directory wich is located as follows D:/projects/railsdev/projectname/ so i go there and execute bundle install the result of this is Error require: no such file to load --activerecord-sqlserver-adapter if i change my require to a gem command everything is installed and the server starts when i try to connect to the database i get another error LoadError (no such file to load --odbc) i have been loosing sleep over this please tell me what am i doing wrong ? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to
[Rails] Re: Form_for problem after upgrading
tashfeen.ekram wrote in post #957373: I am upgrading to rails 3 and afer diong so, none of my form_for are working. (I can not actually say not all of them are working but the few that i have tried are not). The page loads fine but the form is not output. This is after making the the change from % to %=. A sample form is below. %= form_for @user_session, :url = user_session_path do |f| % Email br/ %= text_field_tag :login %br/ Password br/ %= f.password_field :password %br/ Remember Me %= f.check_box :remember_me % br/ %= f.submit Login % % end % Hi, In that case you need to use 'dynamic-form' plugin for rails3 http://github.com/rails/dynamic_form This plugin can auto modify you syntax at runtime. Good Luck ;) -Ganesh K -- 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] Google maps
Anyone know an up-to-date gem for Rails 3 to connect and display markers on google maps? It seems the gem YM4R hasn't been updated for a while now... Most of the articles I find on Google are a bit outdated as well. Should I just stick with native Google Map API 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] Empty array check
Which of the two methods below are the most stable? Does it matter? !...@articles.empty? @articles.length 0 I personally prefer using the 'empty?' method. -- 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] Empty array check
On 27 October 2010 11:43, Pale Horse li...@ruby-forum.com wrote: Which of the two methods below are the most stable? Does it matter? !...@articles.empty? @articles.length 0 I personally prefer using the 'empty?' method. Between the two, I'd use .empty?, but at a choice I'd use neither, and go for .blank? instead. .blank? can be a bit more stable as it returns true for nil values, as well as blank strings, empty arrays and hashes... -- 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] Using ActiveRecord 3.0.x with Ruby 1.9.2
Can someone remind me of the incantation to use ActiveRecord in a plain ruby program for the versions specified. I'm not having any luck searching with google and I keep getting: `require': no such file to load -- activerecord (LoadError) Not sure if this is a dependency or file path problem. Thanks -- 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: Problems when connecting to Sql server 2008 odbc no such file to load error
i succeded in getting it working and posted a short how-to in this thread http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/90bac21d2f5d2616/908fbcaed47c5259#908fbcaed47c5259 will probably go the CentOS PhuzionPassenger MySql route in the future. On 26 Okt, 18:56, Marnen Laibow-Koser li...@ruby-forum.com wrote: Fredrik TiC Jansson wrote in post #957147: Windows server 2003 the app was originally developed on OSX snow leopard using just sqlite3 and i sucessluffy migrated it and got it running without a hitch on win server 2003 but i have to get it working with SQL sever 2008 for production purposes (sqlite3 just wont cut it) You might like TinyTds. I've just changed an app over to it here at work, and I am really liking it. Also, if you have a choice, *do not* use a Windows server, and *do not* use MS SQL. I recommend *nix of some sort (I use Ubuntu) and PostgreSQL for ease and security of deployment. 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: JRuby + Windows Service
I use Mongrel as web service. Here is a link that might help: http://noobonrails.blogspot.com/2006/06/how-to-setup-mongrel-as-native-windows.html On Oct 26, 10:29 am, Daniel Shimoyama shimoyama.dan...@gmail.com wrote: Wassup everyone? I'm trying to deploy a application on windows server 2000, developed with JRuby. My point is, there's someway to deploy using windows service to start the application as a service, instead using a java application server? Thanks -- 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: Empty array check
Michael Pavling wrote in post #957448: On 27 October 2010 11:43, Pale Horse li...@ruby-forum.com wrote: Which of the two methods below are the most stable? Does it matter? !...@articles.empty? @articles.length 0 I personally prefer using the 'empty?' method. Between the two, I'd use .empty?, but at a choice I'd use neither, and go for .blank? instead. .blank? can be a bit more stable as it returns true for nil values, as well as blank strings, empty arrays and hashes... Interesting. Thanks for your response. -- 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] Inflect word depending on number
How can I use proper word after number, depending on that number. For example I have message that says: for 23 monthes, or it can be 21 month. So I have to inflect depending on number -- 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] Facebook API
Hi, What is the best library to develop a facebook app? Thanks JF -- 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] Inflect word depending on number
On Oct 27, 2010, at 8:35 AM, Vitaliy Yanchuk wrote: How can I use proper word after number, depending on that number. For example I have message that says: for 23 monthes, or it can be 21 month. So I have to inflect depending on number -- If you're in a Rails view, you can say: pluralize(n, 'month') If you're just in plain Ruby, it might depend on the pluralization rule: #{n} month#{'s' unless n == 1} #{n} part#{n == 1 ? 'y' : 'ies'} #{n} fish -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] rails version check for gems
I'm seeing a handful of gem bugs on rails3 that are going unresolved because the fix breaks the gem on rails2. What is the preferred way to add rails version conditions to a gem? Is checking the Rails::VERSION::STRING what folks should be doing? if Rails::VERSION::STRING.start_with?(3) do rails 3 stuff else do what u were doing end Seems like that would break something once Rails 4 comes out. ;-) Pointers to best practices appreciated. Thanks Tony Primerano -- 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] Inflect word depending on number
On 27 October 2010 14:07, Rob Biedenharn r...@agileconsultingllc.com wrote: If you're just in plain Ruby, it might depend on the pluralization rule: #{n} month#{'s' unless n == 1} #{n} part#{n == 1 ? 'y' : 'ies'} #{n} fish You can also use String.pluralize #{n} {n == 1 ? 'month' : 'month'.pluralize} http://apidock.com/rails/ActiveSupport/Inflector/pluralize -- 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] SOAP::RPC::Driver
i want to get a service from this site : http://ww2.tsetmc.com/webservice/TsePublic.asmx def index soapdriver = SOAP::WSDLDriverFactory.new(wsdlPath).create_rpc_driver result = soapdriver.Board(:UserName = 'usernameValue',:Password = 'passwordValue') end but this site return a empty object for this method = SOAP::Mapping::Object -- 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] SOAP::RPC::Driver
On 27 October 2010 14:23, Rose Rose li...@ruby-forum.com wrote: i want to get a service from this site : http://ww2.tsetmc.com/webservice/TsePublic.asmx but this site return a empty object for this method = SOAP::Mapping::Object Have you tested that the service works nicely with your request from a mocking utility like Soapui? Rails and SOAP aren't that well integrated, and the little I've done with it in the past, I've found Soapui invaluable to make sure the server is responding properly at least, even if my Ruby code was playing up. -- 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] Inflect word depending on number
On Oct 27, 2010, at 9:19 AM, Michael Pavling wrote: On 27 October 2010 14:07, Rob Biedenharn r...@agileconsultingllc.com wrote: If you're just in plain Ruby, it might depend on the pluralization rule: #{n} month#{'s' unless n == 1} #{n} part#{n == 1 ? 'y' : 'ies'} #{n} fish You can also use String.pluralize #{n} {n == 1 ? 'month' : 'month'.pluralize} http://apidock.com/rails/ActiveSupport/Inflector/pluralize True, but my point was that you may not even need the help from ActiveSupport for something simple (i.e., you are dealing with a known rather than an arbitrary noun). You can even do things like: #{n} #{n == 1 ? 'error prevents' : 'errors prevent'} the saving of the record. which tends to get very little help from the Inflector. -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: rails version check for gems
On Oct 27, 9:09 am, Tony Primerano tony.primer...@gmail.com wrote: Seems like that would break something once Rails 4 comes out. ;-) Couldn't you do this? if Rails::VERSION::STRING.to_i = 3 puts at least rails 3 else puts rails 2 or lower end -- 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] Facebook API
You could try http://facebooker.rubyforge.org/ On Wed, Oct 27, 2010 at 9:05 PM, jef jfferri...@gmail.com wrote: Hi, What is the best library to develop a facebook app? Thanks JF -- 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] Virtual model
If you are using rails 3, see this http://railscasts.com/episodes/219-active-model On Wed, Oct 27, 2010 at 4:06 PM, Satsou Sa li...@ruby-forum.com wrote: Hello, I would like to create a simple ActiveRecord model, but working without table... Is that possible? I think we can this a virtual model. And I would like to be able to use relations (like has_many :users, etc) with this model (named App for instance), such as: App.first.users Thanks for any ideas. -- 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] RubyZip Exceptions
Hi, I am wondering if there is a way of catching exceptions that are thrown within rubyzip.rb. For example: in rubyzip line 583, private def set_time(binaryDosDate, binaryDosTime) @time = Time.parse_binary_dos_format(binaryDosDate, binaryDosTime) rescue ArgumentError puts Invalid date/time in zip entry end I need to be able to 'catch' the exception thrown here, as my app needs to reject zip files that have invalid date/timestamps is there a way of doing this before/during opening the zip file? Thank you in advance -- 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: Inflect word depending on number
Rob Biedenharn wrote in post #957481: On Oct 27, 2010, at 8:35 AM, Vitaliy Yanchuk wrote: How can I use proper word after number, depending on that number. For example I have message that says: for 23 monthes, or it can be 21 month. So I have to inflect depending on number -- If you're in a Rails view, you can say: pluralize(n, 'month') [...] ...but you probably shouldn't if you're going to internationalize the application; different languages have different pluralization rules. Any good I18N library should have a generalized pluralization function (for example, there's n_ in fast_gettext). 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: rails version check for gems
yeah that works better. :-) How other gems are handling this. It looks like acts_as_ferret is only supporting Rails3 in 0.5 so no need for version checks there (unfortunately it isn't quite rails 3 ready yet). On Oct 27, 9:41 am, Tim Shaffer timshaf...@me.com wrote: On Oct 27, 9:09 am, Tony Primerano tony.primer...@gmail.com wrote: Seems like that would break something once Rails 4 comes out. ;-) Couldn't you do this? if Rails::VERSION::STRING.to_i = 3 puts at least rails 3 else puts rails 2 or lower end -- 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: Order by title but then put Other at the end?
On Oct 27, 9:09 am, Marnen Laibow-Koser li...@ruby-forum.com wrote: The easiest way would involve using a separate DB field, so that you can do ORDER BY title, put_at_end. Wouldn't that have to be ORDER BY put_at_end, title? (assuming put_at_end has a value of 0 or 1) -- 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: Order by title but then put Other at the end?
E. Litwin wrote in post #957563: On Oct 27, 9:09am, Marnen Laibow-Koser li...@ruby-forum.com wrote: The easiest way would involve using a separate DB field, so that you can do ORDER BY title, put_at_end. Wouldn't that have to be ORDER BY put_at_end, title? (assuming put_at_end has a value of 0 or 1) Yes, it would. Must think a little more before I type. :D 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: Virtual model
Satsou Sa wrote in post #957508: yong gu wrote in post #957495: If you are using rails 3, see this http://railscasts.com/episodes/219-active-model Thanks! But there is a problem with ActiveModel: I can not make associations such as belongs_to or has_many... Why do you need them on a virtual model? Just write your own method. belongs_to and has_many aren't really useful if there's no DB table, are they? What are you trying to achieve? 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] passenger for both rails 2.3 and 3.0
Hi, I installed ruby 1.8.7 and passenger 3.0 for apache2 on Ubuntu 10.10. Rails 2.3 works fine. But Rails 3.0 gives an error saying that rack version is not 1.2.1. If I upgrade the rack to 1.2.1, then rails 2.3 app complains that the rack version is not ~1.1.0. How do I satisfy both rails 2.3 and 3.0? Passenger standalone seems to be an option but I want to know if there's a better way. Thanks. Sam -- 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: passenger for both rails 2.3 and 3.0
hmmm... So you're using Rails 2.3 and 3.0 versions? Luis Saffie -- http://saffie.ca -- 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] Help with routes
Switching our routes file from Rails2 to Rails3 DSl uncovered an odd situation, of my own making, but I am having some difficultly imagining how to fix it. Basically I have a commonplace: user - user_role (clearance) - role type arrangement where: User has_many :roles, :through = :clearances has_many :clearances Clearance belongs_to :role belongs_to :user and Role has_many :users, :through = :clearances has_many :clearances What I am trying to do is to link through new_user_role_path(@user). But I get the following error when I try: ActionController::RoutingError: No route matches {:action=new, :controller=user_roles} The thing is that when I run rake routes I see this: new_user_role GET/users/:user_id/role/new(.:format) {:controller=user_roles, :action=new} So, I am somewhat nonplussed as to what is going on. I probably am misunderstanding something basic but from my point of view it seems that the route that is shown as missing is actually there. Is there something else I am overlooking? -- 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 use rails_upgrade plugin on Windows due to missing fork() function
Hi daze, I’m trying the same without a solution yet. Did you make any progress? Kind regards Marc -- 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: Order by title but then put Other at the end?
I solved this in an application by creating a separate sort_name field that was strictly used for sorting. Never seen or used by the user at all. We had a before_save :build_sort_name method that handled all sorts of cases. Wouldn't be too hard to add something similar for your scenario. def build_sort_name sort_name = name.gsub(/^(The )(.*)/, '\2, \1') # change The Title to Title, The sort_name = ZZ Other if name = 'Other' # force 'Other' to sort after everything else end -- 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: Cygwin Rails issues /dev/urandom not found
The files in /dev don't exist by default under cygwin. Instead cygwin internally handles reading and writing to them specially. See http://www.cygwin.com/cygwin-ug-net/using-specialnames.html for more info. There is also a script to create the dev files. -- 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: passenger for both rails 2.3 and 3.0
Sam Kong wrote in post #957571: Hi, I installed ruby 1.8.7 and passenger 3.0 for apache2 on Ubuntu 10.10. Rails 2.3 works fine. But Rails 3.0 gives an error saying that rack version is not 1.2.1. If I upgrade the rack to 1.2.1, then rails 2.3 app complains that the rack version is not ~1.1.0. How do I satisfy both rails 2.3 and 3.0? Passenger standalone seems to be an option but I want to know if there's a better way. As long as you're using the same Ruby for both 2.3 and 3.0, you shouldn't need Passenger standalone, if I understand correctly. Just use regular Passenger and RVM. Thanks. Sam 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] Update password with Devise
I've been googling a lot about it and can't find the solution. I have a form to edit a user, but I need to two fields to update or change their password: New Password / Confirm Password fiels. I know you can reset your password by clicking the Forgot My Password link. But I want them to be able to login to their account profile and change their password while logged in. How can I do that? I'm thinking about hacking the Forgot My Password form, haha, I'll see if I can make it work like that. -- 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] Missing partial layouts/application error on render :partial = index, :layout = application - Rails3
This is the second time I have seen this error, and been googling around and cant find an explanation. This error is happening with Rails 3/1.9.2 and was not with Rails 2.3.8/1.8.7: *Template is missing Missing partial layouts/application with {:handlers=[:erb, :rjs, :builder, :rhtml, :rxml], :formats=[:html], :locale=[:en, :en]} in view paths /Users/DK/Documents/ror/projects/creditcompare3/app/views* This is the controller code below, and yes, I have verified that the layout application.html.erb exists. What I don't understand is why it seems that Rails is demanding that the layout be a partial. I did try changing the application layout to a partial, and then in this case the page loads without the above error. But on normal non-partial renders, then of course I loose the application template. Makes no sense to have both application.html.erb and a partial _application.html.erb but this seems to be the only way I have found to hack around this error. Is there a new syntax I should be using instead? respond_to do |format| format.html { render :partial = index, :layout = application } end Thanks much, David -- 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] [Startup] Java Backend and Rails Frontend
I have a startup considering building a Java backend and a Rails frontend. The Java backend will take care of creating a caching layer for the database and offer other additional services. The Rails frontend will mostly be for creating the webapp and monitoring tools. What startups/companies out there are using this kind of setup? What are some gotchas in terms of development speed, deployment, scalability, and integration? (What would be helpful for me is personal experience or informal case studies. I'd like to de-priorities answers addressing alternatives like Grails or JRuby unless it turns out to be a big part of the equation) Thanks! P.S. I cross posted this on http://stackoverflow.com/questions/4035999/startup-java-backend-and-rails-frontend. My intention here though is to capture a different audience and get more of the story on the Rails side -- which is the side I'm personally working on. -- 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] Action Caching with memcached with config.cache_classes = true in development.rb/production.rb not working in Rails 2.1
When I put config.cache_classes = true in development.rb/ production.rb, index action is not cached in memcache stor, rather local cache store is used. On putting config.cache_classes = false , action caching is working fine. In production we want config.cache_classes = true, but then caching is not working. Secondly, config.cache_store = :memcache in development.rb/ production.rb is also not working. I have to use ActionController::Base.cache_store = :mem_cache_store, 'hostname: 11211' in application.rb to make it work. I am using Rails 2.1. Any help would be highly appreciated. Thanks Ankit -- 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: Update password with Devise
I just found a page that is already built on Devise but it redirects me to the root when I try to access it. Is there a reason for this? The user that is trying to access that page has can :manage, :all -- 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: Update password with Devise
This is the page http://localhost:3000/users/password/edit When I'm NOT logged in I can see it, but when IM LOGGED in it redirects me. weird -- 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: Update password with Devise
Try typing rake routes in your project folder (in Terminal). You should see all the various routes explained for you. Depending on the combination of modules you have enabled in Devise, this route users/ password/edit may mean something specific. See which controller and which action it is hitting in that controller. This may be the page you see when confirming your account, and you never see it again. You can certainly change your password under Devise, but you may need to add a users_controller of your own to access that. Walter On Oct 27, 2010, at 4:24 PM, Leonel *.* wrote: This is the page http://localhost:3000/users/password/edit When I'm NOT logged in I can see it, but when IM LOGGED in it redirects me. weird -- 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: Create super-simple adding application
Thank you guys so much for your help. I think I have everything working now. It must be frustrating dealing with such simple issues. Just one more question: Did you intend to put the - in %= form_tag('/') do -% ? I removed it and it didn't seem to change anything. Thanks again for the help. On Oct 27, 1:30 am, Eric R. li...@ruby-forum.com wrote: Frederick Cheung wrote in post #957392: On Oct 26, 10:48pm, debalmoto debalm...@gmail.com wrote: p %= text_field_tag(:number_one, value = 0) % %= text_field_tag(:number_two, value = 0) % /p p %= @sum % /p That's all of it. Time for HTML lesson 1: if you want inputs to get sent to the server, they need to be enclosed in a form (modulo javascript trickery). Fred Exactly. So you may want to change the view code to look like this: %= form_tag('/') do -% p %= text_field_tag(:number_one, value = 0) % %= text_field_tag(:number_two, value = 0) % %= submit_tag 'Calculate' % /p % end % p %= @sum % /p -- 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] Does Ruby 1.9.2 include ftools?
If I run irb, and do this: require 'ftools' The response is: LoadError: no such file to load -- ftools I see around that 1.9.1 did not include ftools but no mention of 1.9.2. Looking at the Ruby docs (http://www.ruby-doc.org/stdlib/), ftools is still there. Any ideas? Thanks, David -- 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: Does Ruby 1.9.2 include ftools? SOLVED
Just found: ftools is depricated and changed to fileutils. On Oct 27, 4:28 pm, David Kahn d...@structuralartistry.com wrote: If I run irb, and do this: require 'ftools' The response is: LoadError: no such file to load -- ftools I see around that 1.9.1 did not include ftools but no mention of 1.9.2. Looking at the Ruby docs (http://www.ruby-doc.org/stdlib/), ftools is still there. Any ideas? Thanks, David -- 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] PostgreSql SELECT DISTINCT and ORDER BY returns an error
Hello, Given: - a Dealer model and controller - index page with a search form on top and results shown below Problem: I'd like to select dealers based on keyword, status and program then order them by name/launched_at asc/desc. The query joins in other tables that are needed to perform the 'by keyword' part of the search, so I get this error: PGError: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list : SELECT DISTINCT dealers.* FROM dealers LEFT OUTER JOIN contacts ON (contacts.contactable_id = dealers.id) LEFT OUTER JOIN w9_tax_forms ON (w9_tax_forms.dealer_id = dealers.id) WHERE (LOWER(dealers.name) LIKE '%dino%' or LOWER(contacts.email) LIKE '%dino%' or dealers.tax_id_code LIKE '%dino%' or w9_tax_forms.tax_id_code LIKE '%dino%') ORDER BY LOWER(dealers.name) asc LIMIT 10 OFFSET 0 -- dealers_controller.rb @dealers = Dealer.search(search_filters) # params dealer.rb search = account.dealer_search_base # returns Dealer.scoped({}) in this case search = search.with_keyword(keyword) search = search.with_status(options[:status_id]) search = search.by_program(options[:program_id]) search = search.order(options[:sort], options[:direction]) paginate ? search.paginate(:page = page, :per_page = 10) : search.all scopes.rb named_scope :with_status, lambda { |status_id| logger.debug(..with_status(#{status_id.to_i 0})); (status_id status_id.to_i 0) ? {:conditions = { :status_id = status_id } } : {} } named_scope :with_keyword, lambda { |k| k.present? ? { :conditions = ['LOWER(dealers.name) LIKE ? or LOWER(contacts.email) LIKE ? or dealers.tax_id_code LIKE ? or w9_tax_forms.tax_id_code LIKE ?', %#{k.downcase}%, %#{k.downcase}%, %#{k}%, %#{k}% ], :joins = LEFT OUTER JOIN contacts ON (contacts.contactable_id = dealers.id) LEFT OUTER JOIN w9_tax_forms ON (w9_tax_forms.dealer_id = dealers.id), :select = DISTINCT dealers.* } : {} } named_scope :by_program, lambda { |program_id| program_id.present? ? { :conditions = 'dealers.program_id = ?', program_id] } : {} } named_scope :order, lambda {|sort, direction| {:order = LOWER(dealers.#{sort}) #{direction}, dealers.status_id #{direction}, dealers.established #{direction}} } - The problem is that PostgreSql requires the SELECT DISTINCT clause to be followed by the ORDER BY criteria, so it needs to be inserted before the joins take action. I don't know how to do this, if even possible. Currently using Rails -v 2.3.8 and postgres (0.7.9.2008.01.28) gem. Suggestions or ideas anyone? -- 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] connecting to exchange server
I have a public website accessible from the intranet and i have to send mail to the inside and outside but the thing is when i try to send mails with postfix apparently the exchange server wont accept those so i cant send mails to the inside, now im trying to send with the exchange server but i cant authenticate. 1) is there a better solution with postfix? 2) if not, how do i configure actionmailer to work with exchange server. -- 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] Problems with the views.
Greetings, I have an app running on RoR, this app is of ultra-basic style (http://www.hackerdude.com/courses/rails/PrimeraAplicacion.html), this app works as it in the example, but I can not run the views, in the folder \views, I have \layout and \Main, with their corresponding files (.html.erb). The problem is that I want to edit the page (html), but do not know which I will edited to work, I edited, (principal.html.erb and application.html.erb) and does not work, I need help please, 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] connecting to exchange server
On Oct 27, 2010, at 6:10 PM, radhames brito wrote: I have a public website accessible from the intranet and i have to send mail to the inside and outside but the thing is when i try to send mails with postfix apparently the exchange server wont accept those so i cant send mails to the inside, now im trying to send with the exchange server but i cant authenticate. 1) is there a better solution with postfix? 2) if not, how do i configure actionmailer to work with exchange server. I don't think the issue is specifically postfix. On a couple of different servers, I have gotten Exchange to act as if it was a mail server by adding an MX record for the Web server, set to such a low priority that it won't ever see the light of incoming mail. In one other case, the Exchange admin was able to set a preference somewhere that told it to accept mail from the Web server. The underlying issue in all three cases was that the Exchange server didn't believe that any other machine would be sending mail from its domain, so it denied it. 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] Problems with the views.
Wich version of Ruby and Rails do u use now? On Thu, Oct 28, 2010 at 12:15 AM, Blue Skull li...@ruby-forum.com wrote: Greetings, I have an app running on RoR, this app is of ultra-basic style (http://www.hackerdude.com/courses/rails/PrimeraAplicacion.html), this app works as it in the example, but I can not run the views, in the folder \views, I have \layout and \Main, with their corresponding files (.html.erb). The problem is that I want to edit the page (html), but do not know which I will edited to work, I edited, (principal.html.erb and application.html.erb) and does not work, I need help please, 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. -- http://www.rodolinux.com.ar I must not fear. Fear is the mind-killer. I will face my fear. I will permit it to pass over me and through me. And when it has gone past I will turn the inner eye to see its path. Where the fear has gone there will be nothing. Only I will remain. - Bene Geserit's Fear Lethany - Dune Trilogy - Frank Herbert -- 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: Problems with the views.
Greetings, dear, thanks for answering, my versions. C:\ruby -v ruby 1.9.2p0 (2010-08-18) [i386-mingw32] C:\gem -v 1.3.7 C:\rails -v Rails 3.0.0 -- 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] PostgreSql SELECT DISTINCT and ORDER BY returns an error
On Oct 27, 2010, at 2:48 PM, Gabi Ge wrote: Hello, Given: - a Dealer model and controller - index page with a search form on top and results shown below Problem: I'd like to select dealers based on keyword, status and program then order them by name/launched_at asc/desc. The query joins in other tables that are needed to perform the 'by keyword' part of the search, so I get this error: PGError: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list : SELECT DISTINCT dealers.* FROM dealers LEFT OUTER JOIN contacts ON (contacts.contactable_id = dealers.id) LEFT OUTER JOIN w9_tax_forms ON (w9_tax_forms.dealer_id = dealers.id) WHERE (LOWER(dealers.name) LIKE '%dino%' or LOWER(contacts.email) LIKE '%dino%' or dealers.tax_id_code LIKE '%dino%' or w9_tax_forms.tax_id_code LIKE '%dino%') ORDER BY LOWER(dealers.name) asc LIMIT 10 OFFSET 0 -- dealers_controller.rb @dealers = Dealer.search(search_filters) # params dealer.rb search = account.dealer_search_base # returns Dealer.scoped({}) in this case search = search.with_keyword(keyword) search = search.with_status(options[:status_id]) search = search.by_program(options[:program_id]) search = search.order(options[:sort], options[:direction]) paginate ? search.paginate(:page = page, :per_page = 10) : search.all scopes.rb named_scope :with_status, lambda { |status_id| logger.debug(..with_status(#{status_id.to_i 0})); (status_id status_id.to_i 0) ? {:conditions = { :status_id = status_id } } : {} } named_scope :with_keyword, lambda { |k| k.present? ? { :conditions = ['LOWER(dealers.name) LIKE ? or LOWER(contacts.email) LIKE ? or dealers.tax_id_code LIKE ? or w9_tax_forms.tax_id_code LIKE ?', %#{k.downcase}%, %#{k.downcase}%, %#{k}%, %#{k}% ], :joins = LEFT OUTER JOIN contacts ON (contacts.contactable_id = dealers.id) LEFT OUTER JOIN w9_tax_forms ON (w9_tax_forms.dealer_id = dealers.id), :select = DISTINCT dealers.* } : {} } named_scope :by_program, lambda { |program_id| program_id.present? ? { :conditions = 'dealers.program_id = ?', program_id] } : {} } named_scope :order, lambda {|sort, direction| {:order = LOWER(dealers.#{sort}) #{direction}, dealers.status_id #{direction}, dealers.established #{direction}} } - The problem is that PostgreSql requires the SELECT DISTINCT clause to be followed by the ORDER BY criteria, so it needs to be inserted before the joins take action. I don't know how to do this, if even possible. Currently using Rails -v 2.3.8 and postgres (0.7.9.2008.01.28) gem. Suggestions or ideas anyone? I think you're reading the error message wrong... You're query (trimmed down to relevant bits) is: SELECT DISTINCT dealers.* FROM dealers...ORDER BY LOWER(dealers.name) asc PostgreSQL is complaining because you are ordering by a column that is NOT in your SELECT... so... change it to: SELECT DISTINCT(dealers.*, LOWER(dealers.name)) FROM dealers...ORDER BY LOWER(dealers.name) asc Or... SELECT DISTINCT dealers.* FROM dealers...ORDER BY dealers.name asc Also... with all those LOWER() queries going to lose a lot of performance unless you've got functional indexes setup. And if you're going to do that (ie. get postgresql specific), why not replace LIKE with ILIKE and drop all the LOWER() bits entirely? Just something to consider... -philip -- 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] trouble testing callbacks on update to model with nested attributes
Hi, I have a parent model like this: class Parent ActiveRecord::Base belongs_to :grand_parent has_many :blond_children, :dependent = :destroy has_many :brunette_children, :dependent = :destroy has_many :dogs, :dependent = :destroy accepts_nested_attributes_for :blond_children, :brunette_children, :dogs, :allow_destroy = true ... end I can't seem to get the attributes of the children to change with attempts like the following parent_instance.blond_children_attributes = {1={:_destroy=true}, 2={:_destroy=true}} parent_instance.save parent_instance.reload.blond_children.should == some new number reflecting deletion I've also tried this with hashes and using #update_attributes on the parent_instance. I keep experimenting, but I can't get expected results. I'm wondering if maybe the problems are: 1) on an update, all children and their attributes need to be explicitly mentioned, even if the value is 2) where should the parent and child ids appear in any attempts to update child attributes? I might guess some readers have banged their head on something like this in the past, any pointers? Thanks, Lille -- 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] validation on subdomain unique
Using Devise on an application with basecamp like subdomains. You can only register(sign_up) if the account(subdomain) you are creating is unique. You can only register(sign_up) from the root domain. account_name is attr_accessor :account_name in user record and is created when the user is created (before_create) Can't use validates_uniqueness_of :subdomain_name because it is not part of the record. Creates winny_nil error I can test it in my create_account method and return false if it is not unique, but no feedback. I tried validates_uniqueness_of :account_name, :on = :create, :if = :check_unique, :message = Name must be unique And returning false does nothing. Without going into javascript, how can I validate this in the user record? I realize this my be a little complicated for this list (and short), but though I'd give it a try. -- 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: Using ActiveRecord 3.0.x with Ruby 1.9.2
I tried this too, but when I put it in an .rb file, I get the error above. -- 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] Using Rails Objects in js file
Hey guys, This seems pretty simple, but I cannot seem to find an answer online. I have a user model and would like to use a user object in the js file. Any ideas as to how I can do this? Thanks and Regards. -- 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.