[Rails] How do I stop email from being delivered in the interceptor?
Hi, I am developing a rails 3 application. I want to use a interceptor before delivering emails. If a conditions meets, I want to stop the email. How do I do that? Thanks. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, 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] ActionMailer: hostname was not match with the server certificate
Hi, I am setting up SMTP for my Rails 3 App. This configuration works. ActionMailer::Base.delivery_method = :smtp ActionMailer::Base.smtp_settings = { :address = smtp.gmail.com, :port = 587, :domain = mydomain.com, :user_name= username, :password = password, :authentication = plain, :enable_starttls_auto = true } But this configuration doesn't. It gives hostname was not match with the server certificate ActionMailer::Base.delivery_method = :smtp ActionMailer::Base.smtp_settings = { :address = some_other_server.com, :port = 587, :domain = mydomain.com, :user_name= username, :password = password, :authentication = plain, :enable_starttls_auto = true } Strangely, the same configuration works in Rails 2.3.8. (:tls = true) What's wrong? Thanks. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Is this a bug of accepts_nested_attributes_for ?
Hi, I've been digging a bug for 3 days. I pin-pointed the problem line of codes. It's not my code but the activerecord code. The problem is with the activerecord-3.0.3/lib/active_record/nested_attributes.rb line# 376: association.send(:add_record_to_target_with_callbacks, existing_record) if !association.loaded? !call_reject_if(association_name, attributes) I realized that the line was changed from activerecord-3.0.0. (which works well) It used to be: association.send(:add_record_to_target_with_callbacks, existing_record) unless association.loaded? The problem is: _destroy option doesn't work for nested attributes if the association is not loaded. I don't think that's the feature. Here's how I tested it in console. (I intentionally removed some outputs for simplicity.) Loading development environment (Rails 3.0.3) ruby-1.8.7-p302 post=Post.find 204 ruby-1.8.7-p302 post.attachments.loaded? = false ruby-1.8.7-p302 post.attributes={attachments_attributes={0={id=44, _destroy=1}}} ruby-1.8.7-p302 post.save = true ruby-1.8.7-p302 post.attachments.map { |i| i.id }.join(, ) = 44, 45, 46, 47, 48, 49 #44 is still there. ruby-1.8.7-p302 post.attributes={attachments_attributes={0={id=44, _destroy=1}}} # Now I try to destroy it again when the attachments are loaded. ruby-1.8.7-p302 post.save = true ruby-1.8.7-p302 post.attachments.reload # To make sure that attachments are reloaded after the change. ruby-1.8.7-p302 post.attachments.map { |i| i.id }.join(, ) = 45, 46, 47, 48, 49 # Now 44 is gone. Can anybody confirm that this is a bug? Thanks. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, 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] Question about accepts_nested_attributes_for and reject_if
Hi, I am developing a rails 3.0.3 application and accepts_nested_attributes_for method is giving me pains. To simplify the issue, I created a new app and generated 2 models. users name: string cars -- user_id: integer name: string class User ActiveRecord::Base has_many :cars accepts_nested_attributes_for :cars, :allow_destroy = true, :reject_if = proc { |attrs| attrs['name'].blank? } end class Car ActiveRecord::Base belongs_to :user end Very simple, huh? In console, I created a user and create 2 cars for the user. u = User.first u.cars_attributes={0={id=2, _destroy=1}} u.save This should destroy the car but didn't. If I modify the User model like accepts_nested_attributes_for :cars, :allow_destroy = true Then, it works as I expect meaning it destroy the car with the same code in the console. If I modify the line like the following, it works also. accepts_nested_attributes_for :cars, :allow_destroy = true, :reject_if = proc { |attrs| attrs['id'].blank? and attrs['name'].blank? } As I understand it, reject_if option is only for new instance not for destroyed instance. Am I wrong? Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, 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] Weird Rails 3 Route Problem
Hi, I am using simple_captcha. It worked find until I add the following line to routes.rb match :controller(/:action), :constraints = {:controller = /sandbox\/[^\/]+/} The captcha image is not showing and the log shows the following error message. Started GET /simple_captcha/8cdf70c193dc8823f281828f11c250e1739883da?time=1294644088 for 127.0.0.1 at Sun Jan 09 23:21:29 -0800 2011 AbstractController::ActionNotFound (The action '8cdf70c193dc8823f281828f11c250e1739883da' could not be found for SimpleCaptchaController): Why does the line in the routes affect simple_captcha? Thanks. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Relay Access Denied
Hi, I have several rails applications on a shared hosting. To avoid the server's restriction of sending mails, I use an external SMTP. It works most of times but for some sender emails it gives an error. Net::SMTPFatalError (554 5.7.1 sam.s.k...@gmail.com: Relay access denied The error happens if sender's domain is gmail.com, yahoo.com or hotmail.com. But it works most other domains. How do I avoid this error? The smtp configuration is like the following. config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :tls = true, :address = smtpdomain.com, :port = 587, :domain = www.mydomain.com, :user_name = my_user_name, :password = my_pasword, :authentication = :plain } Thanks. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] passenger for both rails 2.3 and 3.0
Hi, I installed ruby 1.8.7 and passenger 3.0 for apache2 on Ubuntu 10.10. Rails 2.3 works fine. But Rails 3.0 gives an error saying that rack version is not 1.2.1. If I upgrade the rack to 1.2.1, then rails 2.3 app complains that the rack version is not ~1.1.0. How do I satisfy both rails 2.3 and 3.0? Passenger standalone seems to be an option but I want to know if there's a better way. Thanks. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Where can I find the full document for rails application template?
Hi, I am trying to learn how to use rails application template (as in rails new app_name -m temaplate). I can find some examples but I can't find full document for the APIs. Does anyone know where the document is? Thanks. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Passenger is not working
Hi, I just installed passenger 3.0.(on rvm system, using sudo). Strangely, gem path was not found. So I did sudo /var/lib/gems/1.8/bin/passenger-install-apache2-module. Installation process was smooth. I modified httpd.conf and added myapp.local configuration and modified hosts for the local domain. I also reloaded apache2. When I visit the site from my browser, it just shows blank page. No error. What did I miss? Thanks. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Problem while installing passenger for apache
Hi, I am trying to install passenger 3.0 for apache2 on Ubuntu 10.10. It says that I need to install libopenssl-ruby. But when I did 'sudo apt-get install libopenssl-ruby', I got the following error. Reading package lists... Done Building dependency tree Reading state information... Done Note, selecting 'libruby' instead of 'libopenssl-ruby' libruby is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded. How do I install libopenssl-ruby? Thanks. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] gvim error with rails.vim
Hi, I just installed Ubuntu 10.10 and vim 7.2.330. I Use rails.vim and set it auto-start when pwd is rails directory. vim works find. However, gvim gives errors. Error detected while processing function SNR18_menuBufEnter. E117: Unknown function rails#app E15: Invalid expression: rails#app... And some more error messages related to rails#app. Why doesn't gvim work while vim works fine? rails.vim is the latest, by the way. Thanks. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] When to use 'bundle package'
Hi, If you do 'bundle install vendor', gems will be installed in the application. Then, you can deploy it to your production server. When do you need to do 'bundle package'? If you do 'bundle package', the gem files will be in vendor/cache. Do you normally add vendor/cache to your git repository? Thanks. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Rails 3 routing for namespaced controllers
Hi, I need to use legacy-style routing. And it's namespaced. According to http://edgeguides.rubyonrails.org/routing.html, it should be like the following. match ':controller(/:action(/:id))', :controller = /admin\/[^\/]+/ /admin/c1/a1 works fine. But the problem is that, if I have /c2/a2 (note it's not namespaced with admin) /admin/c2/a2 also works even if I don't have Admin::C2Controller. So /admin/c2/a2 is mapped to c2#a2. This might not be a big problem but I feel it's weird. What do you think? Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: What's the best way to solve this?
Colin Law wrote: On 16 August 2010 06:05, Sam Kong li...@ruby-forum.com wrote: Hi, Here's a situation: A product belongs to multiple categories and the categories are top menus of a site. That does not make sense, do you mean product has_many categories, or more likely category has_many products and product belongs_to category. Sorry. I was not clear about this. Product and Category are m:n relationship. Actually there's a Categoryship model. I want to highlight the category of a product when the product detail page is loaded. If there's some context, I can determine which category should be highlighted. (For example, I can track the categories that a user selected). But sometimes there's no context (for example, the user visits the page directly without getting through categories). If you have a product, @product say, then the the category of the product is @product.category, assuming you have setup the ActiveRecord relationships correctly. Colin -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: What's the best way to solve this?
Colin Law wrote: On 16 August 2010 17:10, Sam Kong li...@ruby-forum.com wrote: category. Sorry. I was not clear about this. Product and Category are m:n relationship. Actually there's a Categoryship model. It would be easier if you could just supply the relationships. I think you are saying category has_many products through categoryship and product has_many categories through categoryship also. In that case if you have a product then the categories are available as @product.categories. I am not sure what your question is. You are understanding the relationships correctly. The problem is that @product.categories is multiple. I need to highlight only 1 category for the product and show only 1 breadcrumb. If there's some path that the user took, I can select the category but if there's no such context, I don't know what to do. I can make my own policy but I want to know how other developers are doing. Thanks. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Re: What's the best way to solve this?
Hassan Schroeder wrote: On Mon, Aug 16, 2010 at 10:02 AM, Sam Kong li...@ruby-forum.com wrote: The problem is that @product.categories is multiple. I need to highlight only 1 category for the product and show only 1 breadcrumb. If there's some path that the user took, I can select the category but if there's no such context, I don't know what to do. I can make my own policy but I want to know how other developers are doing. So instead of _products_ _category_ product you could do _products_ { multiple categories } product where the { multiple categories } is a mouseover dropdown to show the list of relevant category links. Yes, that will do. Our top menus are categories. I need to highlight the category. Do you have any good idea for that? Thanks. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Re: Re: What's the best way to solve this?
Hassan Schroeder wrote: On Mon, Aug 16, 2010 at 10:19 AM, Sam Kong li...@ruby-forum.com wrote: Our top menus are categories. I need to highlight the category. Do you have any good idea for that? Well, some choices are to highlight 1) none of the categories 2) all of the relevant categories equally 3) one, based on some heuristic like most used to access this product 4) all relevant categories with differential highlighting (i.e. visual ranking) using the measure from #3 I hesitate suggesting one without seeing the whole thing in context :-) HTH, -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan You were very helpful. Thanks. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Best way to render partial
Hi, I wonder which is better between [1] and [2]. [1] --layouts/application.html.erb ... div id=content %= yield % /div ... ---some_action.html.erb ... h1Page title/h1 pSome contents.../p ... [2] --layouts/application.html.erb ... %= yield % ... ---some_action.html.erb div id=content ... h1Page title/h1 pSome contents.../p ... /div Practically they are same. I think [1] is more DRY. But I feel kinda weird with [1] because the wrapper div is separated from the real content. Which do you think is better? Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] What's the best way to solve this?
Hi, Here's a situation: A product belongs to multiple categories and the categories are top menus of a site. I want to highlight the category of a product when the product detail page is loaded. If there's some context, I can determine which category should be highlighted. (For example, I can track the categories that a user selected). But sometimes there's no context (for example, the user visits the page directly without getting through categories). How can you solve this problem? Thanks. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Passenger can't find rails gem
rholmes wrote: I fixed this on my machine as follows: The boot.rb file is the one that was generating this message, in a method called 'load_rails_gem'. If you print the value of the variable 'load_error' it will give you a specific error message as to why the gem wouldn't load. In my case, it was a mismatched version of rack; I installed a down-revision and everything worked. -Richard. Thanks Rechard. I'll try that. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Passenger can't find rails gem
Sam Kong wrote: rholmes wrote: I fixed this on my machine as follows: The boot.rb file is the one that was generating this message, in a method called 'load_rails_gem'. If you print the value of the variable 'load_error' it will give you a specific error message as to why the gem wouldn't load. In my case, it was a mismatched version of rack; I installed a down-revision and everything worked. -Richard. Thanks Rechard. I'll try that. Sam Oops! I misspelled your name, Richard. Sorry. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Passenger can't find rails gem
Hi, I installed rvm on my OS X Snow Leopard. And I installed ruby 1.8.7 and gemset rails3. I also installed passenger. My rails app runs find with 'rails server'. However it doesn't run on passenger. Error message is: Could not find gem 'rails (= 3.0.0.beta4, runtime)' in the gems available on this machine. (Bundler::GemNotFound) I added the following line to config.ru: ENV[GEM_PATH] = /Users/ssk/.rvm/gems/ruby-1.8.7-p...@rails3 /etc/apache2/other/passenger.conf has the following: LoadModule passenger_module /Users/ssk/.rvm/gems/ruby-1.8.7-p...@rails3/gems/passenger-2.2.15/ext/apache2/mod_passenger.so PassengerRoot /Users/ssk/.rvm/gems/ruby-1.8.7-p...@rails3/gems/passenger-2.2.15 PassengerRuby /Users/ssk/.rvm/rubies/ruby-1.8.7-p299/bin/ruby Why can't passenger find rails? Thanks. Sam --ADDITIONAL INFO--- gem env is RubyGems Environment: - RUBYGEMS VERSION: 1.3.7 - RUBY VERSION: 1.8.7 (2010-06-23 patchlevel 299) [i686-darwin10.0.0] - INSTALLATION DIRECTORY: /Users/ssk/.rvm/gems/ruby-1.8.7-p...@rails3 - RUBY EXECUTABLE: /Users/ssk/.rvm/rubies/ruby-1.8.7-p299/bin/ruby - EXECUTABLE DIRECTORY: /Users/ssk/.rvm/gems/ruby-1.8.7-p...@rails3/bin - RUBYGEMS PLATFORMS: - ruby - x86-darwin-10 - GEM PATHS: - /Users/ssk/.rvm/gems/ruby-1.8.7-p...@rails3 - /Users/ssk/.rvm/gems/ruby-1.8.7-p...@global - GEM CONFIGURATION: - :update_sources = true - :verbose = true - :benchmark = false - :backtrace = false - :bulk_threshold = 1000 - REMOTE SOURCES: - http://rubygems.org/ *** LOCAL GEMS *** abstract (1.0.0) actionmailer (3.0.0.beta4) actionpack (3.0.0.beta4) activemodel (3.0.0.beta4) activerecord (3.0.0.beta4) activeresource (3.0.0.beta4) activesupport (3.0.0.beta4) arel (0.4.0) builder (2.1.2) bundler (0.9.26) erubis (2.6.6) fastthread (1.0.7) i18n (0.4.1) mail (2.2.5) memcache-client (1.8.5) mime-types (1.16) mysql (2.8.1) passenger (2.2.15) polyglot (0.3.1) rack (1.2.1, 1.1.0) rack-mount (0.6.6) rack-test (0.5.4) rails (3.0.0.beta4) railties (3.0.0.beta4) rake (0.8.7) rdoc (2.5.8) text-format (1.0.0) text-hyphen (1.0.0) thor (0.13.7) treetop (1.4.8) tzinfo (0.3.22) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Passenger can't find rails gem
Leonardo Mateo wrote: On Wed, Jul 7, 2010 at 7:21 AM, Sam Kong li...@ruby-forum.com wrote: Could not find gem 'rails (= 3.0.0.beta4, runtime)' in the gems PassengerRuby /Users/ssk/.rvm/rubies/ruby-1.8.7-p299/bin/ruby Why can't passenger find rails? How did you installed passenger? I think you must install it using rvmsudo if you're using RVM: rvmsudo passenger-install-apache2-module Take a look at this: http://rvm.beginrescueend.com/integration/passenger/ Yes, I used rvmsudo. Thank you. Sam �- RUBY VERSION: 1.8.7 (2010-06-23 patchlevel 299) [i686-darwin10.0.0] �- GEM CONFIGURATION: erubis (2.6.6) rack-test (0.5.4) rails (3.0.0.beta4) railties (3.0.0.beta4) rake (0.8.7) rdoc (2.5.8) text-format (1.0.0) text-hyphen (1.0.0) thor (0.13.7) treetop (1.4.8) tzinfo (0.3.22) -- -- Leonardo Mateo. There's no place like ~ -- 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 do I upgrade rack in my current rails app?
Hi, I have a rails 2.3.8 app which has rack 1.1.0. I get parse_multipart error. There's a new release of rack 1.2.0 which might fix the multipart error. The question is how I upgrade the rack? I froze the rails. I did gem update rack and it upgraded rack to 1.2.0. But my rails app still uses rack 1.1. How do I set the rails app use rack 1.2.0? Thanks. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: How do I upgrade rack in my current rails app?
Robert Walker wrote: Sam Kong wrote: I have a rails 2.3.8 app which has rack 1.1.0. I get parse_multipart error. There's a new release of rack 1.2.0 which might fix the multipart error. The question is how I upgrade the rack? I froze the rails. I did gem update rack and it upgraded rack to 1.2.0. But my rails app still uses rack 1.1. How do I set the rails app use rack 1.2.0? Sorry, I don't know exactly how to resolve your issue, but I can tell you this much. Rails version 2.3.5 used a version of Rack prior to 1.1.0 (I don't remember the exact version). Rails used that version even when a newer Rack gem was installed. Apparently its dependency is restricted it to use the older version only. Maybe Rails 2.3.8 is doing something similar for Rack 1.1.0. What indication do you have that upgrading to Rack 1.2.0 will solve your problem? Did you read that somewhere, or are you just guessing? If the latter then you're probably wasting your time. If Rails 2.3.8 were having issues with the version of Rack installed, then it seems likely that a lot of people would be having the same problem. I've not actually been able to try Rails 2.3.8, because I can't install it on one of my machines for some reason. I haven't figured out why. And, with Rails 3.0 so close to release I may skip 2.3.8 altogether. It seems like it still has some issues anyway. Hi Robert, According to the release note, 1.2.0 has Various multipart fixes June 13th, 2010: Tenth public release 1.2.0. * Removed Camping adapter: Camping 2.0 supports Rack as-is * Removed parsing of quoted values * Add Request.trace? and Request.options? * Add mime-type for .webm and .htc * Fix HTTP_X_FORWARDED_FOR * Various multipart fixes * Switch test suite to bacon Thank you for your reply. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Rack error: bad body content
Hi, I get an error like the following. /!\ FAILSAFE /!\ 05/27/2010 12:50 Status: 500 Internal Server Error bad content body /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/utils.rb:319:in `parse_multipart' It happens when I update a page with images. This doesn't happen on development server though. So it might be rack version related. My development server has rack 1.0 bundled. The production server has rack 1.0.1. Both are rails 2.3.2. Any idea how to fix this problem? Thanks. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] What does attachment_fu do when saving?
Hi, I have a model with attachment_fu. The model saves images but I didn't put validates_as_attachment. I understand that it takes long time to create an object as it has to process images. But I don't understand why it takes long time to update the object (not changing file but only modify other non-attachment_fu attributes). If I do object.save(false), it doesn't take long time. So my question is... What's the difference between object.save and object.save(false) when the object is attachment_fu model and there's no validation? Thanks. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] attachment_fu slows down update
Hi, I use attachment_fu and it slows down update. [Models] product has many pictures. [Update] product.update_attributes(pictures_attributes={ 6={_delete=0, color_id=3, id=2953}, 11={_delete=0, color_id=9, id=2921}, 22={_delete=0, color_id=24, id=2977}, 7={_delete=0, color_id=4, id=2965}, 12={_delete=0, color_id=10, id=2949}, 23={_delete=0, color_id=27, id=2969}, 8={_delete=0, color_id=5, id=2917}, 13={_delete=0, color_id=11, id=2913}, 24={_delete=0, color_id=28, id=2985}, 9={_delete=0, color_id=7, id=2989}, 14={_deete=0, color_id=12, id=2973}, 25={_delete=0, color_id=77, id=2997}, 15={_delete=0, color_id=13, id=2925}, 0={_delete=0, color_id=, id=2937}, 16={_delete=0, color_id=14, id=2941}, 1={_delete=0, color_id=, id=2981}, 17={_delete=0, color_id=14, id=1897}, 2={_delete=0, color_id=, id=2961}, 18={_delete=0, color_id=16, id=2929}, 3={_delete=0, colo_id=2, id=2909}, 19={_delete=0, color_id=17, id=2945}, 20={_delete=0, color_id=18, id=2957}, 4={_delete=0, color_id=2, id=1893}, 10={_delete=0, color_id=8, id=2993}, 21={_delete=0, color_id=21, id=2933}, 5={_delete=0, color_id=3, id=1901} }) This takes 15 seconds. The workaround I found is product.attributes = pictures_attributes={ 6={_delete=0, color_id=3, id=2953}, 11={_delete=0, color_id=9, id=2921}, 22={_delete=0, color_id=24, id=2977}, 7={_delete=0, color_id=4, id=2965}, 12={_delete=0, color_id=10, id=2949}, 23={_delete=0, color_id=27, id=2969}, 8={_delete=0, color_id=5, id=2917}, 13={_delete=0, color_id=11, id=2913}, 24={_delete=0, color_id=28, id=2985}, 9={_delete=0, color_id=7, id=2989}, 14={_deete=0, color_id=12, id=2973}, 25={_delete=0, color_id=77, id=2997}, 15={_delete=0, color_id=13, id=2925}, 0={_delete=0, color_id=, id=2937}, 16={_delete=0, color_id=14, id=2941}, 1={_delete=0, color_id=, id=2981}, 17={_delete=0, color_id=14, id=1897}, 2={_delete=0, color_id=, id=2961}, 18={_delete=0, color_id=16, id=2929}, 3={_delete=0, colo_id=2, id=2909}, 19={_delete=0, color_id=17, id=2945}, 20={_delete=0, color_id=18, id=2957}, 4={_delete=0, color_id=2, id=1893}, 10={_delete=0, color_id=8, id=2993}, 21={_delete=0, color_id=21, id=2933}, 5={_delete=0, color_id=3, id=1901} }) product.save false This is fast but I am not sure this is the right way. Is there a better way? Thanks. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] I cannot install Rails 3.0 on my OS X
Hi, I've upgraded ruby to 1.8.7. But when I tried to install rails 3.0, it said that I need ruby 1.8.7 or higher. ruby-1.8.7-p248$ ruby -v ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-darwin9.8.0] ruby-1.8.7-p248$ sudo gem install rails --pre ERROR: Error installing rails: activesupport requires Ruby version = 1.8.7. What should I do? Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] attachment_fu generates wrong public_filename
Hi, attachment_fu generates wrong public_filename. pic.thumbnails = ProductPicture id: 12331, product_id: nil, parent_id: 12330, content_type: image/png, filename: b_9788994035109_mid.png, thumbnail: mid, size: 16562, width: 205, height: 205, created_at: 2009-10-05 02:43:50, updated_at: 2009-10-05 02:43:50, ProductPicture id: 12332, product_id: nil, parent_id: 12330, content_type: image/png, filename: b_9788994035109_thumb.png, thumbnail: thumb, size: 2300, width: 52, height: 52, created_at: 2009-10-05 02:43:51, updated_at: 2009-10-05 02:43:51 pic ProductPicture id: 12330, product_id: 23236, parent_id: nil, content_type: image/gif, filename: b_9788994035109.gif, thumbnail: nil, size: 73990, width: 400, height: 400, created_at: 2009-10-05 02:43:50, updated_at: 2009-10-05 02:43:50 pic.thumbnails = ProductPicture id: 12331, product_id: nil, parent_id: 12330, content_type: image/png, filename: b_9788994035109_mid.png, thumbnail: mid, size: 16562, width: 205, height: 205, created_at: 2009-10-05 02:43:50, updated_at: 2009-10-05 02:43:50, ProductPicture id: 12332, product_id: nil, parent_id: 12330, content_type: image/png, filename: b_9788994035109_thumb.png, thumbnail: thumb, size: 2300, width: 52, height: 52, created_at: 2009-10-05 02:43:51, updated_at: 2009-10-05 02:43:51 pic.public_filename = /product_pictures/0001/2330/b_9788994035109.gif pic.public_filename(:mid) = /product_pictures/0001/2330/b_9788994035109_mid.gif It generates .gif instead of .png when the actual type is '.png' (gif is the parent's type) This works ok with my dev machine but not with my production machine. Any idea? Thanks. Sam -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, 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] Recursive partial wasted my 2 hours
Hi, When I called a page, the server choked like frozen. I checked it with 'top' command and HDD(wa) was 95%. There's no error or suspicious log. After wasting 2 hours, I found that a partial called it self. In _a.html.erb %= render :partial = a % Can rails detect such a mistake and stop proceeding and report it? Thanks. Sam -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Passenger 2.2.1 error?
Hi, I am running my rails 2.3.2 app on Passenger 2.2.1. There's a simple page like render :text = Hello And it crashes about every 1 out of 5 refreshes. Is there any known issue with Passenger 2.2.1? Thanks. Sam -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Passenger 2.2.1 error?
Sam Kong wrote: Hi, I am running my rails 2.3.2 app on Passenger 2.2.1. There's a simple page like render :text = Hello And it crashes about every 1 out of 5 refreshes. Is there any known issue with Passenger 2.2.1? Thanks. Sam I forgot to attach the error messages. Passenger encountered the following error: The application spawner server exited unexpectedly: Broken pipe Exception class: PhusionPassenger::Railz::ApplicationSpawner::Error Backtrace: # File Line Location 0 /dh/passenger/lib/phusion_passenger/railz/application_spawner.rb 117 in `spawn_application' 1 /dh/passenger/lib/phusion_passenger/spawn_manager.rb 265 in `spawn_rails_application' 2 /dh/passenger/lib/phusion_passenger/abstract_server_collection.rb 80 in `synchronize' 3 /dh/passenger/lib/phusion_passenger/abstract_server_collection.rb 79 in `synchronize' 4 /dh/passenger/lib/phusion_passenger/spawn_manager.rb 250 in `spawn_rails_application' 5 /dh/passenger/lib/phusion_passenger/spawn_manager.rb 153 in `spawn_application' 6 /dh/passenger/lib/phusion_passenger/spawn_manager.rb 282 in `handle_spawn_application' 7 /dh/passenger/lib/phusion_passenger/abstract_server.rb 337 in `__send__' 8 /dh/passenger/lib/phusion_passenger/abstract_server.rb 337 in `main_loop' 9 /dh/passenger/lib/phusion_passenger/abstract_server.rb 187 in `start_synchronously' 10 /dh/passenger/bin/passenger-spawn-server 55 -- 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-talk@googlegroups.com To unsubscribe from this group, 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: Restful_authentication doesn't work in Rails 2.3.2
Matt Jones wrote: Yep, you're seeing an incompatibility - I think 2.1.2 was the first version of Passenger that worked with Rails 2.3.2. --Matt Jones Yes, you're right. I complained to DreamHost and surprisingly they moved my account to a newer server which has Passenger 2.2.1. Thanks. Sam -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, 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] Restful_authentication doesn't work in Rails 2.3.2
Hi, I'm using restful_authentication on rails 2.3.2. It works find on my local machine which has passenger 2.1.2. But it doesn't work on the web hosting server (DreamHost) which may have lower version of passenger. The problem is session[:user_id] is not reserved while redirecting. Is this an incompatibility issue between rails 2.3.2 and passenger? If so, is there a workaround other than upgrading passenger? (I've already asked DreamHost to upgrade passenger but it will take time.) Thanks. Sam -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, 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] tiny_mce and jquery + jrails
Hi, I've been using tiny_mce_plus. Recently I changed prototype to jquery and jrails. It caused problems to tiny_mce_plus. So I replaced the prototype.js part in tiny_mce_plus with jquery and jrails. But according to log, the tiny_mce still uses prototype.js even if I restarted rails app. I grepped prototype.js over entire app and couldn't find any. I don't know where I need to change. Can somebody help? Thanks. Sam -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, 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] compromising development mode and production mode
Hi, I have a very stupid question. I run my rails application on phusion passenger. As you know, in production mode I need to 'touch tmp/restart.txt' when I've changed some files. In development mode, it's not needed. Can I run the production mode application like it's development mode so that I don't need to 'touch tmp/restart.txt'? Of course, I can set it to run in development mode. However, I don't want any other development mode feature except that 'touch tmp/restart.txt' thing. The application doesn't have to be fast. So speed is not an issue here. Thanks. Sam -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, 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] IE's session id changes on every request
Hi, I am developing a site with rails 2.1.2. restful_authentication is used. I can log in with Firefox but not with IE or Safari. I checked the log and found that session ID changes every time for IE. Why does this happen? Thanks. Sam -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: IE's session id changes on every request
Sam Kong wrote: Hi, I am developing a site with rails 2.1.2. restful_authentication is used. I can log in with Firefox but not with IE or Safari. I checked the log and found that session ID changes every time for IE. Why does this happen? Thanks. Sam I found out the cause of the problem. In my development server, the site was mapped to a host name that includes an underscore(_). It caused the problem. I found it at http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/ASP/Q_20590538.html. Thanks. Sam -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: InvalidAuthenticityToken error only in IE
Mike wrote: Hi, i've got the same problem. i cant find any fix for it neither can i reproduce it. it just sometimes works. Mike Thanks for the reply. I couldn't fix it. I just disabled forgery protection. :-( Sam -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Sharing view between new and edit actions
Hi, I had an argument with the web designer about a philosophical(not very practical) issue. Normally, we have new.html.erb and edit.html.erb and they share _form.html.erb as a partial render. The designer said that there should be only one view template and use if-statement for minor differences. For example, they all should be combined into form.html.erb. She thinks that it's better design-wise. No redundancy, blah blah... I am against it. But I failed to convince her. What do you think? Thanks. Sam -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] auto-complete without connecting to the server
Hi, My client wants to type instead of select from a list. But it's not just a free typing but typing the first few letters. So basically, it's auto-complete function except that the list data is already in the client as an array in JavaScript. Is there any plugin for such a function? If not, how would you implement it? Thanks. Sam -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: auto-complete without connecting to the server
Robert Zotter wrote: Take a look at the local autocompleter wiki, it has all the information you will need. http://github.com/madrobby/scriptaculous/wikis/autocompleter-local Thank you very much. This is exactly what I was looking for. Sam -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---