[Rails] Re: POST and GET
To add, in relation to a GET request, there is a limit of number of characters that a url can be made of. http://stackoverflow.com/questions/1496080/limitation-of-url Cheers Gordon Yeong :) -- 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: uninitialized constant User::Authentication
Daniel X Moore wrote: I had the same problem, but restarting script/server fixed it. same to me -- 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 RAILSSTILL LEARNING
Hi Rich, You're perfectly rigth with mint, since it's 100% based on ubuntu, all ubuntu recipes will work with mint. that being said, sounds to me that you need to create the sqlite database instance that is related to your project an important step in your rails learning will be to learn to find and understand the log files. the error message you have in your browser is for the end users more explicit and detailed informations are located in the RAILS_PROJECT/log/development.log file you can edit it with gedit, or use the following command lines : more development.log : see the whole file, step by step cat development.log : go directly at the end of the file maybe you can find your error int this log file and paste it here so we can help you to fix the problem :) On 2 août, 02:45, Rich d elevenb4...@gmail.com wrote: Fidel, Thanks for your reply. I am using Linux Mint. does that sound right? I dont know how to look up what linux distribution I have installed. Also I typed in sqlite3 in my terminal and i got back SQLite version 3.6.16. How do I install sqlite3 development libraries? On Aug 1, 5:03 pm, Fidel Viegas fidel.vie...@gmail.com wrote: Hi Rich, It would help if you told us which Linux distribution you are using. But in order to use Sqlite with Ruby on Rails, you need version Sqlite 3. You should also install the Sqlite3 development libraries for your Linux distribution. You shouldn't also forget to install the development tools so that your gems can be compiled against the development libraries. Finally, you should install the sqlite3-ruby gem with the command [sudo] gem install sqlite3-ruby. You can search Google on how to setup Rails on your Linux distribution, and if you do find some issues, then come back to us telling us which Linux distribution you are using and the problems you are facing. Regards, Fidel. On 8/1/10, Rich d elevenb4...@gmail.com wrote: I am running windows vista on my lap top. I installed virtual box and virtual rails on this laptop and it is running linux. I am very new at learning rails. So far the only thing I have done is create a blog application by typing in: mkdir rails_projects cd rails_projects rails first_app so now im at the point where I am typing the following: 1. rails blog 2. cd blog 3. script server after this I go to my web server and type in localhost/3000, after doing this I click the link that says about your applications environment. When I click this I get an error message saying we're sorry, but something went wrong Is this because I dont have a data base running like SQlite? I typed sqlite into the terminal and it tells me what version I have so Im assuming that its installed. Where do I go from here? Im very much a novice at this point and any feedback would be appreciated. -- 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: RC routing error that was not in Beta4
Is rails talk not the best spot to ask questions these days? -- 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 RAILSSTILL LEARNING
On 1 August 2010 23:32, Rich d elevenb4...@gmail.com wrote: Where do I go from here? Im very much a novice at this point and any feedback would be appreciated. You have not created a DB or configured your application to use one (Sqlite is installed, as you're using the VirtuaRails VM). Continue following the tutorials. There are loads of resources (from the Agile Web Development with Rails book, to the RailsGuides at http://guides.rubyonrails.org/ and more). They take you through step-by-step, and if you get stuck at any point, you can point us the the page/url and we can see exactly what you were supposed to be trying. -- 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: RC routing error that was not in Beta4
On 2 August 2010 08:44, rails.n...@gmail.com rails.n...@gmail.com wrote: Is rails talk not the best spot to ask questions these days? You post what is a quite obscure edge question on a Sunday afternoon, and get stressed that it's not answered by Monday morning? Looking at your question, it *might* be better placed on the rails-core forum, as that's where the core development issues are dealt with - and they'll point you at how to log a ticket if that's the best course of action for you. -- 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] Admin interface for Rails?
It's a generator, but it comes up with quite nice 37 Signals style admin interfaces. http://github.com/andyjeffries/andy_admin Cheers, Andy -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 1 August 2010 06:03, rodrigo3n rodrig...@gmail.com wrote: Hello folks, I am currently working on a project that has to deliver an admin interface like the Django's one, I wanna know if you know/ recommend any gem or plugin for that. Cheers, Rodrigo Alves Vieira -- 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: gem install mygem does not install the gem
On Aug 2, 2:06 am, CUBRID kadish...@gmail.com wrote: Thank you! I will post to the rubygems gorup. But, if you might have time to explain me which specification exactly should be set, I would be very glad for your help! What I understand from what you've said is the s.platform = Gem::Platform::RUBY specification. If, so, this is exactly what I did, i.e. set it to Native Ruby. No, that's not what you need, see http://docs.rubygems.org/read/chapter/20#extensions You might also want ot look at an existing gem that contains a native library and see what it does Fred Anyway, thank you for you help! Esen. On Jul 30, 6:53 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Jul 30, 10:19 am, CUBRID kadish...@gmail.com wrote: Hi, I am encountering an odd behavior of gem install function. Can anyone explain me what gem install actually does? I have several C code and header files, and one extconf.rb file, + mygem.gemspec file. So, when I build a gem it successfully creates mygem-0.61.gem. So, when I install it locally using gem install mygem-0.61.gem I expect the gem to create a makefile, because in the extconf.rb file I explicitly indicate it, and then make install that newly created Makefile. However, gem install' does not create a Makefile and does not install it. What it does is just copies those several files to the gem directory, where Gem keeps all its gems. What I have to do is manually rub ruby extconf.rb, which creates the Makefile, and manually make install. The questions is: Should not gem install perform all these operation by itself, when I type gem install mygem? You need to indicate in your gemspec that there is a native library to build. You might get more answers on one of the main ruby lists as this isn't really a rails question. Fred -- 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: handle exception in ajax call
On Aug 2, 4:12 am, Guo Yangguang li...@ruby-forum.com wrote: I tested using non-ajax call,but the problem was same,the exception was not handled like the attachment and new_variant template was not rendered as expected.The render should not be used in the rescue block? can you help me? You're rescuing the exception but then you're re-raising it so your render call never happens. Also a more usual way is to call save and test the return value of that rather than call save! and rescue the exception Fred -- 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] require gems messing up rails install?
I have a strange issue. My rails environment is fully functional with enterprise ruby, rails 2.3.5, running on passenger in production. In my .irbrc I am trying to include wirble gem for auto completion and coloring so I add the following lines and install wirble. As soon as I do that, it messes up my rails install and throws an error saying rails gem is not installed, though it's. If I uninstall wirble and leave these lines in .irbrc the problem goes away. I am guesing it has something to do with the 'require rubygems', but this is not a problem in my development environment. I have the same .irbrc, the only difference is my dev environment runs regular ruby 1.8.7 not enterprise ruby require 'irb/completion' IRB.conf[:PROMPT_MODE] = :SIMPLE require 'rubygems' #require 'RMagick' require 'wirble' if ENV['RAILS_ENV'] require 'rubygems' require 'hirb' require 'active_record' Hirb.enable ActiveRecord::Base.logger = Logger.new(STDOUT) end Any ideas? 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: simple redirect_to shows in log but doesn't redirect
On Aug 2, 12:53 am, Neil Bye li...@ruby-forum.com wrote: I didn't really want the whole page refresh I was only using it coz the rjs wasn't working. I want the .rjs coz I want comments to go straight up with no refresh. Are you saying I should make a line page.redirect_to story_path(@story), :controller = 'stories' If you want a redirect from rjs that is how you do it (the :controller bit isn't needed). That will do a full page refresh do. Fred -- 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: require gems messing up rails install?
Here is the exact error. Missing the Rails 2.3.5 gem. Please `gem install -v=2.3.5 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed Rails is installed! x...@server:/var/www/myapp/current$ rails --version Rails 2.3.5 On Aug 2, 1:52 am, badnaam asitkmis...@gmail.com wrote: I have a strange issue. My rails environment is fully functional with enterprise ruby, rails 2.3.5, running on passenger in production. In my .irbrc I am trying to include wirble gem for auto completion and coloring so I add the following lines and install wirble. As soon as I do that, it messes up my rails install and throws an error saying rails gem is not installed, though it's. If I uninstall wirble and leave these lines in .irbrc the problem goes away. I am guesing it has something to do with the 'require rubygems', but this is not a problem in my development environment. I have the same .irbrc, the only difference is my dev environment runs regular ruby 1.8.7 not enterprise ruby require 'irb/completion' IRB.conf[:PROMPT_MODE] = :SIMPLE require 'rubygems' #require 'RMagick' require 'wirble' if ENV['RAILS_ENV'] require 'rubygems' require 'hirb' require 'active_record' Hirb.enable ActiveRecord::Base.logger = Logger.new(STDOUT) end Any ideas? 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: radio box validation
Dis Tec wrote: I have created some radio boxes as follows: % f.radio_button :usertype, false %False % f.radio_button :usertype, true %True where usertpe is a boolean in the db I want to be able to create a default selection and I want to validate the options and ensure that for whatever reason there is always a check in one of the boxes...now I know a proper radio box config will always have one option selected. How do I validate? For example validates_prescence_of: usertype? Any ideas how to do this? -- 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] Rails Strives For DRY. A Lot of REST Routes, Not So DRY.
Most in the Rails community seem stick with 1 controller per resource when using RESTfull routes. This makes sense for a resource with one scope and one view, but once a resource is used with multiple scopes and/or views the amount of code duplication needed to manage these in a single controller can balloon quick. Yet despite the impending chaos, it seems as though people prefer to maintain a controller per resource. Take these examples from Rails sites written by well respected authors: 1. http://tinyurl.com/2d9rl3v find_container() and find_events(): why would one want to do this? This can become unmanageable. If each of these scopes require different view components the same checks will have to be done in the action's view or when determining the layout. 2. http://tinyurl.com/2679ye3 Look at how many times wall? and blog? have to be called. Not very DRY if you ask me. Rail's routing gives you these checks for free, why not create a WallCommentsController and BlogCommentsController? If differing views are involved for each of these it seems like a no brainer... but it's never done. Why? What am I missing? -- 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: gem install mygem does not install the gem
Actually I had that line before. Then I removed it when I build a gem for win32 as I didn't need to build anything. Then forgot to paste back. Thank you, Fred, for the notice. On Aug 2, 5:30 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Aug 2, 2:06 am,CUBRIDkadish...@gmail.com wrote: Thank you! I will post to the rubygems gorup. But, if you might have time to explain me which specification exactly should be set, I would be very glad for your help! What I understand from what you've said is the s.platform = Gem::Platform::RUBY specification. If, so, this is exactly what I did, i.e. set it to Native Ruby. No, that's not what you need, seehttp://docs.rubygems.org/read/chapter/20#extensions You might also want ot look at an existing gem that contains a native library and see what it does Fred Anyway, thank you for you help! Esen. On Jul 30, 6:53 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Jul 30, 10:19 am,CUBRIDkadish...@gmail.com wrote: Hi, I am encountering an odd behavior of gem install function. Can anyone explain me what gem install actually does? I have several C code and header files, and one extconf.rb file, + mygem.gemspec file. So, when I build a gem it successfully creates mygem-0.61.gem. So, when I install it locally using gem install mygem-0.61.gem I expect the gem to create a makefile, because in the extconf.rb file I explicitly indicate it, and then make install that newly created Makefile. However, gem install' does not create a Makefile and does not install it. What it does is just copies those several files to the gem directory, where Gem keeps all its gems. What I have to do is manually rub ruby extconf.rb, which creates the Makefile, and manually make install. The questions is: Should not gem install perform all these operation by itself, when I type gem install mygem? You need to indicate in your gemspec that there is a native library to build. You might get more answers on one of the main ruby lists as this isn't really a rails question. Fred -- 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: authlogic and controlling the resources users can access
Is this approach sound? -- 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: simple redirect_to shows in log but doesn't redirect
If you want a redirect from rjs that is how you do it (the :controller bit isn't needed). That will do a full page refresh do. Fred The trouble is that it's not even getting to the .rjs. That has been my problem all along. When I click the 'cmment button I get Comment Create (0.4ms) INSERT INTO comments (created_at, body, updated_at, story_id) VALUES('2010-08-02 09:47:22', 'dog', '2010-08-02 09:47:22', 1) ActionView::MissingTemplate (Missing template comments/create.erb in view path app/views): app/controllers/comments_controller.rb:12:in `create' This is comments/controller create def create @story = Story.find(params[:story_id]) @story.comments.create params[:comment] respond_to do |format| format.js end 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.
[Rails] Re: simple redirect_to shows in log but doesn't redirect
On Aug 2, 10:51 am, Neil Bye li...@ruby-forum.com wrote: If you want a redirect from rjs that is how you do it (the :controller bit isn't needed). That will do a full page refresh do. Fred The trouble is that it's not even getting to the .rjs. That has been my problem all along. When I click the 'cmment button I get If all you've got is a .rjs file you don't need the respond_to block at alll Fred -- 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: How to test DELETE :destroy with Shoulda
The problem is that when running the app with Mongrel I get a correct 302 but when testing the answer is htmlbodyYou are being a href=http://test.host/ configurationsredirected/a./body/html I am using Rails 2.3.8 I do not think that is correct, it seems a bug. Any reply at all? On 30 July, 17:22, rtacconi rtacc...@gmail.com wrote: Hi, I tried to find some help in Shoulda list without a positive result. I am able to test DELETE :destroy with Test::Unit but I cannot with Shoulda because instead of a 302 (redirect) I get 200. Do you have a basic and simple example on how to test the delete part of the CRUD? 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: simple redirect_to shows in log but doesn't redirect
�The trouble is that it's not even getting to the .rjs. That has been my problem all along. When I click the 'cmment button I get If all you've got is a .rjs file you don't need the respond_to block at alll Fred I do need the .rjs to do the page.html_replace I,ve benn tring to do all along. I just can't get to create.rjs Here it is page.replace_html 'aremark', partial = 'comment' page.redirect_to story_path(@story), :controller = 'stories' page.visual_effect :highlight, 'list', :duration = 3 Its in app/views/story that's right isn't it? -- 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] dynamic select(so annoying)
Hi, guys, I am a rookie in rails, I'd like to make two dynamic selects connecting with the database: in select 1 I have some countries(US,CA,UK) and I already built a table in my database called food: id food_name food_country the items of select 1 are retrieved from table when selecting a particular item in select 1, select 2 could dynamically change the items it contained(for example, US = 'hamburger', 'chips',.) furthermore, the two selects are part of one form, when it's submitted, something else like a table or chart will be showed besides the form. I have already read some materials but still struggling in countless trials, I am frustrated by the concepts of render and collect_select(I know little about ajax) and actions interacted in the process, would you like to give me a detailed explanation of the structure to meet with my requirement? Thank you 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.
[Rails] Re: simple redirect_to shows in log but doesn't redirect
On Aug 2, 11:25 am, Neil Bye li...@ruby-forum.com wrote: I do need the .rjs to do the page.html_replace I,ve benn tring to do all along. I just can't get to create.rjs Here it is page.replace_html 'aremark', partial = 'comment' page.redirect_to story_path(@story), :controller = 'stories' page.visual_effect :highlight, 'list', :duration = 3 Its in app/views/story that's right isn't it? Your log files say this is happening in your comments controller so it should be in app/views/comments. Fred -- 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] `require_frameworks': no such file to load -- openssl (RuntimeError)
I got this error:`require_frameworks': no such file to load -- openssl (RuntimeError) My OS is Fedora Core 13 I installed openssl, try compile extconf.rb,but this not help. If i compile extconf.rb, i got this error: [r...@localhost openssl]# ruby extconf.rb === OpenSSL for Ruby configurator === === Checking for system dependent stuff... === checking for t_open() in -lnsl... no checking for socket() in -lsocket... no checking for assert.h... yes === Checking for required stuff... === checking for openssl/ssl.h... no === Checking for required stuff failed. === Makefile wasn't created. Fix the errors above. [r...@localhost openssl]# -- 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] `require_frameworks': no such file to load -- openssl (RuntimeError)
On 02 Aug 2010, at 13:01, Adam wrote: I got this error:`require_frameworks': no such file to load -- openssl (RuntimeError) My OS is Fedora Core 13 I installed openssl, try compile extconf.rb,but this not help. If i compile extconf.rb, i got this error: [r...@localhost openssl]# ruby extconf.rb === OpenSSL for Ruby configurator === === Checking for system dependent stuff... === checking for t_open() in -lnsl... no checking for socket() in -lsocket... no checking for assert.h... yes === Checking for required stuff... === checking for openssl/ssl.h... no === Checking for required stuff failed. === Makefile wasn't created. Fix the errors above. [r...@localhost openssl]# On a Debian based system, you would install the openssl-ruby package using sudo apt-get install libopenssl-ruby1.8. Yum on Fedora should have a similar library somewhere. 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: simple redirect_to shows in log but doesn't redirect
Your log files say this is happening in your comments controller so it should be in app/views/comments. Fred There is a copy in app/views/comments. I've attached show.html.erb in case there is something I missed. The link_to, which is there as a test, works. This is how the comment function looks now. def create @story = Story.find(params[:story_id]) @story.comments.create params[:comment] respond_to do |format| format.rjs end end Is there anything else I could send that might solve this? Attachments: http://www.ruby-forum.com/attachment/4898/show.html.erb -- 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: handle exception in ajax call
You're rescuing the exception but then you're re-raising it so your render call never happens. Also a more usual way is to call save and test the return value of that rather than call save! and rescue the exception Thanks fred.But i want transaction(which need save!) to let them all either to be saved or not.If i rescue the exception and not re-raising it,is it right to handle exception in this way? -- 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] Admin interface for Rails?
Check out Francis Hwang's admin_assistant -- I have used and happy with: http://github.com/fhwang/admin_assistant On Mon, Aug 2, 2010 at 4:18 AM, Andy Jeffries a...@andyjeffries.co.ukwrote: It's a generator, but it comes up with quite nice 37 Signals style admin interfaces. http://github.com/andyjeffries/andy_admin Cheers, Andy -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 1 August 2010 06:03, rodrigo3n rodrig...@gmail.com wrote: Hello folks, I am currently working on a project that has to deliver an admin interface like the Django's one, I wanna know if you know/ recommend any gem or plugin for that. Cheers, Rodrigo Alves Vieira -- 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.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: simple redirect_to shows in log but doesn't redirect
On Aug 2, 12:52 pm, Neil Bye li...@ruby-forum.com wrote: Your log files say this is happening in your comments controller so it should be in app/views/comments. Fred There is a copy in app/views/comments. I've attached show.html.erb in case there is something I missed. The link_to, which is there as a test, works. This is how the comment function looks now. def create @story = Story.find(params[:story_id]) @story.comments.create params[:comment] respond_to do |format| format.rjs end end Is there anything else I could send that might solve this? The respond_to is unnecessary if you're only ever going to be using the rjs template for this action Fred Attachments:http://www.ruby-forum.com/attachment/4898/show.html.erb -- 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: handle exception in ajax call
On Aug 2, 1:11 pm, Guo Yangguang li...@ruby-forum.com wrote: You're rescuing the exception but then you're re-raising it so your render call never happens. Also a more usual way is to call save and test the return value of that rather than call save! and rescue the exception Thanks fred.But i want transaction(which need save!) to let them all either to be saved or not.If i rescue the exception and not re-raising it,is it right to handle exception in this way? in that case you should rescue the exception outside of the transaction Fred -- 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: The Future OF RUBY and RUBY ON RAILS
Musdev Musdev wrote: DO you guys see Ruby and Ruby on Rails sticking around for a while? and do you see an increase in demand for ruby/ruby on rails developers? This question comes up a lot, and speaking for myself I get sort of tired of answering it. Besides, it's a pointless question that nobody can really answer. None of us knows the future. A much better question is whether Ruby on Rails fits your project needs, and is it an environment that makes you happy as a developer. Only you can answer those questions. -- 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] How to monitor Cron jobs?
Hi guys, I understand how to monitor long running processes with monit or god, but I don't understand how to monitor Cron jobs (for memory bloating notably) since such processes - always have different PIDs when they start - are precisely supposed to stop when they are done, then restart when asked (vs running all the time). I have been looking on the web for a while, but didn't find any simple way. Is there a recommended basic strategy to monitor Cron jobs? Thanks! Pierre -- 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] Average Memory A Normal Ruby On Rails Site Consumes
Hi Guys...!! I wanted to know how much, average CPU memory a normal ruby on rails site consumes. I have a site on ruby on rails, hosted on a VPS Server, which is consuming a heavy CPU memory usage, due to which my other sites are getting affected and site is too slow. The log I have got is: CPU% 1809 root 16 0 95272 88m 3092 R43.3 3.2 2:43.26 ruby-bin 30666 mysql 18 0 375m 132m 4676 S90.4 4.9 35:01.93 mysqld 3129 root 15 0 2280 1064 820 R 0.3 0.0 0:00.98 top 10216 nobody20 0 19564 7684 1832 S 0.3 0.3 0:00.10 http 14246 nobody15 0 19424 74361832 S 0.3 0.3 0:00.01 httpd 15955 nobody15 0 19536 75401788 S0.3 0.3 0:00.01 httpd 1 root 15 0 2148 668 580 S0.0 0.0 0:00.61 init Can anyone tell me the solution...??? -- 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: simple redirect_to shows in log but doesn't redirect
Is there anything else I could send that might solve this? The respond_to is unnecessary if you're only ever going to be using the rjs template for this action Fred I'm sorry this is being so difficult. The create function now looks like this: def create @story = Story.find(params[:story_id]) @story.comments.create params[:comment] format.js end The log now says ArgumentError (too few arguments): app/controllers/comments_controller.rb:12:in `format' app/controllers/comments_controller.rb:12:in `create' So I think we need def create @story = Story.find(params[:story_id]) @story.comments.create params[:comment] respond_to do |format| format.js end end Which takes us back to the root of the problem ActionView::MissingTemplate (Missing template comments/create.erb in view path app/views): app/controllers/comments_controller.rb:12:in `create' In peace Neil -- 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: The Future OF RUBY and RUBY ON RAILS
I guess what bothers me a bit about this question is it sounds like it is coming from a place of hedging on a technology - like should I learn this just because I want to be employable in the future --- or maybe I should pick something else. I understand that is not an unreasonable question but is not really a well grounded inquiry. Consider philosophy. I have fallen in love with Ruby and Rails for the philosophy - in fact over my self-taught career (and time with Microsoft technologies) I have made so so many mistakes that I have derived for myself the need for much of what these technologies (RoR and alike) afford - from the precept of programmer happiness to convention over configuration, DRY, ORM layers, TDD, (not that RoR has a monopoly on these, I just think it does pretty well with them). So if Ruby and Rails die tomorrow I carry the principles and create something new because I have a philosophical foundation which has been paid forward by using such. If you have not gotten to this point in your philosophy, start with Rails and you will start in a good place. So to rephrase the question: Will agility, flexibility, adaptability and results stick around for awhile? Good chance with RoR unless the technology goes the wrong direction --- and even so, dont worry about it, because the principles for sure will not die b/c they are attributes of the natural world. On Mon, Aug 2, 2010 at 8:50 AM, Robert Walker li...@ruby-forum.com wrote: Musdev Musdev wrote: DO you guys see Ruby and Ruby on Rails sticking around for a while? and do you see an increase in demand for ruby/ruby on rails developers? This question comes up a lot, and speaking for myself I get sort of tired of answering it. Besides, it's a pointless question that nobody can really answer. None of us knows the future. A much better question is whether Ruby on Rails fits your project needs, and is it an environment that makes you happy as a developer. Only you can answer those questions. -- 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] How to monitor Cron jobs?
When the process starts, or when it is started by a wrapper, the process writes it's pid to a file such as /var/run/my_app.pid As the pid is always written to the same file monit can read the file and find the pid of the process and check that there is a process with that pid running. -- 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 Strives For DRY. A Lot of REST Routes, Not So DRY.
MaggotChild wrote: Most in the Rails community seem stick with 1 controller per resource when using RESTfull routes. As opposed to what alternative? This makes sense for a resource with one scope and one view, but once a resource is used with multiple scopes and/or views the amount of code duplication needed to manage these in a single controller can balloon quick. Uh, not necessarily. And plugins like make_resourceful can help too. Yet despite the impending chaos, it seems as though people prefer to maintain a controller per resource. That's the way Rails MVC works. How would you avoid this, and why? Take these examples from Rails sites written by well respected authors: 1. http://tinyurl.com/2d9rl3v find_container() and find_events(): why would one want to do this? One wouldn't. Those should be in a model class, or possibly a presenter. That much logic doesn't belong in the controller. Perhaps Jamis is planning to refactor? This can become unmanageable. If each of these scopes require different view components the same checks will have to be done in the action's view or when determining the layout. I don't think you're right about these particular implications, but you're right that this is poorly written. 2. http://tinyurl.com/2679ye3 Look at how many times wall? and blog? have to be called. Not very DRY if you ask me. Nor if you ask me. Some refactoring and a polymorphic association would really help here. Rail's routing gives you these checks for free, why not create a WallCommentsController and BlogCommentsController? Because that would be even less DRY Polymorphism is probably what's wanted here. If differing views are involved for each of these it seems like a no brainer... but it's never done. Why? What am I missing? You're apparently missing the fact that a comment is a comment, and the comments controller shouldn't need to know about the type of its parent object. This is why polymorphism is the right solution. 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] Problem with Thinking Sphinx
Hi, I am implementing the sphinx search using Thinking Sphinx search. I have done everything configured. I have added the index fields in my model like this define_index do indexes :name,:sortable = true indexes description has created_at, updated_at end My sphinx configuration file is as source post_core_0 { type = mysql sql_host = localhost sql_user = root sql_pass = sql_db = development sql_sock = /var/lib/mysql/mysql.sock sql_query_pre = SET NAMES utf8 sql_query_pre = SET TIME_ZONE = '+0:00' sql_query = SELECT SQL_NO_CACHE `posts`.`id` * 1 + 0 AS `id` , `posts`.`name` AS `name`, `posts`.`description` AS `description`, `posts`.`id` AS `sphinx_internal_id`, 1921285768 AS `class_crc`, 0 AS `sphinx_deleted`, IFNULL(`posts`.`name`, '') AS `name_sort`, UNIX_TIMESTAMP(`posts`.`created_at`) AS `created_at`, UNIX_TIMESTAMP(`posts`.`updated_at`) AS `updated_at` FROM `posts` WHERE `posts`.`id` = $start AND `posts`.`id` = $end AND deleted = 0 GROUP BY `posts`.`id` ORDER BY NULL sql_query_range = SELECT IFNULL(MIN(`id`), 1), IFNULL(MAX(`id`), 1) FROM `posts` sql_attr_uint = sphinx_internal_id sql_attr_uint = class_crc sql_attr_timestamp = created_at sql_attr_timestamp = updated_at sql_attr_str2ordinal = name_sort sql_query_info = SELECT * FROM `posts` WHERE `id` = (($id - 0) / 1) } The searching works well but I am seeing in the log that it is firing a queri like SELECT * FROM `posts` WHERE `id` = (1,2) Is my configuration right? Also, if I am doing indexing like indexes description, :as= :post_desc and if I try to access it like this:- search=ThinkingSphinx.search test puts search.post_desc Giving me an error that post_desc is undefined. Can anyone tell me wwhat is happening? Thanks, Mike -- 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] stdin/stdout/stderr problem in g++ and rails
On Sat, Jul 31, 2010 at 08:12, Silver Spoon jatinkumar.n...@gmail.com wrote: In my rails controller, I am doing the following : @output = `g++ j.cpp -o prog ./prog` This gives the output in the @output variable which i can display in my view. But the above works only if the j.cpp is correct and doesn't expect any user input. How can I use the stdin/stderr and stdout streams here so that : If the user has to give input, I open a dialog box Sorry, can't help you there, at least nothing springs immediately to my mind. If there are any errors in the file, then I should be able to get the errors and display them to the user. I tried doing this : @output = `g++ j.cpp -o prog ./prog| tee prog` There's probably some more Rubyish way to do it by messing with the definitions of stout and stderr, but a quick and dirty way to do it, by messing with the the command line to make stderr go to stdout, is: @output = `g++ j.cpp -o prog 21` Check $? to see if it succeeded (should be 0; make sure you check IMMEDIATELY after the command). if so, then you can run prog as normal. This is an old shell-scripting type kluge that I wasn't sure would work, but does. Proof-of-concept code: #! /usr/bin/ruby out = `ls -l #{ARGV.join ' '} 21` status = $? puts command %sed (status %d) % [(status == 0 ? 'work' : 'fail'), status] puts out # insert your own joke here, folks! Also be VERY careful about how you are feeding the program name into the command, especially if there's any way a user can influence it. Google SQL Injection; it's not just for SQL. -Dave -- Specialization is for insects. -RAH | Have Pun, Will Babble! -me Programming Blog: http://codosaur.us | Work: http://davearonson.com Leadership Blog: http://dare2xl.com | Play: http://davearonson.net * * * * * WATCH THIS SPACE * * * * * | Ruby: http://mars.groupsite.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: simple redirect_to shows in log but doesn't redirect
Check your rjs code. Run debugger and insert %debugger% at the very top of the rjs file, if catches the debugger then you have an rjs code error. Install firebug and view the returned javascript. Since the rjs is rendered after the insert your insert would reflect in the log but bad rjs code would not run, sometimes there an error if you have a ruby-code problem, sometimes no error if its only java-script related. You can also check your request format from within the controller with ... request.format ;) On Jul 31, 5:26 am, Neil Bye li...@ruby-forum.com wrote: This is the offending code def create @story = Story.find(params[:story_id]) @story.comments.create params[:comment] redirect_to story_path(@story) end When the above is called the log shows Processing CommentsController#create (for 127.0.0.1 at 2010-07-31 10:04:38) [POST] Parameters: {comment={body=cat}, commit=Comment, authenticity_token=OK3kszAxcRhisEn/YGaG1sWsoX/C4MOxmj4qcUkX/Fs=, story_id=5} [4;35;1mUser Load (0.5ms) [0m [0mSELECT * FROM users WHERE (users.id = 2) LIMIT 1 [0m [4;36;1mStory Load (0.5ms) [0m [0;1mSELECT * FROM stories WHERE (stories.id = '5') [0m [4;35;1mComment Create (0.3ms) [0m [0mINSERT INTO comments (created_at, body, updated_at, story_id) VALUES('2010-07-31 10:04:39', 'cat', '2010-07-31 10:04:39', 5) [0m Redirected tohttp://localhost:3000/stories/5 Completed in 209ms (DB: 1) | 302 Found [http://localhost/stories/5/comments] But the page doesn't refresh I've read every entry in the forum on the forum and googled this for two days , it's driving me mad. WHY DOESN'T IT WORK -- 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] Check_Box Validation Script doesn't work
On Sat, Jul 31, 2010 at 20:21, Philip Cortes li...@ruby-forum.com wrote: I'm trying to have users check a checkbox, accepting our terms of service, prior to registering. I don't grok in fullness exactly what's wrong with your app, but here are some resources to look at: about checkboxes: http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#M002298 about validates_acceptance_of: http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#M001396 When I'm stuck on a Ruby or Rails problem involving some concept or keyword or whatever, I find that googling it with Ruby (e.g., ruby checkbox) usually gets me some good help pretty quickly. -Dave -- Specialization is for insects. -RAH | Have Pun, Will Babble! -me Programming Blog: http://codosaur.us | Work: http://davearonson.com Leadership Blog: http://dare2xl.com | Play: http://davearonson.net * * * * * WATCH THIS SPACE * * * * * | Ruby: http://mars.groupsite.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] check box for terms and conditions
On Sun, Aug 1, 2010 at 06:18, Dis Tec li...@ruby-forum.com wrote: Is there a smart way or example for listing terms and conditions and ensuring that they have been read? No, there never was and (within reason) never will be. There is, however, a way to ensure that the checkbox *saying* they have read it and agree to it, is checked. :-) See http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#M001396 for the validates_acceptance_of method on ActiveRecord. It Encapsulates the pattern of wanting to validate the acceptance of a terms of service check box (or similar agreement). -Dave -- Specialization is for insects. -RAH | Have Pun, Will Babble! -me Programming Blog: http://codosaur.us | Work: http://davearonson.com Leadership Blog: http://dare2xl.com | Play: http://davearonson.net * * * * * WATCH THIS SPACE * * * * * | Ruby: http://mars.groupsite.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] Problem with Thinking Sphinx
try search = C.search 'test' C == Class that implements thinking sphinx finally: search.each do |s| s.post_desc end 2010/8/2 Mike Disuza li...@ruby-forum.com Hi, I am implementing the sphinx search using Thinking Sphinx search. I have done everything configured. I have added the index fields in my model like this define_index do indexes :name,:sortable = true indexes description has created_at, updated_at end My sphinx configuration file is as source post_core_0 { type = mysql sql_host = localhost sql_user = root sql_pass = sql_db = development sql_sock = /var/lib/mysql/mysql.sock sql_query_pre = SET NAMES utf8 sql_query_pre = SET TIME_ZONE = '+0:00' sql_query = SELECT SQL_NO_CACHE `posts`.`id` * 1 + 0 AS `id` , `posts`.`name` AS `name`, `posts`.`description` AS `description`, `posts`.`id` AS `sphinx_internal_id`, 1921285768 AS `class_crc`, 0 AS `sphinx_deleted`, IFNULL(`posts`.`name`, '') AS `name_sort`, UNIX_TIMESTAMP(`posts`.`created_at`) AS `created_at`, UNIX_TIMESTAMP(`posts`.`updated_at`) AS `updated_at` FROM `posts` WHERE `posts`.`id` = $start AND `posts`.`id` = $end AND deleted = 0 GROUP BY `posts`.`id` ORDER BY NULL sql_query_range = SELECT IFNULL(MIN(`id`), 1), IFNULL(MAX(`id`), 1) FROM `posts` sql_attr_uint = sphinx_internal_id sql_attr_uint = class_crc sql_attr_timestamp = created_at sql_attr_timestamp = updated_at sql_attr_str2ordinal = name_sort sql_query_info = SELECT * FROM `posts` WHERE `id` = (($id - 0) / 1) } The searching works well but I am seeing in the log that it is firing a queri like SELECT * FROM `posts` WHERE `id` = (1,2) Is my configuration right? Also, if I am doing indexing like indexes description, :as= :post_desc and if I try to access it like this:- search=ThinkingSphinx.search test puts search.post_desc Giving me an error that post_desc is undefined. Can anyone tell me wwhat is happening? Thanks, Mike -- 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. -- att: Luciano Sousa http://www.lucianosousa.net *Ruby on Rails Developer *Linux User #456387 *Contato: (21) 7639-5049 -- 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: Problem with Thinking Sphinx
Hi, I am tried like this:- Still no success s=Post.search pune = [#Post id: 3, name: Neovasolution, description: This is pune company, created_at: 2010-07-14 12:17:16, updated_at: 2010-07-14 12:17:16, delta: false] s.post_desc NoMethodError: undefined method `desc' for #ThinkingSphinx::Search:0xb6f1bde4 from /usr/local/ruby/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.18/lib/thinking_sphinx/search.rb:116:in `method_missing' from (irb):2 Thanks, Mike -- 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: simple redirect_to shows in log but doesn't redirect
On Aug 2, 2:01 pm, Neil Bye li...@ruby-forum.com wrote: def create @story = Story.find(params[:story_id]) @story.comments.create params[:comment] format.js end The log now says ArgumentError (too few arguments): app/controllers/comments_controller.rb:12:in `format' app/controllers/comments_controller.rb:12:in `create' So I think we need def create @story = Story.find(params[:story_id]) @story.comments.create params[:comment] respond_to do |format| format.js end end i was saying you need neither - def create @story = Story.find(params[:story_id]) @story.comments.create params[:comment] 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] Re: Problem with Thinking Sphinx
this is a valid return: *= [#Post id: 3, name: Neovasolution, description: This is pune company, created_at: 2010-07-14 12:17:16, updated_at: 2010-07-14 12:17:16, delta: false]** * for access after try: *s.each do |sa|* * sa.post_desc* *end* 2010/8/2 Mike Disuza li...@ruby-forum.com Hi, I am tried like this:- Still no success s=Post.search pune = [#Post id: 3, name: Neovasolution, description: This is pune company, created_at: 2010-07-14 12:17:16, updated_at: 2010-07-14 12:17:16, delta: false] s.post_desc NoMethodError: undefined method `desc' for #ThinkingSphinx::Search:0xb6f1bde4 from /usr/local/ruby/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.18/lib/thinking_sphinx/search.rb:116:in `method_missing' from (irb):2 Thanks, Mike -- 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. -- att: Luciano Sousa http://www.lucianosousa.net *Ruby on Rails Developer *Linux User #456387 *Contato: (21) 7639-5049 -- 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: simple redirect_to shows in log but doesn't redirect
Joshua Mckinney wrote: Check your rjs code. Run debugger and insert %debugger% at the very top of the rjs file, if catches the debugger then you have an rjs code error. Install firebug and view the returned javascript. Since the rjs is rendered after the insert your insert would reflect in the log but bad rjs code would not run, sometimes there an error if you have a ruby-code problem, sometimes no error if its only java-script related. You can also check your request format from within the controller with ... request.format ;) If I run the request with firebug it breaks at line 13 of prototpye,js Browser: { IE: !!(window.attachEvent navigator.userAgent.indexOf('Opera') === -1), Opera: navigator.userAgent.indexOf('Opera') -1, WebKit: navigator.userAgent.indexOf('AppleWebKit/') -1, Gecko: navigator.userAgent.indexOf('Gecko') -1 navigator.userAgent.indexOf('KHTML') === -1, MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/) }, Is my problem maybe that Ubuntu or Linux or Firefox are not there? I still don't understand why it is looking for create.erb surely the format.js in the create function is supposed to override that. Even more confused In peace Neil -- 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] if then within % % region in html
On Sun, Aug 1, 2010 at 06:52, Michael Pavling pavl...@gmail.com wrote: On 1 August 2010 11:32, Dis Tec li...@ruby-forum.com wrote: I'm returning a value from the db which is true/false and I'd like to convert that to something more meaningful - how can I incorporate an if then into the inline html? You can use conditional checking inline, with normal 'if...else' blocks: % if @my_object.active? % This is active % else % You need to activate this one % else % or you can use the ternary operator: %= @my_object.active? ? This is active : You need to activate this one % or you can use 'if' conditions as guards: %= This is active if @my_object.active? % Though your approach will work, this looks to me like it's probably logic that more properly belongs in the controller than the view. IMHO using something like: if @my_object.active? @activated_msg = 'This is active' else @activated_msg = 'You need to activate this one' end # you did mean end for the 2nd else above, yes? or @activated_msg = @my_object.active? ? 'This is active' : 'You need to activate this one' or @activated_msg = 'This is active' if @my_object.active? in the controller, and then using @activated_msg in the view, would be cleaner. (BTW, note the single quotes; I haven't verified it myself, but heard that they are at least marginally faster for constant strings (i.e., where you *can* use them), since the system won't even *try* to look for vars that need to be interpolated. Makes sense to me.) Now back to the Original Poster. Dis Tec had also written: I have tried if ... puts xxx, but to no avail. That will make it put xxx on the Ruby console, not in the output to be sent back to the HTTP client. There are two things I think you need to read up on. The first will answer your general question on how to incorporate Ruby code, including conditionals and variables, into HTML. The main technique for doing that, and the default in Rails, is ERB, which works basically like JSP. (If you're not familiar with JSP, that's OK, just trying to help the lightbulb turn on.) The main alternate, HAML, has also gained serious traction, but I suggest you save that for after you're at least familiar with ERB. Before you do *any* real work with either, though, I strongly suggest you read up on MVC, the Model-View-Controller approach. It's one of the ways to maintain separation of concerns, a general software engineering principle. You'll find it helps you organize your code much more cleanly and maintainably. Rails uses MVC strongly. I'm not going to go into depth on them here myself, as there are gazillions of web pages that explain them well. Rails is *highly* opinionated and makes a lot of assumptions. Learning those opinions and assumptions (such as, that you're using the MVC approach), how to use them, and how to override them when absolutely necessary, will help you immensely. If you find a good tutorial site or book on Rails, it should go into depth on both of these, and a lot of other fundamentals you'll need. Try the following resource as a primer; it should help you organise your requests for help to be more likely to elucidate responses: http://catb.org/esr/faqs/smart-questions.html One of my all-time faves, tho IMHO the OP didn't do too bad a job. Fairly clear phrasing, he told us what he tried, he didn't cop a 'tude, and the main thing he needs to know isn't all THAT obvious, at least if he hasn't gone thru a good complete RoR tutorial. -Dave -- Specialization is for insects. -RAH | Have Pun, Will Babble! -me Programming Blog: http://codosaur.us | Work: http://davearonson.com Leadership Blog: http://dare2xl.com | Play: http://davearonson.net * * * * * WATCH THIS SPACE * * * * * | Ruby: http://mars.groupsite.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: simple redirect_to shows in log but doesn't redirect
Frederick Cheung wrote: On Aug 2, 2:01�pm, Neil Bye li...@ruby-forum.com wrote: � app/controllers/comments_controller.rb:12:in `format' � end i was saying you need neither - � def create � � @story = Story.find(params[:story_id]) � � @story.comments.create params[:comment] end How then would it create the comment? -- 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] radio box validation
On Sun, Aug 1, 2010 at 06:10, Dis Tec li...@ruby-forum.com wrote: I have created some radio boxes as follows: % f.radio_button :usertype, false %False % f.radio_button :usertype, true %True Why not use a checkbox? Then you can be sure it's either checked or unchecked. Or is this just an example, and there are really more than two values? In that case, you could specify one of them as checked from the start. -Dave -- Specialization is for insects. -RAH | Have Pun, Will Babble! -me Programming Blog: http://codosaur.us | Work: http://davearonson.com Leadership Blog: http://dare2xl.com | Play: http://davearonson.net * * * * * WATCH THIS SPACE * * * * * | Ruby: http://mars.groupsite.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: simple redirect_to shows in log but doesn't redirect
Check your rjs code. Run debugger and insert %debugger% at the very top of the rjs file, if catches the debugger then you have an rjs code error. Install firebug and view the returned javascript. Since the rjs is rendered after the insert your insert would reflect in the log but bad rjs code would not run, sometimes there an error if you have a ruby-code problem, sometimes no error if its only java-script related. You can also check your request format from within the controller with ... request.format ;) On Jul 31, 5:26 am, Neil Bye li...@ruby-forum.com wrote: This is the offending code def create @story = Story.find(params[:story_id]) @story.comments.create params[:comment] redirect_to story_path(@story) end When the above is called the log shows Processing CommentsController#create (for 127.0.0.1 at 2010-07-31 10:04:38) [POST] Parameters: {comment={body=cat}, commit=Comment, authenticity_token=OK3kszAxcRhisEn/YGaG1sWsoX/C4MOxmj4qcUkX/Fs=, story_id=5} [4;35;1mUser Load (0.5ms) [0m [0mSELECT * FROM users WHERE (users.id = 2) LIMIT 1 [0m [4;36;1mStory Load (0.5ms) [0m [0;1mSELECT * FROM stories WHERE (stories.id = '5') [0m [4;35;1mComment Create (0.3ms) [0m [0mINSERT INTO comments (created_at, body, updated_at, story_id) VALUES('2010-07-31 10:04:39', 'cat', '2010-07-31 10:04:39', 5) [0m Redirected tohttp://localhost:3000/stories/5 Completed in 209ms (DB: 1) | 302 Found [http://localhost/stories/5/comments] But the page doesn't refresh I've read every entry in the forum on the forum and googled this for two days , it's driving me mad. WHY DOESN'T IT WORK -- 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: if then within % % region in html
Dave, I mostly second your advice here, but there are a couple of things that I disagree with. Dave Aronson wrote: On Sun, Aug 1, 2010 at 06:52, Michael Pavling pavl...@gmail.com wrote: On 1 August 2010 11:32, Dis Tec li...@ruby-forum.com wrote: �or you can use the ternary operator: � �%= @my_object.active? ? This is active : You need to activate this one % �or you can use 'if' conditions as guards: � �%= This is active if @my_object.active? % Though your approach will work, this looks to me like it's probably logic that more properly belongs in the controller than the view. Perhaps. Certainly any *more* logic than this in the view is inappropriate, but I think testing the value of a simple method call in the view is OK. IMHO using something like: if @my_object.active? @activated_msg = 'This is active' else @activated_msg = 'You need to activate this one' end # you did mean end for the 2nd else above, yes? or @activated_msg = @my_object.active? ? 'This is active' : 'You need to activate this one' or @activated_msg = 'This is active' if @my_object.active? in the controller, and then using @activated_msg in the view, would be cleaner. Probably not. I tend to believe that it's a mistake to put display text in the controller in most cases. If it were any more complicated than this, though, I'd set a flag in the model or controller so that a simple boolean value could be tested in the view. [...] There are two things I think you need to read up on. The first will answer your general question on how to incorporate Ruby code, including conditionals and variables, into HTML. The main technique for doing that, and the default in Rails, is ERB, which works basically like JSP. (If you're not familiar with JSP, that's OK, just trying to help the lightbulb turn on.) The main alternate, HAML, has also gained serious traction, but I suggest you save that for after you're at least familiar with ERB. I don't know that I'd agree. Haml (not HAML!) works basically like HTML (and therefore ERb [not ERB!]) with less typing. I see no particular reason to use ERb when Haml is available. Before you do *any* real work with either, though, I strongly suggest you read up on MVC, the Model-View-Controller approach. It's one of the ways to maintain separation of concerns, a general software engineering principle. You'll find it helps you organize your code much more cleanly and maintainably. Rails uses MVC strongly. Agreed. The problem is that every MVC framework has a different interpretation of what MVC is. (I came to Rails from Fusebox, which has an optional MVC design pattern [which I used] that works very differently from Rails' MVC. Cocoa MVC is different again, I believe.) [...] Try the following resource as a primer; it should help you organise your requests for help to be more likely to elucidate responses: http://catb.org/esr/faqs/smart-questions.html One of my all-time faves, And no longer mine. ESR does explain -- mostly -- how to ask smart questions, but spends IMHO far too much time saying look, we don't care about being nice or helpful. Don't expect civility or help when you ask questions. Just fuck off and hope the gurus throw you a bone. That's not how I want the communities I'm part of to work. 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: The {{key}} interpolation syntax in I18n messages is deprecated...
I noticed that error message when using the i18n gem instead of Rails' default i18n. Could that have been the issue? On Aug 1, 12:12 pm, David Kahn d...@structuralartistry.com wrote: All, Has anyone seen this - I am getting the following deprecation warning when running my functional tests under rails 2.3.8 (just moved an app from 2.3.4 up to 2.3.8 in prep to move to Rails 3 --- if you think this problem is solved in Rails 3 then let me know): The {{key}} interpolation syntax in I18n messages is deprecated. Please use %{key} instead. I have isolated the problem to the following line in my model --- when I do not add this error everything is fine: errors.add_to_base(Uploaded file must be present) if !self.uploaded_file_content Also tried this but same result: errors.add(:uploaded_file_content, Uploaded file must be present) if !self.uploaded_file_content The irony is on this app I have no use for i18n. Would be also just as glad to turn it off, but of course that would only be a band-aid. Thanks in advance! 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: POST and GET
Also, a GET is just a read, while a POST is used to create. Like the Wikipedia article linked before says: Note that GET should not be used for operations that cause side-effects, such as using it for taking actions in web applications. On Aug 2, 12:33 am, ct9a anexi...@gmail.com wrote: GET - typically used when you access a page via a link (ie you cut and paste into the web browser) - all the values (ie form arguments) get passed in the url itself ( delimited by the ampersand character) - example: when the following link is copied and pasted to the web browser, a GET request is generated and the values for distance,N,Make , state and so forth are passed in the url itself.http://www.carsales.com.au/used-cars/MITSUBISHI/LANCER/private-result... POST - can only be generated by a form's submit action/button - all the values (ie form arguments) get passed in the params hence in rails, you access the values via params - example: in search forms or registration forms, clicking the submit button generates a POST request to the web server Gordon Yeong On Aug 2, 3:01 pm, Musdev Musdev li...@ruby-forum.com wrote: HEY Guys, Im new to rails. Can someone help explain POST and GET inrails, and maybe give an example? When is it used? Im learning rails via Agile web Development with Rails, and soon to download peepcode video's, are these good resources to learn from? Regards -- 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: simple redirect_to shows in log but doesn't redirect
From inside your create method in the controller, what does request.format return? If the request is a plain old html request is should put text/html If the request is an ajax request is should put text/javascript if the request puts text/html or anything besides text/javascript you can force the format by adding: request.format = :js to the controller method. On Aug 2, 9:36 am, Neil Bye li...@ruby-forum.com wrote: Frederick Cheung wrote: On Aug 2, 2:01 pm, Neil Bye li...@ruby-forum.com wrote: app/controllers/comments_controller.rb:12:in `format' end i was saying you need neither - def create @story = Story.find(params[:story_id]) @story.comments.create params[:comment] end How then would it create the comment? -- 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: The {{key}} interpolation syntax in I18n messages is deprecated...
I seem to have obliterated my previous install of Ruby while installing rvm so I will never know. But I am so happy with rvm that I am overlooking this mishap. At least I was not consciously using the i18n gem if this was the case. On Mon, Aug 2, 2010 at 11:01 AM, Adam Stegman adam.steg...@gmail.comwrote: I noticed that error message when using the i18n gem instead of Rails' default i18n. Could that have been the issue? On Aug 1, 12:12 pm, David Kahn d...@structuralartistry.com wrote: All, Has anyone seen this - I am getting the following deprecation warning when running my functional tests under rails 2.3.8 (just moved an app from 2.3.4 up to 2.3.8 in prep to move to Rails 3 --- if you think this problem is solved in Rails 3 then let me know): The {{key}} interpolation syntax in I18n messages is deprecated. Please use %{key} instead. I have isolated the problem to the following line in my model --- when I do not add this error everything is fine: errors.add_to_base(Uploaded file must be present) if !self.uploaded_file_content Also tried this but same result: errors.add(:uploaded_file_content, Uploaded file must be present) if !self.uploaded_file_content The irony is on this app I have no use for i18n. Would be also just as glad to turn it off, but of course that would only be a band-aid. Thanks in advance! 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.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] The Future OF RUBY and RUBY ON RAILS
On Mon, Aug 2, 2010 at 01:15, Musdev Musdev li...@ruby-forum.com wrote: DO you guys see Ruby and Ruby on Rails sticking around for a while? and do you see an increase in demand for ruby/ruby on rails developers? I definitely see an increase over the past several years. Pretty much can't help it with something new, unless it sucks horribly (and doesn't have huge marketing muscle or government requirements behind it). Will it stick around, is another question. Another framework could some along that would make RoR look horrible by comparison. Rails 3 could suck horribly. (Though even then, we'd still have Rails 2 to use.) My crystal ball is in the shop. I'm sure hoping it sticks around, though. I kinda missed the boat with Java -- learned it in about 1998 or so, but didn't row hard enough to get much work in it. Now it seems like 95% of the openings are in Java, but I don't have the several years of experience most of them demand, while kids who will work for half my salary are coming out of school with at least solid training. I don't want to miss the boat with Ruby, either by my not rowing hard enough to catch it, or by it sinking. (I'll dispense with the obvious Khayyam pun.) -Dave -- Specialization is for insects. -RAH | Have Pun, Will Babble! -me Programming Blog: http://codosaur.us | Work: http://davearonson.com Leadership Blog: http://dare2xl.com | Play: http://davearonson.net * * * * * WATCH THIS SPACE * * * * * | Ruby: http://mars.groupsite.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: Multiple flow_paginator in same view...
Marcus Sá wrote: Hello, I'm a Rails developer from Brazil and would like to use your gem flow_paginator, but would like to have three buttons displaying the contents of three different divs, for example in github saw that I can only use one that way, there are some implementation to use more thanflow_paginator for a view? Sorry for my English ... Thanks! _ Marcus Sá http://www.woompa.com.br Starting up for never stop! Anyone? Please? I need your help... -- 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: handle exception in ajax call
Thank you for your patience,fred. -- 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: if then within % % region in html
On Mon, Aug 2, 2010 at 10:58, Marnen Laibow-Koser li...@ruby-forum.com wrote: Dave, I mostly second your advice here, but there are a couple of things that I disagree with. ... any *more* logic than this in the view is inappropriate, but I think testing the value of a simple method call in the view is OK. Fair enough. One needn't be a purist. I was just trying to point the OP to the right path, even if he can stray from it. IMHO using something like: ... @activated_msg = 'This is active' if @my_object.active? in the controller, and then using @activated_msg in the view, would be cleaner. Probably not. I tend to believe that it's a mistake to put display text in the controller in most cases. H. Now that I think about that, you're probably right, it would more properly belong in the view. But before making a habit of it, I'd like to give it some more thought. What arguments (other than MVC purity) can you (or anyone else) come up with for either side? On the controller-side, it means fewer decisions being made in the view, but IMHO that's a pretty weak argument. If it were any more complicated than this, though, I'd set a flag in the model or controller so that a simple boolean value could be tested in the view. Yes, that's sort of the main point I was getting at before. Looking at the object's activation state, goes in the controller. Passing in a simple @object_active? boolean, though, could be perfectly fair game for the view. I don't know that I'd agree. Haml (not HAML!) works basically like HTML (and therefore ERb [not ERB!]) with less typing. I see no particular reason to use ERb when Haml is available. Use, perhaps not. Be familiar with, yes, so he can read a lot more examples. Sorry about the CaseS BeIng WRoNG, I'm still somewhat of a RubyNuby myself, so some of these things aren't quite in my fingers' muscle memory yet! The problem is that every MVC framework has a different interpretation of what MVC is. Ah, well, that's the great thing about standards, innit? So many to choose from ;-) And no longer mine. ESR does explain -- mostly -- how to ask smart questions, but spends IMHO far too much time saying look, we don't care about being nice or helpful. Don't expect civility or help when you ask questions. Just fuck off and hope the gurus throw you a bone. That's not how I want the communities I'm part of to work. That's just esr being esr. I s'pose it comes off that way to people not used to him. If you can get past that stuff, and follow the basic advice, it's quite useful. I paraphrased it in a blog post once as: * Try to solve it yourself first. The essay details several information sources to try. * Ask the right person or group. * Communicate well, including: o Use correct grammar, spelling, punctuation, etc.; don't m4Ke 7h33 07h4R P3r51n 5p3Nd 4 !07 uv h1z 7yM3 f!9uR1nG oU7 wU7 u m33N! o Get to the point. Preferably as early as the Subject line, if asking by email. o Be specific about the problem or question, and what kind of help you're looking for. o Give all the data you have. o But still be concise. * Say what you already tried, and why that didn't satisfy you. * Above all, be nice about it! Don't assume that any problem you're having, is his fault, or even not yours. Don't expect an instant solution on a silver platter. You're probably not paying the person who's helping, so be grateful that they're putting forth any effort at all for you. (Currently at http://dare2xl.braveblog.com/ and eventually to be moved to http://dare2xl.com/.) -Dave -- Specialization is for insects. -RAH | Have Pun, Will Babble! -me Programming Blog: http://codosaur.us | Work: http://davearonson.com Leadership Blog: http://dare2xl.com | Play: http://davearonson.net * * * * * WATCH THIS SPACE * * * * * | Ruby: http://mars.groupsite.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: simple redirect_to shows in log but doesn't redirect
On Aug 2, 3:36 pm, Neil Bye li...@ruby-forum.com wrote: i was saying you need neither - def create @story = Story.find(params[:story_id]) @story.comments.create params[:comment] end How then would it create the comment? why wouldn't it ? - that's creating the comment on the second line. Fred -- 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: if then within % % region in html
Thanks for the advice guys... I appreciate it might have been pretty ambiguous. I guess I am trying to avoid the mix of logic and text but appreciate that in some cases it might be fine to just go ahead and do this. -- 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: if then within % % region in html
Dave Aronson wrote: On Mon, Aug 2, 2010 at 10:58, Marnen Laibow-Koser li...@ruby-forum.com wrote: Dave, I mostly second your advice here, but there are a couple of things that I disagree with. ... any *more* logic than this in the view is inappropriate, but I think testing the value of a simple method call in the view is OK. Fair enough. One needn't be a purist. I was just trying to point the OP to the right path, even if he can stray from it. I don't think this is a question of purism. I think that it's not impure MVC to check a boolean flag in the view -- in fact, I think that's exactly what an MVC-style view should be doing. Do you disagree? IMHO using something like: ... @activated_msg = 'This is active' if @my_object.active? in the controller, and then using @activated_msg in the view, would be cleaner. Probably not. �I tend to believe that it's a mistake to put display text in the controller in most cases. H. Now that I think about that, you're probably right, it would more properly belong in the view. But before making a habit of it, I'd like to give it some more thought. What arguments (other than MVC purity) can you (or anyone else) come up with for either side? On the controller-side, it means fewer decisions being made in the view, but IMHO that's a pretty weak argument. Actually, that's a pretty strong argument. MVC purity rules all in some sense. But I also like not having to deal with I18N in the controller, and I like knowing that the view does (essentially) all the rendering of anything visible. The controller should deal with logic flow, not display details (view) or logic implementation (model). �If it were any more complicated than this, though, I'd set a flag in the model or controller so that a simple boolean value could be tested in the view. Yes, that's sort of the main point I was getting at before. Looking at the object's activation state, goes in the controller. It doesn't need to. If the model already has a simple active? flag on it, there's no reason for the controller to touch it. Passing in a simple @object_active? boolean, though, could be perfectly fair game for the view. Right. I don't know that I'd agree. �Haml (not HAML!) works basically like HTML (and therefore ERb [not ERB!]) with less typing. �I see no particular reason to use ERb when Haml is available. Use, perhaps not. Be familiar with, yes, so he can read a lot more examples. True. Sorry about the CaseS BeIng WRoNG, I'm still somewhat of a RubyNuby myself, so some of these things aren't quite in my fingers' muscle memory yet! Understood! :D The problem is that every MVC framework has a different interpretation of what MVC is. Ah, well, that's the great thing about standards, innit? So many to choose from ;-) MVC isn't a standard. It's a philosophy, and perhaps a metapattern, that's been differently interpreted over the years. The usual understanding of it today -- at least among Rails developers -- seems to be quite perverted from what Trygve Reenskaug originally defined. And no longer mine. �ESR does explain -- mostly -- how to ask smart questions, but spends IMHO far too much time saying look, we don't care about being nice or helpful. �Don't expect civility or help when you ask questions. �Just fuck off and hope the gurus throw you a bone. �That's not how I want the communities I'm part of to work. That's just esr being esr. I s'pose it comes off that way to people not used to him. I don't care how big his name is. If he's giving mean-spirited advice, I'm going to call him on it. (For the record, I don't think it is just ESR being ESR. I find many of his other articles quite well written and useful. I think it's a guru thinking that it's all right to be uncivil if you know enough -- an opinion I do not really subscribe to.) If you can get past that stuff, and follow the basic advice, it's quite useful. Parts of it, yes. I find the you are a poor supplicant who must hope the gurus throw you a bone attitude very *unuseful* indeed. I paraphrased it in a blog post once as: * Try to solve it yourself first. The essay details several information sources to try. * Ask the right person or group. * Communicate well, including: o Use correct grammar, spelling, punctuation, etc.; don't m4Ke 7h33 07h4R P3r51n 5p3Nd 4 !07 uv h1z 7yM3 f!9uR1nG oU7 wU7 u m33N! o Get to the point. Preferably as early as the Subject line, if asking by email. o Be specific about the problem or question, and what kind of help you're looking for. o Give all the data you have. o But still be concise. * Say what you already tried, and why that didn't satisfy you. Yes, those are among the points I agree with. * Above all, be nice about it! I agree with that too. A pity he doesn't follow his own advice.
[Rails] OT ... Pot, meet Kettle (was if then within % % region in html)
On 2 August 2010 16:43, Marnen Laibow-Koser li...@ruby-forum.com wrote: I think it's a guru thinking that it's all right to be uncivil if you know enough -- an opinion I do not really subscribe to *cough* *splutter* :-) urm... Marnen, I perceive the vast majority of your posts as veering toward strongly uncivil in their tone. I don't mean to say that to insult you personally; just to point out that you often tell people in no uncertain terms, without embellishment, very flatly, that they are wrong; sometimes for even asking the question they asked. Often times, when you do suggest solutions, it's difficult to discern the help from the sneer. -- 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: OT ... Pot, meet Kettle (was if then within % % region in html)
Michael Pavling wrote: On 2 August 2010 16:43, Marnen Laibow-Koser li...@ruby-forum.com wrote: I think it's a guru thinking that it's all right to be uncivil if you know enough -- an opinion I do not really subscribe to *cough* *splutter* :-) urm... Marnen, I perceive the vast majority of your posts as veering toward strongly uncivil in their tone. I don't mean to say that to insult you personally; just to point out that you often tell people in no uncertain terms, without embellishment, very flatly, that they are wrong; You bring up some interesting points here. First of all, do you really think telling people they are wrong is ipso facto uncivil? I do not. I don't really think anything is gained by avoiding the issue. I am aware that I tend toward the blunt side when I write my responses, but I think there's a huge difference between that and the rather mean-spirited tone that I recall noticing the last time I read ESR's essay. I certainly don't think civil is the same as sugar-coated; I aim for the former, not the latter, on this sort of list. However, I make every effort to respond to posts on this forum in a way that would not offend *me* if I were the recipient rather than the author of the post -- for example, you will not see name-calling or ad hominem attacks in my posts, and I make suggestions constructively wherever possible. OTOH, if someone obviously doesn't know what he's doing, I see no point in not (politely) pointing out that that's the case. Of course, I realize that everyone's sensibilities are different. sometimes for even asking the question they asked. Examples? Often times, when you do suggest solutions, it's difficult to discern the help from the sneer. Examples? If you want a guideline: it is vanishingly rare for the sneer to be intentional in my posts. This is part of what I am referring to as civility. I just don't do that unless fairly heavily provoked, and usually not even then. 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] Rails Forms...Calculations and things
I have a partial form for tank tickets that requires end user input...It is designed to minimize said input to reduce the possibility for error...There are several other fields where calculation results need to go before being sent to the database...! Questions: 1) Is the 'Create' function the place to trigger the calcs...?...How...? 2) Where is the best practice location for the calcs...?...(model, helper...?...) 3) How do I get the results into the database so they can be displayed later on...? Example: User input fields... 1) A drop-down to select a tank number 2) Drop-downs to select a date 3) A Text field to input a ticket number 4) A drop-down to select a product type 5) A Text field to input an API gravity 6) A Text field to input a tank temperature 7) A Text field to input the tank gauge The remaining five fields are calculated: 8) Gross Volume (each tank in the database has an 'increment table' used to determine the gross volume using the 'gauge') 9) Volume Correction Factor (calculated from the API gravity and the tank temperature) 10) Roof Correction Factor (this is calculated using data from the 'tanks' table) 11) Net Volume (this is the result of multiplying the Gross Volume by the Volume Correction Factor then adding the Roof Corr) 12) Ticket Volume (this is determined by comparing this ticket 'Net Volume' to the last tickets 'Net Volume' for the same tank) I have all the calculations running in rails and they are returning the correct results... So far, the only way I can get all this to work is to have the look-up methods in the 'public_helper' and the raw calcs in the 'application_helper'... Here's an example of how I'm getting the 'gross volume': def get_gross_vol( gauge ) @upperinc = Tank202increment.find(:first, :conditions = [inc = ?, gauge]) @lowerinc = Tank202increment.find(:first, :conditions = [inc ?, gauge], :order = 'inc DESC') gross_vol = ((gauge - @lowerinc.inc) * 100 * @upperinc.multiplier) + @lowerinc.volume gross_vol = round(gross_vol, 2) return gross_vol end Here's a calculation example: # Calculate Density(kg/m3) # Inputs: # Observed API gravity def get_density( api ) density = (141.5 / (131.5 + api.to_f) * 999.012) density = round(density, 3) return density end Thanks in advance for any light shed on this...I am new to Rails...am luvin' it and am trying to get it right...especially with regard to 'Best Practices'/'Standardization'...! -- 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] Drop down boxes from table data
Hi I have another question for how best to do this. Now I have been following the tutorial at: http://www.tunaslut.com/learning-ruby-drop-down-lists-in-one-to-many-relationships, however when I change the view over from % @cities.each do |city| % tr td%=h city.city_name %/td td%=h city.country_id %/td to: % @cities.each do |city| % tr td%=h city.city_name %/td td%=h city.country.country_name %/td The system breaks with the following error NoMethodError in Cities#index Showing app/views/cities/index.html.erb where line #12 raised: undefined method `country_name' for nil:NilClass Extracted source (around line #12): when attempting to display data on cities My questions are: 1. Is there an easier way of doing drop down boxed populated from a table? 2. is this foreign key assignment working? 3. is this a good way of doing FK asignments? is there a better way. Please forgive me, I'm old school, more used to the SQL statements 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: how to deal with gender
Michael Pavling wrote: On 29 July 2010 17:25, bingo bob li...@ruby-forum.com wrote: What's the best way of to deal with gender. i.e. a Person is either Male or Female (generally and fot my purposes I'll stick with that rule). I don't know if it's annoying anyone else, but I've been following this thread with interest, but every time I read gender it grates. The word you're after is sex. Male and female are sexes. Masculine, feminine, neutral, etc, are genders... I appreciate that it seems to have become a convention to use the word gender as a polite reference to the discrimination between innies and outies... Not exactly. Sex is biological, gender is psychosocial. There are people of male sex and feminine gender, and vice versa. but for the vast, overwhelming majority there are only two choices; either being male or female, and that's your sex (whether it changes over the duration of your life is a different debate :-) No. Your sex doesn't change over the duration of your life if you're a human (at least, not without surgery, but that's a different debate). Your gender may. I know genderqueer people who don't consistently identify with one gender or another, despite whatever genitalia God gave them. Now, I'd store that in a text field in the record as either the full word, or as m or f, and load the DB and the model up with constraints and validations, and not worry about having a Sex model, with associated sexes table. Move along to other areas of your application. Agreed if we're talking about sexes. For genders, there are more than two categories, and the list might change as other gender categories are recognized (yes, the issue is more complex than you'd think), so I'd probably use a model or at least an enumeration for that. 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: OT ... Pot, meet Kettle (was if then within % % region in html)
On 2 August 2010 17:15, Marnen Laibow-Koser li...@ruby-forum.com wrote: Michael Pavling wrote: On 2 August 2010 16:43, Marnen Laibow-Koser li...@ruby-forum.com wrote: I think it's a guru thinking that it's all right to be uncivil if you know enough -- an opinion I do not really subscribe to *cough* *splutter* :-) You bring up some interesting points here. First of all, do you really think telling people they are wrong is ipso facto uncivil? I do not. I don't really think anything is gained by avoiding the issue. No, I agree that there isn't necessarily a causal relationship between correction and lack of civility. I am aware that I tend toward the blunt side when I write my responses, but I think there's a huge difference between that and the rather mean-spirited tone that I recall noticing the last time I read ESR's essay. I can't comment on a comparison, as I don't recall reading any of the essays. I certainly don't think civil is the same as sugar-coated; I aim for the former, not the latter, on this sort of list. That's fair enough, and nice to hear. for example, you will not see name-calling or ad hominem attacks in my posts Absolutely, and I'd even add, that when people start on you, you don't just tit-for-tat back. OTOH, if someone obviously doesn't know what he's doing, I see no point in not (politely) pointing out that that's the case. Of course, I realize that everyone's sensibilities are different. That's the rub; if you look at the times you've been railed on, it's due to a reply that wasn't interpreted as being that polite. Examples? Examples? I wish I could give some; I had a quick look in the archives, but since you post from Ruby Forum, there's no quick way to filter just your posts. I've probably got some threads way down in my inbox, but don't want to dwell on it too much. I tell you what; next time it all kicks off, we'll dissect it ;-) If you want a guideline: it is vanishingly rare for the sneer to be intentional in my posts. This is part of what I am referring to as civility. I just don't do that unless fairly heavily provoked, and usually not even then. *I* know that :-) But all I'm saying is that a lot of other people seem to not get that, and it was just your claim to an opinion I do not really subscribe that made me spray coffee on my keyboard! PS Please don't anyone think that I'm accusing Marnen of anything I'm probably not worse at; being uncivil and short with people who ask poor, easily Googled questions. -- 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: simple redirect_to shows in log but doesn't redirect
Joshua Mckinney wrote: From inside your create method in the controller, what does request.format return? If the request is a plain old html request is should put text/html If the request is an ajax request is should put text/javascript if the request puts text/html or anything besides text/javascript you can force the format by adding: request.format = :js to the controller method. If I try this def create @story = Story.find(params[:story_id]) @story.comments.create params[:comment] request.format = :js end or this def create @story = Story.find(params[:story_id]) @story.comments.create params[:comment] end both give Comment Create (0.5ms) INSERT INTO comments (created_at, body, updated_at, story_id) VALUES('2010-08-02 16:38:36', 'cat', '2010-08-02 16:38:36', 2) ActionView::MissingTemplate (Missing template comments/create.erb in view path app/views): Still can't see where it's going wrong. In peace Neil -- 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] OT: how to deal with gender
On 2 August 2010 17:29, Marnen Laibow-Koser li...@ruby-forum.com wrote: Michael Pavling wrote: On 29 July 2010 17:25, bingo bob li...@ruby-forum.com wrote: What's the best way of to deal with gender. i.e. a Person is either Male or Female (generally and fot my purposes I'll stick with that rule). Agreed if we're talking about sexes. For genders, there are more than two categories, and the list might change as other gender categories are recognized (yes, the issue is more complex than you'd think), so I'd probably use a model or at least an enumeration for that. As the OP said, s/he needs to store either Male or Female - those are sexes. Certainly I agree on all the musings about gender-identity, and the difference between physiological sex. But that's the point - it's the physiological that I assume the OP wants to record. It might be an interesting experiment to store both sex *and* gender-identity of the subject of the DB, but probably outside the OP's requirement. For genders, there are more than two categories I did say that... 'Masculine, feminine, neutral, etc' but for the vast, overwhelming majority there are only two choices; either being male or female, and that's your sex (whether it changes over the duration of your life is a different debate :-) No. Your sex doesn't change over the duration of your life if you're a human (at least, not without surgery, but that's a different debate). That (the potential surgical change) was my point. But it's interesting that you say Sex is biological (whereas I used physiological), as can biology be changed with surgery - does having my genitals removed change my biological sex as well as my physiologically identifiable sex? If not... does that mean my DB needs three fields?! arrgh! God gave them. right... time for me to stop there :-) -- 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: OT: how to deal with gender
Michael Pavling wrote: On 2 August 2010 17:29, Marnen Laibow-Koser li...@ruby-forum.com wrote: probably use a model or at least an enumeration for that. As the OP said, s/he needs to store either Male or Female - those are sexes. Certainly I agree on all the musings about gender-identity, and the difference between physiological sex. But that's the point - it's the physiological that I assume the OP wants to record. I think this is an open question, and the OP needs to decide this for himself. Baby names would seem to have more to do with gender than sex. This is actually something of a data analysis issue. It might be an interesting experiment to store both sex *and* gender-identity of the subject of the DB, but probably outside the OP's requirement. Probably so. �For genders, there are more than two categories I did say that... 'Masculine, feminine, neutral, etc' I wasn't sure whether you were talking about grammatical gender or sociological gender. but for the vast, overwhelming majority there are only two choices; either being male or female, and that's your sex (whether it changes over the duration of your life is a different debate :-) No. �Your sex doesn't change over the duration of your life if you're a human (at least, not without surgery, but that's a different debate). That (the potential surgical change) was my point. OK. But it's interesting that you say Sex is biological (whereas I used physiological), as can biology be changed with surgery - does having my genitals removed change my biological sex as well as my physiologically identifiable sex? That, I think, depends on how you define biological sex. If you interpret biologically male to mean has a Y chromosome, then no. If you interpret biologically male as possesses a penis, then yes. If not... does that mean my DB needs three fields?! arrgh! I suppose that depends on whether you care about all three pieces of data. I could imagine medical applications where you *would* need all three. God gave them. right... time for me to stop there :-) ? I'm using God as convenient shorthand for God/whatever combination of natural forces came into play here. If that's a discussion-stopper for you, then I'm not sure how to respond to that. :) 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] How to test response from RJS
From a controller rendering and RJS template I get (by printing @response.body): window.location.href = /management/53/questions? participant_id=41amp;question_status=MODERATOR_INBOX; I ma trying to test that response with: assert_select 'window.location.href', management I does not work. Do you know how I can test if there is that redirect in an RJS response? -- 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] if then within % % region in html
On 2 August 2010 15:34, Dave Aronson googlegroups2d...@davearonson.com wrote: On Sun, Aug 1, 2010 at 06:52, Michael Pavling pavl...@gmail.com wrote: You can use conditional checking inline, with normal 'if...else' blocks: Though your approach will work, this looks to me like it's probably logic that more properly belongs in the controller than the view. IMHO using something like: if @my_object.active? �...@activated_msg = 'This is active' else �...@activated_msg = 'You need to activate this one' end # you did mean end for the 2nd else above, yes? I know that you and Marnen have covered this, so I won't go over it too much, but I would add my voice to the it should NOT be in the controller camp. I may reuse the same views from several controller actions, and I don't want to have to duplicate the variable-setting in lots of places. The I don't want view text in my controllers has already been covered. I also don't see the value in setting instance variables to store values that are accessible on the model that's being passed to the view. Also, the conditional block might be being operated on an element of a collection, and I *really* don't want to iterate all my foos to see whether each has bar set true or not (I'm sorry for using active earlier, as it seemed to get the focus of the consideration), and then store that result in another hash... etc. (BTW, note the single quotes; I haven't verified it myself, but heard that they are at least marginally faster for constant strings (i.e., where you *can* use them), since the system won't even *try* to look for vars that need to be interpolated. Makes sense to me.) They are, to all reports, marginally faster, but I still use double quotes everywhere for ease and consistency . It strikes me as premature optimisation to default to single quotes for the minuscule time advantage (and I rarely set strings to variables anyway; generally following the extract variable refactoring pattern instead and call a method to return them - even slower! But easier to maintain ;-) -- 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: Drop down boxes from table data
disruptive tech wrote: Hi I have another question for how best to do this. Now I have been following the tutorial at: http://www.tunaslut.com/learning-ruby-drop-down-lists-in-one-to-many-relationships, however when I change the view over from % @cities.each do |city| % tr td%=h city.city_name %/td td%=h city.country_id %/td to: % @cities.each do |city| % tr td%=h city.city_name %/td td%=h city.country.country_name %/td The system breaks with the following error NoMethodError in Cities#index Showing app/views/cities/index.html.erb where line #12 raised: undefined method `country_name' for nil:NilClass ...which means that city.country is nil. You have to make it not be. Extracted source (around line #12): when attempting to display data on cities My questions are: 1. Is there an easier way of doing drop down boxed populated from a table? collection_select 2. is this foreign key assignment working? 3. is this a good way of doing FK asignments? is there a better way. I don't see any assignment in your code. Please forgive me, I'm old school, more used to the SQL statements What's that got to do with anything? Thanks again. 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] Tables deleted when running rake test:units
Hi there! I'm creating an application in RoR and I'm implementing unit testing in all my models. When I run every test on his own (by running ruby test/unit/some_test.rb) all tests are successful. But when I run all tests together (by running rake test:units) some tables from both databases (development e test) are deleted. I'm using raw SQL (mysql) do create tables because I need composite primary keys and physical constraints so I figured it would be the best. Maybe this be the cause? All my tests are in this form: --- require File.dirname(FILE) + '/../test_helper' require File.dirname(FILE) + '/../../app/models/order' class OrderTestCase Test::Unit::TestCase def setup @order = Order.new( :user_id = 1, :total = 10.23, :date = Date.today, :status = 'processing', :date_concluded = Date.today, :user_address_user_id = 3, :user_address_address_id = 5, :creation_date = Date.today, :update_date = Date.today ) end Happy Path def test_happy_path assert @order.valid?, @order.errors.full_messages end (...) --- The errors I get when running the tests are something like this: 3) Error: test_empty_is_primary(AddressTestCase): ActiveRecord::StatementInvalid: Mysql::Error: Table 'shopshop_enterprise_test.addresses' doesn't exist: SHOW FIELDS FROM addresses /test/unit/address_test.rb:9:in new' /test/unit/address_test.rb:9:insetup' Any guesses? Thanks! PS: When using postgres as the database engine, everything works fine with rake test:units! (of course, with the correct changes so the sql statements can work with postgres) -- 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: Tables deleted when running rake test:units
Simão Freitas wrote: Hi there! I'm creating an application in RoR and I'm implementing unit testing in all my models. When I run every test on his own (by running ruby test/unit/some_test.rb) all tests are successful. Slightly off-topic tip: use RSpec instead of Test::Unit. It's a lot nicer. But when I run all tests together (by running rake test:units) some tables from both databases (development e test) are deleted. That's odd. What is your database.yml file like? I'm using raw SQL (mysql) do create tables With migrations or not? because I need composite primary keys and physical constraints so I figured it would be the best. BAD IDEA! Use the composite_primary_keys and foreigner plugins. Maybe this be the cause? Perhaps. Are all your tables mentioned in schema.rb? All my tests are in this form: --- require File.dirname(FILE) + '/../test_helper' require File.dirname(FILE) + '/../../app/models/order' class OrderTestCase Test::Unit::TestCase def setup @order = Order.new( :user_id = 1, :total = 10.23, :date = Date.today, :status = 'processing', :date_concluded = Date.today, :user_address_user_id = 3, :user_address_address_id = 5, :creation_date = Date.today, :update_date = Date.today ) end You probably should start using factories (I'm fond of Machinist for this). Happy Path def test_happy_path assert @order.valid?, @order.errors.full_messages end (...) --- The errors I get when running the tests are something like this: 3) Error: test_empty_is_primary(AddressTestCase): ActiveRecord::StatementInvalid: Mysql::Error: Table 'shopshop_enterprise_test.addresses' doesn't exist: SHOW FIELDS FROM addresses /test/unit/address_test.rb:9:in new' /test/unit/address_test.rb:9:insetup' Any guesses? Thanks! PS: When using postgres as the database engine, everything works fine with rake test:units! (of course, with the correct changes so the sql statements can work with postgres) 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] Any way around using only 1 render per action?
My program needs to use a render in a controller action. The problem is that the action makes a user list and sends it to wicked_pdf, which uses a render, causing an error if I use one also. Does anyone know a way around this, and is the render I'm using totally necessary?? Here is my controller code. @households = Household.find(:all, :order = last_name, first_name) @households.each { |@household| @today = Date.today @year = @today.year @thisyear = Visit.find_all_by_year_and_household_id(Date.today.year, @household.id) @lastyear = Visit.find_all_by_year_and_household_id(Date.today.year-1, @household.id) @yearbefore = Visit.find_all_by_year_and_household_id(Date.today.year-2, @household.id) render( :action=:printone) } date=`date +%Y%m%d-%H:%M` respond_to do |format| format.pdf { send_data render_to_pdf( :action = 'print', :layout = 'pdf_report'), :filename = Household_List_for_ + date } as the name says, print_one does 1 page of the report for 1 user. It needs the above variables to do the page. Thanks for the help Bob Smith bsm...@gmail.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] Any way around using only 1 render per action?
On 2 August 2010 19:26, Bob Smith bsm...@gmail.com wrote: Does anyone know a way around this render( :action=:printone) and return and is the render I'm using totally necessary?? possibly... but I'm not familiar with wicked_pdf, so can't say for sure. Are you following whatever guidelines they give in their documentation for integrating with Rails? -- 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: How to monitor Cron jobs?
Thanks Peter. One thing though: my script/runner doesn't seem to write a PID file (or at least I can't locate it in the typical places - it might be a right issue). Is there a possibility to manually specify a PID file (either a runner option, or a shell command)? I can't find such option... Pierre -- 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] delayed)_job gem installation issue
here is my environment.rb config.gem 'collectiveidea-delayed_job', :source = 'http:// gems.github.com' gem list | grep coll collectiveidea-delayed_job (1.8.2) The gem infact got installed via rake gems:install. but now when I start my app, it doesn't recognize the gem being installed. Please help. script/generate delayed_job /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb: 119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement no such file to load -- collectiveidea-delayed_job /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ dependencies.rb:156:in `require' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ dependencies.rb:521:in `new_constants_in' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ dependencies.rb:156:in `require' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb: 208:in `load' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `load_gems' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `each' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `load_gems' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:164:in `process' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run' /home/myname/Apps/myapp/config/environment.rb:10 /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/generate.rb:1 /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' script/generate:3 no such file to load -- collectiveidea-delayed_job /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_req -- 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: Tables deleted when running rake test:units
I didn't know about Rspec and Machinist. I'll try them thanks for the recommendation. I'm using composite_primary_keys, I didn't explain myself well lol. I don't use migrations. OH! You're right! There are tables missing from the schema.rb file. Don't know the reason because when I ran the tests (and db creation previously) separately there was no error. Anyway, there's an error in every table that was missing, related to the BIT datatype. Something like this: # Could not dump table addresses because of following StandardError # Unknown type 'bit(1)' for column 'is_primary' So, maybe that datatype isn't supported? I think I'll just use TINYINTs lol By the way, I don't have a very large knowledge about rails, i'm still figuring it out, but here's another question: Can I use migrations with physical constraints in the database? Won't they become nulled and inconsistent after a migration or any change in the database? All that will be lost right? Thanks a lot for your help! -- 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: Tables deleted when running rake test:units
Please quote when replying. It is very difficult to follow the conversation if you don't. Simão Freitas wrote: I didn't know about Rspec and Machinist. I'll try them thanks for the recommendation. You're welcome. I'm using composite_primary_keys, I didn't explain myself well lol. I don't use migrations. Well, start now! There are many advantages and virtually no disadvantages to using migrations. OH! You're right! There are tables missing from the schema.rb file. That would be a serious problem. The test framework uses rake db:schema:load to create the database. Don't know the reason because when I ran the tests (and db creation previously) separately there was no error. Anyway, there's an error in every table that was missing, related to the BIT datatype. Something like this: # Could not dump table addresses because of following StandardError # Unknown type 'bit(1)' for column 'is_primary' So, maybe that datatype isn't supported? I think I'll just use TINYINTs lol Use migrations and you won't have to worry, since Rails handles the abstraction. By the way, I don't have a very large knowledge about rails, i'm still figuring it out, but here's another question: Can I use migrations with physical constraints in the database? You mean such as foreign key constraints? Won't they become nulled and inconsistent after a migration or any change in the database? What gives you that idea? All that will be lost right? No! Use the foreigner plugin like I suggested. Thanks a lot for your help! 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: Admin interface for Rails?
Thanks Andy and David, both seems good solutions! Cheers, Rodrigo Alves Vieira | @rodrigo3n http://rodrigo3n.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: Tables deleted when running rake test:units
I fixed the problem of the disappearing tables with the following code in environment.rb: config.active_record.schema_format = :sql The problem was with some datatypes not recognized by rails (BIT(1) and (YEAR(4)) I guess. All works fine now. But I'll do what you recommend and start using migrations! Again, I can't thank you enough! Thanks a lot! -- 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] setting the size of a textarea
i have noticed this a few times in the past, but right now, i need to get this fixed so that my form will fit inside a div.. i currently have this code: %= text_area @project, :description, :rows = 2, :cols = 20 % which should give me a 20x2 text area... unfortunately, i get a huge text area.. the code that is generated is: textarea cols=20 id=project_description name=project[description] rows=2/textarea which seems to be just fine.. no matter what i change the attributes to, the textarea generated is the same size.. i checked it on chrome and safari.. any help would be greatly appreciated! 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: if then within % % region in html
Michael Pavling wrote: On 2 August 2010 15:34, Dave Aronson googlegroups2d...@davearonson.com wrote: �...@activated_msg = 'You need to activate this one' end �# you did mean end for the 2nd else above, yes? I know that you and Marnen have covered this, so I won't go over it too much, but I would add my voice to the it should NOT be in the controller camp. I may reuse the same views from several controller actions, and I don't want to have to duplicate the variable-setting in lots of places. I, too, have been giving more consideration to unnecessarily using instance variables. A few years ago, I used them all the time, but the more I use partials, the more I prefer to pass variables in :locals. The I don't want view text in my controllers has already been covered. I also don't see the value in setting instance variables to store values that are accessible on the model that's being passed to the view. +1 (BTW, note the single quotes; I haven't verified it myself, but heard that they are at least marginally faster for constant strings (i.e., where you *can* use them), since the system won't even *try* to look for vars that need to be interpolated. �Makes sense to me.) They are, to all reports, marginally faster, but I still use double quotes everywhere for ease and consistency . It strikes me as premature optimisation to default to single quotes for the minuscule time advantage (and I rarely set strings to variables anyway; generally following the extract variable refactoring pattern instead and call a method to return them - even slower! But easier to maintain ;-) This is likely one of those matter of personal preference things. I make it a point to use double quotes *only* when I'm interpolating. It started out as premature optimization, but I also find that when scanning code, I can automatically ignore one or the other depending on what I'm scanning for. If I'm looking for a particular piece of interpolation, I can ignore everything surrounded by single quotes. [ Or, I could just use Find ;) ]. And I suppose one could make the argument that using single quotes except when you need double will save you from having to press the SHIFT key, though I wouldn't be one of them. I used to work with a guy (Delphi developers at the time) who never capitalized anything he didn't have to. I once asked him why and he said it was because he didn't want to waste the keystroke of pressing SHIFT. Different (?:key)?strokes for different folks, I guess. Peace, Phillip -- 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: Problem with non-ascii characters in forms: incompatible character encodings: UTF-8 and ASCII-8BIT
On Sun, Aug 1, 2010 at 9:27 AM, Rolf Pedersen rolf...@gmail.com wrote: I did search the list, and I found people have similar problems with Ruby 1.9.1, but not directly comparable to my issue. In my simple case it DOES work, as long as I use two controller actions instead of just the one... Meanwhile.. yes, do do stick to Ruby 1.8.7 until I know more :o) Best regards, Rolf Fernando Perez wrote: Hahaha! Search the list, and you'll notice that people have already fallen into this trap. Wait 'til Rails 3 AND Ruby 1.9.2 get released to jump to Rails+Ruby1.9 Stick to Rails 2.3.8 and Ruby 1.8.7 until then. I would recommend the following setup: Ruby 1.9.2 RC2 install = rvm install 1.9.2 Rails 3 RC install = gem install rails --pre MySQL 2 Adapter install = gem install mysql2 Note: The MySQL 2 gem should resolve the MySQL encoding issues that people are seeing when using the regular MySQL gem and Ruby 1.9.2. Next, if you're planning to upgrade your application to Rails 3 and Ruby 1.9.2, I would recommend that you begin the process now so that you can provide feedback to the Rails team as well as the Ruby gem/plugin authors. Good luck and happy coding, -Conrad On Sun, Aug 1, 2010 at 2:53 AM, Rolf Pedersen rolf...@gmail.com wrote: Hi First off, I'm using Ruby 1.9.1p378 and Rails 2.3.8. I was creating a minimal application to test handling of Norwegian special characters when I bumped into this strange problem... I have a simple Car model with fields maker:string and model:string. For the controller I planned to just have an index action do all the work: class CarsController ApplicationController def index if request.post? @car = Car.new(params[:car]) @car.save end @cars = Car.find(:all) end # def create #@car = Car.new(params[:car]) #@car.save #redirect_to :action = :index # end end The corresponding view lists all car models and displays a form to support the addition of new car models: h1Cars/h1 table thmaker/ththmodel/th % @cars.each do |car| % tr td%= car.maker %/td td%= car.model %/td td % end % /table % form_for(:car, :url = { :action = index }) do |f| % p %= f.label :maker % %= f.text_field :maker % /p p %= f.label :model % %= f.text_field :model % /p p %= f.submit 'Add' % /p % end % Now, this works fine. until I submit special characters in one of the fields. If I for example write Dodge and Børnout in the form fields, I get an error like this: Encoding::CompatibilityError in Cars#index Showing *app/views/cars/index.html.erb* where line *#19* raised: incompatible character encodings: UTF-8 and ASCII-8BIT Extracted source (around line *#19*): 16: /p 17: p 18: %= f.label :model % 19: %= f.text_field :model % 20: /p 21: p 22: %= f.submit 'Add' % But, the entry is added correctly to the database anyway, so if I just reload http://localhost:3000/cars, I do see the new entry. OK, I thought... I've read quite a few places that there have been (and still are) various issues with support for Unicode in the different Ruby/Rails version combinations, so I figured that I just didn't have the best combination for this. But then I temporarily built a new application by using generate scaffold, and it all works fine there. After some trying and failing I discovered that if I (in my original solution) changed the form_for :url option to :action = create and added a create action in the controller file (commented out in the above controller source), it works with special characters and all. So the only difference is that the form posts the data to the create action instead of the index action, and then it works. I just don't get it! :o/ Anyone has an explanation to offer? Would be much appreciated! :o) Kind regards, Rolf -- 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: Trying to do a user list and getting double render errors..
Finally found a way around this. Only 1 render is allowed at the controller level, but a view can have as many as wanted, so.. Leave the only allowed render in the controller for render_pdf, and do a find(:all) in the controller. In the view with the same name as the controller action, do a %= render :partial = 'whatever', :object = @variable_from_controller % next make a partial view called _whatever.html.erb or _whatever.erb for pdf output. The variable holding one record from the list will be called whatever, with no @ before it. This partial is where whatever output is wanted per record should be done. Bob bsm...@gmail.com On Jul 29, 12:45 am, Bob Smith bsm...@gmail.com wrote: Here is where I am now. A render :partial at the would solve my problem, but another render doesn't seem to be allowed. Render_pdf uses the only one allowed. Is there another way to do this? At the moment, it works fine, but only gives me 1 user, even though it makes the collections for each user. Controller def print @households = Household.find(:all, :order = last_name, first_name) @households.each { |@household| @today = Date.today @year = @today.year @churches = Church.find(:all, :order = name).map {|u| [u.name, u.id]} @thisyear = Visit.find_all_by_year_and_household_id(Date.today.year, @household.id) @lastyear = Visit.find_all_by_year_and_household_id(Date.today.year-1, @household.id) @yearbefore = Visit.find_all_by_year_and_household_id(Date.today.year-2, @household.id) } date=`date +%Y%m%d-%H:%M` respond_to do |format| format.pdf { send_data render_to_pdf( :action = 'print', :layout = 'pdf_report'), :filename = Household_List_for_ + date } end end First view !---style type=text/css td{ text-align: right;} -- % javascript_include_tag :defaults % debugger % get_totals(@household) % preh3 style=text-align:center;font-size: 24px;color:blue;width=100%Food Shelf/h3 % form_for @household, :url = household_path(@household), :html = { :method = 'put' } do |household| % table border=1 width=100% td colspan=2 tabletdFamily Size /tdtd style=color:redbig%= @family%/ big/tdtd 0-4 Years /tdtd style=color:redbig%= @under5 %/big/tdtd 5-17 Years /tdtd style=color:redbig%= @child %/big/tdtd 18-64 Years / tdtd style=color:redbig%= @adult %/big/tdtd 65 Over td/tdtd style=color:redbig%= @senior %/big/td/ table trtd width=70% valign=top %= render :partial = 'household', :object = @household % /td td class=people width=30% valign=top %= render :partial = 'people', :object = @household % /td /tr tr debugger table trh4Visits to Foodshelf/h4/tr trtd class=visit width=33% bMonth of %= Date.today.year %/b table border=1 width=30% trth width=30%Monthly/th th width=10%/th th width=60%bBread Veg only for Week/b/th/tr th width=5%1/th th width=5%2/th th width=5%3/th th width=5%4/th th width=5%5/th /tr %= render :partial = 'visit', :object = @thisyear % /table /td td class=visit2 width=33% bMonth of %= Date.today.year-1 %/b table border=1 width=30% trth width=30%Monthly/th th width=10%/th th width=60%bBread Veg only for Week/b/th/tr th width=5%1/th th width=5%2/th th width=5%3/th th width=5%4/th th width=5%5/th /tr %= render :partial = 'visit', :object = @lastyear % /table /td td class=visit width=33% bMonth of %= Date.today.year-2 %/b table border=1 width=30% trth width=30%Monthly/th th width=10%/th th width=60%bBread Veg only for Week/b/th/tr th width=5%1/th th width=5%2/th th width=5%3/th th width=5%4/th th width=5%5/th /tr %= render :partial = 'visit', :object = @yearbefore % /table /td /pre % end % /table !-- PAGE BREAK -- -- 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: Tables deleted when running rake test:units
For the second time: please quote when replying! Simão Freitas wrote: I fixed the problem of the disappearing tables with the following code in environment.rb: config.active_record.schema_format = :sql The problem was with some datatypes not recognized by rails (BIT(1) and (YEAR(4)) I guess. All works fine now. In most cases, if you have to use schema_format = :sql, something is wrong. But I'll do what you recommend and start using migrations! Again, I can't thank you enough! Thanks a lot! 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: Tables deleted when running rake test:units
Marnen Laibow-Koser wrote: For the second time: please quote when replying! Sorry :X Simão Freitas wrote: I fixed the problem of the disappearing tables with the following code in environment.rb: config.active_record.schema_format = :sql The problem was with some datatypes not recognized by rails (BIT(1) and (YEAR(4)) I guess. All works fine now. In most cases, if you have to use schema_format = :sql, something is wrong. Hum.. I'll see what I can figure out! Thanks again But I'll do what you recommend and start using migrations! Again, I can't thank you enough! Thanks a lot! 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.
Re: [Rails] setting the size of a textarea
On Mon, Aug 2, 2010 at 12:37 PM, Sergio Ruiz li...@ruby-forum.com wrote: %= text_area @project, :description, :rows = 2, :cols = 20 % which should give me a 20x2 text area... unfortunately, i get a huge text area.. What does that mean, exactly? -- 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] Re: Admin interface for Rails?
I posted on my blog a few alternatives with screenshots ... Take a look there ... Is in pt-BR, but has pictures and links and easy to understand ... http://marcus-sa.posterous.com/interfaces-para-areas-de-admin-em-rails Regards 2010/8/2 rodrigo3n rodrig...@gmail.com: Thanks Andy and David, both seems good solutions! Cheers, Rodrigo Alves Vieira | @rodrigo3n http://rodrigo3n.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. -- _ Marcus Sá http://www.woompa.com.br Starting up for never stop! -- 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: setting the size of a textarea
It's possible you have a style that is overwriting the rows and cols attribute. -- 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: setting the size of a textarea
Sergio Ruiz wrote: i have noticed this a few times in the past, but right now, i need to get this fixed so that my form will fit inside a div.. i currently have this code: %= text_area @project, :description, :rows = 2, :cols = 20 % which should give me a 20x2 text area... unfortunately, i get a huge text area.. the code that is generated is: textarea cols=20 id=project_description name=project[description] rows=2/textarea I see nothing wrong with this. I even used Safari's Web Inspecting on the very text area I'm typing this response into. The text area size updated as expected. Are you sure you don't have a CSS style-sheet that is overriding your rows and cols attributes on your text area? Also note that Safari (not sure about Chrome) allows the user to resize text areas. Even so, Safari will still respect the rows and cols attributes as the starting size for text areas. -- 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: OT: how to deal with gender
Marnen Laibow-Koser wrote: Michael Pavling wrote: On 2 August 2010 17:29, Marnen Laibow-Koser li...@ruby-forum.com wrote: probably use a model or at least an enumeration for that. As the OP said, s/he needs to store either Male or Female - those are sexes. Certainly I agree on all the musings about gender-identity, and the difference between physiological sex. But that's the point - it's the physiological that I assume the OP wants to record. I think this is an open question, and the OP needs to decide this for himself. Baby names would seem to have more to do with gender than sex. This is actually something of a data analysis issue. Well, this discussion certainly has gone down the rabbit hole so to speak. I mean let's face it. When people think about baby names. and creating lists of them for a boy or a girl this discussion of sex vs. gender, and attempts to define either, completely misses the point. What about the boy named Sue? It really only matters to the individual picking the name whether they consider it suitable as a boy's name, a girl's name or both. All that's required is that the name can be categorized by the person creating the lists. -- 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: setting the size of a textarea
Tim Shaffer wrote: It's possible you have a style that is overwriting the rows and cols attribute. For my experience, it's better to not use rows and cols for dimensioning textareas, because the dimensions of the textarea will depend from the dimensions of the row and of the column, that rely to font properties and change from browser to browser; it would be a good choice to set dimensions with css (width and height, to be clear). Consider this: html head /head body textarea cols=10 rows=10 style=font-size: 10px/textareabr textarea cols=10 rows=10 style=font-size: 20px/textareabr /body /html textareas dimensions are very different; this: html head /head body textarea cols=10 rows=10 style=font-family: Arial/textareabr textarea cols=10 rows=10 style=font-family: Verdana/textareabr /body /html I obtain 136x208 vs 138x228; on Firefox, 79x164 vs 89x164 on Chromium -- 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: setting the size of a textarea
Tim Shaffer wrote: It's possible you have a style that is overwriting the rows and cols attribute. you guys are correct! i am using blueprint CSS with this site.. unfortunately, this box is not bounded by a span-# div, so it makes some assumptions about the width of the textarea tag.. one of them being a default width of 390px. i overrode it in my main css, and everything is fine.. i didn't think that such things would be overridden.. but after taking a look at the code for screen.css, it really makes sense, and it's really smart.. thanks 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: Problem with Thinking Sphinx
Hi Mike The reason for the message in the logs is that Thinking Sphinx/Sphinx only knows the ids of your search results, and needs to load the actual objects to return - hence why it talks to the database as well. As for post_desc - this isn't available as a method anywhere (on the search collection or search results) - the alias you've given that column is only for Sphinx, not Ruby. So you can use it when searching: Post.search :conditions = {:post_desc = 'foo'} But if you want the value of post_desc, you will need to access it as description: post = Post.search('foo').first post ? post.description : 'No Post' Hope this clarifies things. If you have any more questions, feel free to ask on the Thinking Sphinx Google Group (I only spotted your posts here via some noisy twitter bots): http://groups.google.com/group/thinking-sphinx Cheers -- Pat On Aug 2, 11:51 pm, Mike Disuza li...@ruby-forum.com wrote: Hi, I am implementing the sphinx search using Thinking Sphinx search. I have done everything configured. I have added the index fields in my model like this define_index do indexes :name,:sortable = true indexes description has created_at, updated_at end My sphinx configuration file is as source post_core_0 { type = mysql sql_host = localhost sql_user = root sql_pass = sql_db = development sql_sock = /var/lib/mysql/mysql.sock sql_query_pre = SET NAMES utf8 sql_query_pre = SET TIME_ZONE = '+0:00' sql_query = SELECT SQL_NO_CACHE `posts`.`id` * 1 + 0 AS `id` , `posts`.`name` AS `name`, `posts`.`description` AS `description`, `posts`.`id` AS `sphinx_internal_id`, 1921285768 AS `class_crc`, 0 AS `sphinx_deleted`, IFNULL(`posts`.`name`, '') AS `name_sort`, UNIX_TIMESTAMP(`posts`.`created_at`) AS `created_at`, UNIX_TIMESTAMP(`posts`.`updated_at`) AS `updated_at` FROM `posts` WHERE `posts`.`id` = $start AND `posts`.`id` = $end AND deleted = 0 GROUP BY `posts`.`id` ORDER BY NULL sql_query_range = SELECT IFNULL(MIN(`id`), 1), IFNULL(MAX(`id`), 1) FROM `posts` sql_attr_uint = sphinx_internal_id sql_attr_uint = class_crc sql_attr_timestamp = created_at sql_attr_timestamp = updated_at sql_attr_str2ordinal = name_sort sql_query_info = SELECT * FROM `posts` WHERE `id` = (($id - 0) / 1) } The searching works well but I am seeing in the log that it is firing a queri like SELECT * FROM `posts` WHERE `id` = (1,2) Is my configuration right? Also, if I am doing indexing like indexes description, :as= :post_desc and if I try to access it like this:- search=ThinkingSphinx.search test puts search.post_desc Giving me an error that post_desc is undefined. Can anyone tell me wwhat is happening? Thanks, Mike -- 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: Development Environment (Beginners Question)?
I use Windows Vista for a lot of my RoR development as it's convenient for me with my current setup even though I run an Ubuntu box as well. Not everything works in windows, as you might expect, but 95% of it does. This is with a regular ruby install, no instant rails- which is out of date. You will learn quite a bit using windows. Some of the stuff you learn - how to trouble shoot malfunctioning gems for example - will be invaluable to you later on. If you have some major computer horsepower you can go the virtual route, but it might be better to dual boot linux. My advice is to try installing ruby and rails in win 7 first. Take notes and blog about it. On Aug 1, 6:29 am, Michael Pavling pavl...@gmail.com wrote: On 1 August 2010 06:16, ncage choclab...@gmail.com wrote: is a windows machine good enough to get started with ROR Development? Honestly, without trying to be contentious: no. You *can* get along getting into Rails using Windows (I started that way with InstantRails), but you will discover occasional things that don't work *quite* how you expect, especially when you get to using lots of third-party plugins/gems. You will probably be better off, going straight into a *nix environment of some description. The easiest solution is to use a VM (either install your own, or use the out-of-the-box VirtualRails [1] for an all-in-one solution, or the TurnkeyLinux Rails Server [2], either of which you can then customise to your heart's content). But if you want to make the leap to Ubuntu as a desktop OS it does cut out the hypervising midle-man :-) [1]http://www.virtualrails.org/ [2]http://www.turnkeylinux.org/rails -- 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: Prefix a drop-down with Select Item -- Rails way?
Hey Dave, I was baby sitting my 14-yo granddaughter for a week, so that kept me away from my project. Thinking about my project during some idle time today, I realized I should put my setup-code in the Vendor- controller. As I was about to that, I reread your post to and discovered you had provided an answer buried in a lot of distracting verbiage: you're putting controller logic in your view That's the simple and direct answer to my question. I appreciate you providing it and wish that it had been provided as the first line of your response. Nevertheless, thank you for confirming what I thought about today. Best wishes, Richard On Jul 20, 4:24 pm, Dave Aronson googlegroups2d...@davearonson.com wrote: On Tue, Jul 20, 2010 at 16:08, RichardOnRails richarddummymailbox58...@uscomputergurus.com wrote: I know of no threshold of Rails expertise before posting questions on this newsgroup. Nope, nor even for posting answers, as I amply demonstrate. :-) I suspect that people with high levels of Rails respond to a question like mine: - in order to enlarge the Rails community - for: the joy of helping their fellow humans - with the expectation the their responses will bring the consulting opportunities - or heap scorn on those whom they perceive as inferior I think you have read more into my post, than I intended. I certainly did not mean to heap scorn on you, only to help you realize what specific concept you seem to be failing to understand. Putting a name on it helps you find information about it. You seem to be in need of brushing up on MVC because you're putting controller logic in your view, and apparently some people have corrected you on this (anti-)pattern several previous times. (Unfortunately, controller and view are not like chocolate and peanut butter) Peace? Joy? Consultancy? ;-) -Dave -- Specialization is for insects. | Professional:http://davearonson.com -Robert Anson Heinlein | Programming: http://codosaur.us ---+ Leadership: http://dare2xl.com Have Pun, Will Babble! -me | Et Cetera: http://davearonson.net -- 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.