[Rails] Distinct selection
I have the following code: members.select {|m| m.role.assignable?}.collect {|m| m.role}.sort There are two tables: "roles" and "members". One role record may have many foreign member records. But in this case I get many same roles, I want to apply "distinct" operation to make roles unique in results. How can I 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-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] Pl. suggest some beginning tips for new Merbists.
Hello, Since Merb is new and so are wecan we expect some quick important tips to move ahead from senior Rails Developers as well as Merbists here...? It would be nice to guide us on the points below. (1) Best IDE currently available for Merb. This is important since Netbeans is currently working on Merb support for future. (2) Best tutorials and slides to read ( Links are requested ) (3) Good Beginners projects available on GitHub to start with. (4) A tutorial on working with Merb and console. (5) Some Good Tips and links to visit frequently for learning more. I hope this will help all fresh guys like me,willing to make a career in Merb P.S.:- since there is no special section for Merb yet available,in this forum, i am posting it here to get it noticed by Rails and Merb developers. I hope the Merb community will make efforts to start a section here. 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-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: next and previous methods for a model
I don't know of any, sorry. In the past I've written two simple instance methods and two named_scopes in my models. named_scope :next, lambda {|post, user| { :conditions => ["created_at > ? and user_id = ?", post.created_at, user.id], :order => "created_at ASC" } } named_scope :prev, lambda {|post, user| { :conditions => ["created_at < ? and user_id = ?", post.created_at, user.id], :order => "created_at DESC" } } def next(user) Post.next(self, user).first end def prev(user) Post.prev(self, user).first end On Nov 20, 6:50 pm, [EMAIL PROTECTED] wrote: > Anyone know of a plugin or gem that would create methods such as next > and previous on a model to traverse among siblings? For example, > @post.next and @post.prev. --~--~-~--~~~---~--~~ You received 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] Radio buttons are not mutually exclusive in Edit page
I have two emails for a contact. The first email is primary.While saving a new contact I can only set one radio button for primary, but in edit page the primary radio button can be set for both emails(not mutually exclusive) View <% for email in @contact.emails %> <% fields_for "contact[email_attributes][]", email do |e| %> Email <%= e.select ('email_type',%w{Business Personal}, :include_blank => false) %> <%= e.text_field :email,:size=>"35",:maxlength=>"80" %> <%= e.radio_button ('isprimary', 'true') %>Primary <% 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-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: How to read the logs?
The RedCloth gem is installed: RedCloth (4.1.1, 4.1.0) That's why I'm going nuts trying to figure this out. On Nov 18, 2:48 pm, Bobnation <[EMAIL PROTECTED]> wrote: > I can vouch for this. I haven't been reading logs for long, but I'm > getting better the more I do it ... which is bad, because it means I'm > making a lot of mistakes. I digress however. > > It does look like you are missing the RedCloth gem on your production > server. > > On Nov 18, 2:42 pm, Frederick Cheung <[EMAIL PROTECTED]> > wrote: > > > [EMAIL PROTECTED] wrote: > > > Can anyone tell me where I can learn how to read and decipher the > > > logs? I've done a few google searches and nothing comes up. > > > > Specifically, I just uploaded my first app to a production server and > > > it doesn't work and I got the following even though it works perfectly > > > fine on my development machine: > > > I'm not sure there's any substitute for just good old fashioned > > experience. In this case there's a missing RedCloth library - I'd > > guess you're missing the redcloth gem on your server. > > > Fred > > > > ctionView::TemplateError (uninitialized constant > > > Err::Acts::Textiled::ClassMethods::RedCloth) on line #26 of viewer/ > > > show.html.erb: > > > 23: > > > 24: <% else %> > > > 25: > > > 26: <%= @page.body %> > > > 27: > > > 28: <% end %> > > > /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/ > > > active_support/dependencies.rb:276:in `load_missing_constant' > > > /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/ > > > active_support/dependencies.rb:468:in `const_missing' > > > /home/admin/book/vendor/plugins/acts_as_textiled/lib/ > > > acts_as_textiled.rb:24:in `body' > > > /home/admin/book/app/views/viewer/show.html.erb:26:in > > > `_run_erb_47app47views47viewer47show46html46erb' --~--~-~--~~~---~--~~ You received 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: Getting the number of years between two dates
I've done so in the past with the Time class. ((Time.now-past_date)/1.year).round On Nov 20, 10:42 pm, "James Englert" <[EMAIL PROTECTED]> wrote: > Hey, > I need to get the number of years (as a number) between two dates. Here is > what I have as a helper. > > # Returns the number of years between now and the specified date. > def years_ago(date) > dateDifference = DateTime.now - date > results =Date.day_fraction_to_time(dateDifference) > return results[0] / 24 / 365; > end > > I'm sure there is a better way to do this. What is it? > > Thanks, > Jim --~--~-~--~~~---~--~~ You received 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] render partial for ym4r gmarker info_window in rjs
Hi All, I'm trying to add a marker with an info_window on my map in a rjs request using a partial. new.js.rjs marker = GMarker.new([EMAIL PROTECTED], @bar.lng], :info_window => render (:partial => "/foo/bar", :object => @bar)) page << @map.record_global_init(marker.declare('new_bar')) # declare js variable page << @map.overlay_init(marker) page << @map.record_init("new_bar.openInfoWindowHtml(\"# {marker.info_window}\");\n") end new.js.rjs _bar.html.erb hello end _bar.html.erb The above works fine. However if I add a new line or other html to my partial the marker and info_window do not appear. _bar.html.erb hello there end _bar.html.erb All the examples I could find use very simple text for the info_window contents. Any help would be greatly appreciated. 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-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: rails - 2 buttoms on a FORM
I guess you want to diferenciate clicks to different submit buttons. I did it like this: <%= image_submit_tag('add_16.png', :name => "action_categories/new") %> By specifiing name you can differenciate in controller which button was selected. params.each do |e| if e[0][0,7] == 'action_' ctrl, action = e[0][7,100].split('/') action ||= 'index' break end end The example shows which controller/action call when submit button is pressed. by TheR -- 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: Destroy Action
Baba Bobo wrote: > Just tested even adding the following short version, also works fine: > > map.connect '/users/:id/', :controller => 'users', :action => 'destroy' sorry just tested while this short version fixes the 'destroy' method but it breaks the 'new' method so you will have to use the above mentioned full version which is: map.connect '/users/:id/', :controller => 'users', :action => 'destroy', :id => /\d+/ -- 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: sqlite3 has gone...
Some precision : launching the same command in the sqlite3 gem work. I install sqlite3 gem iin my local gem path (~/.gem/ruby/1 .8/gems) but the result is the same On 20 nov, 23:57, "Dj [EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi all > > I've the same problem since this morning. > Trying to uninstall/install didn't do the trick. > > The only thing i've done since this yesterday (all work fine > yesterday) is installing updating datamapper. > > If anyone has some clues or tips to help me. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to 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: Destroy Action
Just tested even adding the following short version, also works fine: map.connect '/users/:id/', :controller => 'users', :action => 'destroy' -- 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: Destroy Action
Moving "map.resources: highest did not work for me i moved map.resources :users to top but still my destroy method which was using :method => 'post', did not work untill i add the following in my routes.rb under the map.resources :users map.connect '/users/:id/', :controller => 'users', :action => 'destroy', :id => /\d+/ , so the new routes.rb (without comments #) looked like following: ActionController::Routing::Routes.draw do |map| map.resources :users map.connect '/users/:id/', :controller => 'users', :action => 'destroy', :id => /\d+/ map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format' end I hope that helps -- 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: Restful Rails with Ajax
You had it about right: # /app/controllers/users_controller.rb def index @user = User.all respond_to do |format| format.html # Normal requests format.js # XHR Requests end end # /app/views/users/index.js.rjs page['some_element'].hide -- 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: Can't install rails gem on ibex
Update your gem to 1.3.1 (I recommend from source) and try from there. I know that this link and tutorial is for Hardy, but you can follow the gem install section pretty much verbatim (just grab the newest tar from the site) and be good to go. I used it and am running Rails on Ibex at home both on my web server and desktop. http://articles.slicehost.com/2008/4/30/ubuntu-hardy-ruby-on-rails On Nov 20, 10:23 pm, Joey Marino <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED]:~$ cat /etc/issue > Ubuntu 8.10 \n \l > > [EMAIL PROTECTED]:~$ ruby --version > ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux] > [EMAIL PROTECTED]:~$ gem --version > 1.2.0 > [EMAIL PROTECTED]:~$ gem install rails > ERROR: While executing gem ... (Errno::ENOENT) > No such file or directory - /var/lib/gems/1.8/cache/rake-0.8.3.gem > > google gives me japanese blog > any ideas? > -- > 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-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: Best Modal Popup for Rails
I'm partial to the submodal. Because I wrote it and it came out before all these *_box variants. I like to think that I was the first using such a solution, though it's probably not the case ;) Patches welcome, JS hackers: http://code.google.com/p/submodal/ seth - subimage llc - http://sublog.subimage.com - Cashboard - Estimates, invoices, and time tracking software - for free! http://www.getcashboard.com - Substruct - Open source RoR e-commerce software. http://code.google.com/p/substruct/ On Thu, Nov 20, 2008 at 8:25 PM, Bill Walton <[EMAIL PROTECTED]> wrote: > > David wrote: > >> Thanks for the insight. Does redbox play well with IE6? > > I have the luxery of only having to support FF. The code does recognize (at > least some) browser-specific quirks, but I haven't tested it at all on IE. > Sorry I can't be of more help. > > Best regards, > Bill > > > > > --~--~-~--~~~---~--~~ You received 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: Best Modal Popup for Rails
David wrote: > Thanks for the insight. Does redbox play well with IE6? I have the luxery of only having to support FF. The code does recognize (at least some) browser-specific quirks, but I haven't tested it at all on IE. Sorry I can't be of more help. Best regards, Bill --~--~-~--~~~---~--~~ You received 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] Can't install rails gem on ibex
[EMAIL PROTECTED]:~$ cat /etc/issue Ubuntu 8.10 \n \l [EMAIL PROTECTED]:~$ ruby --version ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux] [EMAIL PROTECTED]:~$ gem --version 1.2.0 [EMAIL PROTECTED]:~$ gem install rails ERROR: While executing gem ... (Errno::ENOENT) No such file or directory - /var/lib/gems/1.8/cache/rake-0.8.3.gem google gives me japanese blog any ideas? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-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] Restful Rails with Ajax
What is the proper way to handle Ajax requests restfully? def index @user = User.all respond_to do |format| format.html # Normal requests format.js # Should I use this? format.rjs # Something like this? end end I am unsure how to accomplish this. Do I need something like this possibly? if request.xhr? #Do something else respond_to do |format| #Normal stuff end end What is the proper thing to do? -- 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: Gruff Graphs for Scatter Plot
I've been searching for that ability as well. I did find this: http://pullmonkey.com/projects/open_flash_chart Which has the ability to do scatter plots. -- 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: String returns
Palani Kumar wrote: > Hi, > my output String is =>contact(name).From this output, i want to do > is get "name" alone from the output.How can i achieve this can anyone > please tell me output =~ /\(\w+\)/ name=$& -- 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] Getting the number of years between two dates
Hey, I need to get the number of years (as a number) between two dates. Here is what I have as a helper. # Returns the number of years between now and the specified date. def years_ago(date) dateDifference = DateTime.now - date results =Date.day_fraction_to_time(dateDifference) return results[0] / 24 / 365; end I'm sure there is a better way to do this. What is it? Thanks, Jim --~--~-~--~~~---~--~~ You received 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: Best Modal Popup for Rails
Thanks for the insight. Does redbox play well with IE6? On Nov 20, 6:23 am, "Bill Walton" <[EMAIL PROTECTED]> wrote: > Hi David, > > David wrote: > > > I have been researching modal dialog popup windows for my rails app > > and have narrowed the search down to two with two main variables in > > mind: ease of integration and speed. The two, that use prototype, are > > Redbox and the Prototype Window Class. I am looking for any input as > > to which may work better in terms of speed and integration and any > > other general advice. > > I've been working for the past few days with Redbox. It's got some 'cruft' > that needed to be cleaned up, but it was pretty easy to figure out. I > haven't worked with the other. There was a brief exchange yesterday about > the same topic and another library was mentioned. It was titled "what is > the preferred 'lightbox' plugin". > > > I would also like to style the popup windows with rounded corners > > This is done with an image background on the div that gets rendered into > your lightbox. You'll need to style it with something like: > > width: 999px; > height: 555px; > background-image: url(../images/total_box.png); > > The image won't display (at least it wouldn't for me) if you don't specify > the width and height. > > HTH, > Bill --~--~-~--~~~---~--~~ You received 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] How to install the plugin manually?
Dear all I would like to install plugin auto_complete but failed.. jruby -S script/plugin discover C:/jruby-1.1.5/lib/ruby/1.8/open-uri.rb:278:in `open_http': 407 Proxy Authentication Required (OpenURI::HTTPError) I have set the http_proxy=http://user:[EMAIL PROTECTED]:port/, It is working fine to fetch gem files. I know the plugin is in here: http://dev.rubyonrails.com/svn/rails/plugins/auto_complete/ I want to install it manually. Please advises. Thank you very much. Valentino -- 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] uninitialized constant ActionController::Caching::Fragments
Hey, i'm trying to use "s3cache" plugin with my app, but after adding it to my vendor/plugins directory and following the install steps i'm getting this error after running script/server: /Users/richardschneeman/Documents/AptanaStudio/slangasaurus/vendor/rails/activesupport/lib/active_support/dependencies.rb:275:in `load_missing_constant': uninitialized constant ActionController::Caching::Fragments::UnthreadedFileStore (NameError) from /Users/richardschneeman/Documents/AptanaStudio/slangasaurus/vendor/rails/activesupport/lib/active_support/dependencies.rb:467:in `const_missing' from /Users/richardschneeman/Documents/AptanaStudio/slangasaurus/vendor/plugins/s3cache/lib/s3_cache.rb:3 from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' from /Users/richardschneeman/Documents/AptanaStudio/slangasaurus/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in `require' from /Users/richardschneeman/Documents/AptanaStudio/slangasaurus/vendor/rails/activesupport/lib/active_support/dependencies.rb:354:in `new_constants_in' from /Users/richardschneeman/Documents/AptanaStudio/slangasaurus/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in `require' from /Users/richardschneeman/Documents/AptanaStudio/slangasaurus/vendor/plugins/s3cache/init.rb:1:in `evaluate_init_rb' ... 37 levels... from /Users/richardschneeman/Documents/AptanaStudio/slangasaurus/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in `require' from /Users/richardschneeman/Documents/AptanaStudio/slangasaurus/vendor/rails/railties/lib/commands/server.rb:39 from script/server:3:in `require' from script/server:3 I've extensively googled this error but haven't been able to come up with any good answers for what is causing it. Rails 2.1.0, Ruby 1.8.6: this is the first two lines in s3_cache.rb: require 's3' class S3Cache < ActionController::Caching::Fragments::UnthreadedFileStore Any clues or suggestions?? -- 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: Recipients did not receive the mail in Rails 2.0.2
Devi, What do the smtp settings in your config/environments/production.rb file look like? Or if you are sending from your development machine, look at development.rb. Mine looks like this: config.action_mailer.raise_delivery_errors = false config.action_mailer.perform_deliveries = true config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :address => "localhost", :port => 25, :domain => "yourdomain.com", } HTH, jp Devi Rv wrote: > Hi, > > I am new to ROR and i trying to send emails using rails version 2.0.2. > But the recipients did not receive the mail i check the log file also > > If any one knows Please let me know. Thanks in Advance. > > Regards > Devi.R -- 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: problem getting rails1 app running under rails2
Hi, I haven't had this particular problem with converting an app, but I have found a way to convert that seems very painless and quick for me. Worked well twice now. I just create a new rails 2.x app, and then copy the appropriate stuff over from the old app (like all of the stuff in apps folder, and plugins, etc.) I have NOT found it necessary to rename the endings of the view files. 2.x is backwards compatible with the "old" .rhtml ending. Just the other day I got a medium sized project converted and working in just a few hours, including setting it all up on a new server box. Copying stuff into a new rails project seems a lot easier than doctoring up an old project to make it 2.x compatible. HTH, jp wpollans wrote: > This message used to appear in the script/server output, when the app > started, > >"Rendering within layouts/standard" > > that's the standard.rhtml (in layouts) that was referring to -- 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] Question about auto completion field
Dear all I am reading a rails cookbook about the auto_complete_for function, the code as below app/controllers/musicians_controller.rb: class MusiciansController < ApplicationController auto_complete_for :musician, :name def index end def add # assemble a band... end end app/views/musicians/index.rhtml: Musician Selection <% form_tag :action => :add do %> <%= text_field_with_auto_complete :musician, :name %> <%= submit_tag 'Add' %> <% end %> My question is that, if the name attribute consists lots of duplicated values, how can I distinct them before pass to auto_complete_for? I afraid the performance would be affected if not to distinct it. Thank you very much. Valentino -- 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: will_paginate question
Quoting [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > I'm using will_paginate and in my views I have two images, a left > arrow and a right arrow, that act as my pagination links. Is there a > method built in to generate the URL's for those images? > WillPaginate::ViewHelpers.pagination_options[:previous_label] = link_to(image_tag ... WillPaginate::ViewHelpers.pagination_options[:next_label] = link_to(image_tag ... HTH, Jeffrey --~--~-~--~~~---~--~~ You received 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] next and previous methods for a model
Anyone know of a plugin or gem that would create methods such as next and previous on a model to traverse among siblings? For example, @post.next and @post.prev. --~--~-~--~~~---~--~~ You received 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] pass json data into javascript
Hello from a Ruby on Rails beginner! I've been trying to pass some data to a variable in Javascript by using json. Seems like the Javascript variable doesn't receive the data correctly. This is the code in controller. @courses variable find the data from database. class CoursesController < ApplicationController def index @courses = Course.find(:all) end end This is Javascript code in view. var markers=<%= @courses.to_json %>; The following code show the data in browser with no problem. That means <%= @courses.to_json %> But the following code doesn't show data in browser right. The output is a string of "undefined". var markers = <%= @courses.to_json %>; for(i=0; i
[Rails] will_paginate question
I'm using will_paginate and in my views I have two images, a left arrow and a right arrow, that act as my pagination links. Is there a method built in to generate the URL's for those images? --~--~-~--~~~---~--~~ You received 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: windows tail development.log
Hey thanks guys for all the tipps! On 20 Nov., 23:55, Codeblogger <[EMAIL PROTECTED]> wrote: > Hi Rafael, > > have a look at mtail:http://ophilipp.free.fr/op_tail.htm > > Kind regards, > Nicolai --~--~-~--~~~---~--~~ You received 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: rails - 2 buttoms on a FORM
You could use javascript to change the target of your form when they click either button. This can get messy though. Each different form target can have it's own validation. -Jim http://jim-rants.com/coding-blog/ On Thu, Nov 20, 2008 at 3:48 PM, Xd Xd <[EMAIL PROTECTED]>wrote: > > then, in my FORM there are 2 buttoms : > > first to select a file to upload buttom="Parcourir" > second to send the complete Form, buttom="ENVOYER" > > "parcourir" is for to select a file to upload > > but "ENVOYER" must validate the complete Form : > - file selected presence > - other fields validatation > > if evrything is OK, i have to upload the file (and save it) > and update a Table > > > how can i do this ? > > Attachments: > http://www.ruby-forum.com/attachment/2953/ex.doc > > -- > 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: Update collection passed to form_tag
Hi everyone, Thanks to Fred for an excellent explanation of params in his blog post: http://www.spacevatican.org/2008/7/18/parametrised-to-the-max. Anyone who is interested in params could probably learn a lot from reading this interactive post. Based on the post, I was able to update_attributes() to a collection of candles. Thank You! Supraja # edit_all.html.erb <% form_tag(:action => "update_candle_line") do %> <% for @candle in @candles %> <% fields_for @candle do |can| %> <%= can.text_field(:flavor, "index" => @candle.id) %> <% end %> <% end %> <%= submit_tag "Update" %> <% end %> # edit_all_controller.rb def update_candle_line params[:candle].each do |id, new_attributes| Candle.find(id).update_attributes new_attributes end redirect_to_index("Flavors updated!") end On Nov 19, 3:39 pm, Supraja <[EMAIL PROTECTED]> wrote: > Hi Fred, > > I appreciate your quick reply. > > Here's an example of an HTML tag after I used fields_for() (code > pasted below*): > > value="Vanilla" /> > > How can I change edit_all.html.erb code to get: > > id="candle[id][flavor]" name="candle[id][flavor]" > > Thanks, > Supraja > > > > * edit_all.html.erb > <% form_tag(:action => "update_candle_line") do %> > > <% for @candle in @candles %> > > <% fields_for @candle do |can| %> > <%= can.text_field(:flavor) %> > <% end %> > > <% end %> > > <%= submit_tag "Update" %> > > <% end %> > > On Nov 19, 11:07 am, Frederick Cheung <[EMAIL PROTECTED]> > wrote: > > > On 19 Nov 2008, at 16:25, Supraja wrote: > > > > Hi everyone, > > > > I'm trying to update attributes in acollectionpassed to form_tag. > > > However my syntax for extracting values from the params hash results > > > in this exception: > > > > undefined method `keys' for ["Vanilla", "Rose", "Cranberry"]:Array > > > > So it appears I am trying to call keys on an array of "flavor" > > > attribute values, rather than extracting "Candle" object id keys from > > > the params hash. I have included the code from the view and controller > > > below. > > > If you call your parameters candle[] then you will indeed get back a > > single array parameter > > > if you wanted a hash keyed by id then you'd need parameters of the > > form candle[some_id][flavor]. fields_for etc... may be able to help > > you create those parameter names rather than having to bash them in by > > hand. > > > Fred > > > > Thanks for taking the time to read this. I appreciate any specific > > > suggestions, as well as any resources that explain the intricacies of > > > params. > > > > Thank You! > > > Supraja > > > > > > > edit_all.html.erb: > > > <% form_tag(:action => "update_candle_line") do %> > > > <% for @candle in @candles %> > > > <%= text_field_tag("candle[]", @candle.flavor) %> > > > <% end %> > > > > <%= submit_tag "Update" %> > > > <% end %> > > > > > > > edit_all_controller.rb: > > > def update_candle_line > > > Candle.update(params[:candle].keys, params[:candle].values) > > > redirect_to_index("Flavors updated!") # private method of > > > controller > > > 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-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: What is the preferred "lightbox" plugin?
I have a site with a fair amount of prototype too, and am wondering about integrating jquery for only the login popup modal box. Isn't it possible to only load jquery for the login partial when someone clicks to login, so that I am not doubling up on JS libraries on other pages? On Nov 18, 2:54 pm, Philip Hallstrom <[EMAIL PROTECTED]> wrote: > > I need to do an overlay with something that supports ajax/remote > > html. There's lots of options and quite a few rails plugins. Some > > seem out of date however. > > > Any suggestions on which one is "best" where "best" is defined as easy > > to implement, works in all browsers, supports ajax or remote html. > > Thanks to those that replied... I should have clarified no-jquery. I > love jquery, but the site uses a lot of Prototype and I'd rather not > double up on JS libraries. > > I found one and got it working. Seems to do the right thing :) > > http://code.google.com/p/rb-lightbox-plugin/ > > Not too much of a pain to implement either. centers, works in IE/ > Firefox. > > There do seem to be a lot more jquery based ones. Will have to go > that route right off the bat next time :) > > -philip --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-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: sqlite3 has gone...
Hi all I've the same problem since this morning. Trying to uninstall/install didn't do the trick. The only thing i've done since this yesterday (all work fine yesterday) is installing updating datamapper. If anyone has some clues or tips to help me. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to 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: windows tail development.log
Hi Rafael, have a look at mtail: http://ophilipp.free.fr/op_tail.htm Kind regards, Nicolai --~--~-~--~~~---~--~~ You received 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: windows tail development.log
Hi, when I used Windows to develop with Rails, I had to use a 'tail', here are some options to you: http://www.google.com.br/search?hl=pt-BR&q=windows+tail&btnG=Pesquisa+Google&meta= On Nov 20, 8:12 pm, "Greg Donald" <[EMAIL PROTECTED]> wrote: > On Thu, Nov 20, 2008 at 4:07 PM, Rafael <[EMAIL PROTECTED]> wrote: > > unfortunately I have to develop on a windows machine from time to > > time. But there is a little problem, mostly for debugging. > > How can I get the same output on the console as in a linux box or on > > the mac? > > > I don't see the full output from the logger on the console. > > How can I get the full output? SQL and so on > > dos != tty > > Install cygwin. > > http://www.cygwin.com/ > > -- > Greg Donaldhttp://destiney.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] Full-text search engine for associations w/ values
I am looking for a full-text search engine compatible with Rails that can handle associations with a value in the join table with equality and inequalities. For example, database of items with searchable titles and descriptions and tags possibly with values: "Hello" AND tag:release <= 0.4 AND tag:due < '2009-01-01' AND tag:important An item with "Hello" in one of the indexed fields, "release", "due", and "important" tags. The value of the "release" tag is less than or equal to "0.4" (string or floating point compare okay), "due" date is this year or earlier. TIA, Jeffrey --~--~-~--~~~---~--~~ You received 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: Apche + SSL Configuration Issue
James is on to something but you could also remove mongrel from the mix and just test a plain html or gif. How do you have it configured between apache and mongrel? ProxyPass ? Do you have the ssl plugin installed? --~--~-~--~~~---~--~~ You received 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: windows tail development.log
On Thu, Nov 20, 2008 at 4:07 PM, Rafael <[EMAIL PROTECTED]> wrote: > unfortunately I have to develop on a windows machine from time to > time. But there is a little problem, mostly for debugging. > How can I get the same output on the console as in a linux box or on > the mac? > > I don't see the full output from the logger on the console. > How can I get the full output? SQL and so on dos != tty Install cygwin. http://www.cygwin.com/ -- Greg Donald http://destiney.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] windows tail development.log
Hi unfortunately I have to develop on a windows machine from time to time. But there is a little problem, mostly for debugging. How can I get the same output on the console as in a linux box or on the mac? I don't see the full output from the logger on the console. How can I get the full output? SQL and so on thank you veeery much! Rafael --~--~-~--~~~---~--~~ You received 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] should this work? - "validates_inclusion_of :start_date, :in => (Time.now.to_date - 100.years)..(Time.now.to_date + 100.years)"
wondering if should this work? - "validates_inclusion_of :start_date, :in => (Time.now.to_date - 100.years)..(Time.now.to_date + 100.years)" (doesn't seem to for me) i.e. should I be able to "validates_inclusion_of" to do date validation. class GraphOptions < ActiveRecord::BaseWithoutTable column :start_date, :date validates_inclusion_of :start_date, :in => (Time.now.to_date - 100.years)..(Time.now.to_date + 100.years) end tks --~--~-~--~~~---~--~~ You received 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: problem getting rails1 app running under rails2
This message used to appear in the script/server output, when the app started, "Rendering within layouts/standard" that's the standard.rhtml (in layouts) that was referring to On Nov 20, 2:39 pm, wpollans <[EMAIL PROTECTED]> wrote: > I'm sure others have already solved this problem - porting an existing > rails1 app to rails2. > > A sketch of the problem - I'll be happy to furnish as much detail as > may be needed - I'm hoping this is/was a standard problem. > > I've just upgraded to current rails gem (2.1.2) from 1.2.5 and can't > get my app going. It appears that my standard.rhtml (renamed to > standard.html.erb - along with other *.rhtml) is not being rendered - > there's no mention of it (in the window in which script/server is > running) when I open the app in the browser - the view is rendered, > but without the appropriate css. standard.rhtml created the > navigation panes used in all views. I'm using FF3 and ubuntu hardy - > shouldn't be relevant since rails1 app was running OK in this > environment. > > Could someone please point to where I need to look. Any and all help > 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-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: Apche + SSL Configuration Issue
James Byrne wrote: > Do you have this in your Apache server virtual host file? > > RequestHeader set X_ORIGINAL_PROTOCOL 'https' > Opps. I forgot to add this: http://blog.innerewut.de/2006/6/21/mongrel-and-rails-behind-apache-2-2-and-ssl -- 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: Apche + SSL Configuration Issue
Do you have this in your Apache server virtual host file? RequestHeader set X_ORIGINAL_PROTOCOL 'https' Mongrel, by design, does not do SSL. Redirects from inside the cluster will perforce become http. I do not know if this is your issue or not but it might be a place to start. Good luck and please report back how you solve 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-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] rails - 2 buttoms on a FORM
then, in my FORM there are 2 buttoms : first to select a file to upload buttom="Parcourir" second to send the complete Form, buttom="ENVOYER" "parcourir" is for to select a file to upload but "ENVOYER" must validate the complete Form : - file selected presence - other fields validatation if evrything is OK, i have to upload the file (and save it) and update a Table how can i do this ? Attachments: http://www.ruby-forum.com/attachment/2953/ex.doc -- 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: update_attributes unsets my object
Frederick Cheung wrote: > On 20 Nov 2008, at 17:26, Fernando Perez wrote: > >> >> I just run in a very strange behavior. >> >> In one of my actions, I trigger: @object.update_attributes(:attr1 => >> ...) >> >> Now in the corresponding view, @object is nil. Is that a normal >> behavior >> from Rails? Why would it unset the object? > > I doubt that is the whole story. Post more information > > Ffred Thank your Frederick for your prompt answer. You were perfectly right, I hadn't seen that I was doing something so stupid as: @object.update_attributes(:attr1 => @object.attr1) That kind of recursion is definitely forbidden. I don't know how such a silly idea came to my mind. -- 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: Upgrading Rails With InstantRails
Jose vicente Ribera pellicer wrote: > Schalk Neethling wrote: > >> Hey all, >> >> How do I upgrade the version of rails running inside InstantRails? >> >> Thanks, >> Schalk >> > > Hi > > gem update rails --include-dependencies > > this comand erase the old version > > > rake rails:update > > > First bring up a shell like window (run->cmd) cd \InstantRails use_ruby gem whatever use_ruby will set up your path and cd over to rails_apps --~--~-~--~~~---~--~~ You received 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] problem getting rails1 app running under rails2
I'm sure others have already solved this problem - porting an existing rails1 app to rails2. A sketch of the problem - I'll be happy to furnish as much detail as may be needed - I'm hoping this is/was a standard problem. I've just upgraded to current rails gem (2.1.2) from 1.2.5 and can't get my app going. It appears that my standard.rhtml (renamed to standard.html.erb - along with other *.rhtml) is not being rendered - there's no mention of it (in the window in which script/server is running) when I open the app in the browser - the view is rendered, but without the appropriate css. standard.rhtml created the navigation panes used in all views. I'm using FF3 and ubuntu hardy - shouldn't be relevant since rails1 app was running OK in this environment. Could someone please point to where I need to look. Any and all help 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-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: Upgrading Rails With InstantRails
Schalk Neethling wrote: > Hey all, > > How do I upgrade the version of rails running inside InstantRails? > > Thanks, > Schalk Hi gem update rails --include-dependencies this comand erase the old version rake rails:update -- 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] Upgrading Rails With InstantRails
Hey all, How do I upgrade the version of rails running inside InstantRails? Thanks, Schalk --~--~-~--~~~---~--~~ You received 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: help with partial
Sorry. I think this is the solution that you're trying to show me: def expotar #THIS METTOD SHOULD SELECT ALL THE CURRENT TICKETS IN CARTICKET, i think works wroung @cartticket = find_cartticket @[EMAIL PROTECTED] headers['Contenet-type']="aplication/vnd.ms-excel" headers['Contenet-Disposition']='attachment; filename="report.xls"' headers['Cache-Control']='' end @tickets has the tickets that y need. I think you were trying to say 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-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: sqlite3 has gone...
In case it helps someone, I removed /Library/Ruby and reinstalled everything. Strange bug... Jej --~--~-~--~~~---~--~~ You received 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: help with partial
On 20 Nov 2008, at 18:10, Jose vicente Ribera pellicer wrote: > > Frederick Cheung wrote: >> On 20 Nov 2008, at 15:37, Jose vicente Ribera pellicer wrote: >> >>> >>> end >>> >> That's irrelevant. when your expotar action is called you get a new >> instance of the Controller - instance variables don't persist across >> requests. >> >> Fred > > So I will find @cartticket before select the items really? Sorry, I can't parse that sentence. 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-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: help with partial
Frederick Cheung wrote: > On 20 Nov 2008, at 15:37, Jose vicente Ribera pellicer wrote: > >>> >> >> end >> > That's irrelevant. when your expotar action is called you get a new > instance of the Controller - instance variables don't persist across > requests. > > Fred So I will find @cartticket before select the items really? -- 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: update_attributes unsets my object
On 20 Nov 2008, at 17:26, Fernando Perez wrote: > > I just run in a very strange behavior. > > In one of my actions, I trigger: @object.update_attributes(:attr1 => > ...) > > Now in the corresponding view, @object is nil. Is that a normal > behavior > from Rails? Why would it unset the object? I doubt that is the whole story. Post more information Ffred > > -- > 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] Odd nuance on getting erb or js files
I've got a partial rendered in a something.js.rjs file. This works just fine when I call the method on the controller using xhr(etc etc) in my functional tests. So from the point of view of the tests an Ajax request is pulling the right stuff though and the associated assert_selects are finding it in the returned result. But... When I try to get the page fragment via a button in a remote form then the result is 'could not find template something.html.erb'. My understanding of this is that the ActionController would look for something.js.rjs if it couldn't find the html.erb. In this case it isn't. The request coming through the remote form seems to look like a standard post request and it's trying to find an html.erb to render the result. Wtf is going on here? Comments please John Small -- 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] update_attributes unsets my object
I just run in a very strange behavior. In one of my actions, I trigger: @object.update_attributes(:attr1 => ...) Now in the corresponding view, @object is nil. Is that a normal behavior from Rails? Why would it unset the object? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-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: Random method
> 1+rand(100) will give you a range of 1-100 (it will never show as 0%) > rand(101) will give you a range of 0-100 (0% is possible) I don't know what your actually trying to accomplish, but it doesn't seem to me that simply generating random numbers between 0 and 100 would be a very realistic test of CPU load. Load on a CPU wouldn't look like random noise. I think I would generate random numbers that add to another value in small increments in some form of moving average to produce a more realistic result. But, this depends on if you care about the value over time, or just need an instance in time value. -- 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] how to override enumerable compare for attributes?
How would I override <=> for certain attributes of a class? Say I have the following: class Workout < ActiveRecord::Base # columns in db: time, weight, reps, distance end I want to be able to sort by results, to list workouts by best time, weight, etc. But the ordering is different, because a low time is better than a high time, while a high weight is better than a low weight, etc. Right now I'm doing a class method with an if statement like this: def self.ranked_by(compare) if compare == :time find(:all).sort_by{|workout| workout.time}.reverse else find(:all).sort_by{|workout| workout.send(compare)} end end That works, but it's ugly and the ugliness tends to replicate itself. I could simplify my code by overriding the <=> method for the time attribute so that I could simply do: def self.ranked_by(compare) find(:all).sort_by{|workout| workout.send(compare)} end But how to do that? --~--~-~--~~~---~--~~ You received 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] Gettext error - MAC OS X
Gettext version: 1.93.0 When running the famous "update_po" rake task, an error occurs telling me that gettext can't find msgmerge. Did anybody have this same problem? --~--~-~--~~~---~--~~ You received 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] sqlite3 has gone...
Hi all, I'm struggling since hours with sqlite3. Maybe I'm wrong to post here, as I feel the problem is not directly related to rails. After a "gem clean" this morning, mongrel doesn't want to start anymore: /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- sqlite3 (MissingSourceFile) But sqlite3-ruby is well installed under gem (I reinstalled to be sure, desinstalled, resinstalled, etc) but it can't be loaded: ruby - rubygems -e "require 'sqlite3'" returns the same error as above. It loads well if I cd in the sqlite directory. Here is my gem env: RubyGems Environment: - RUBYGEMS VERSION: 1.3.1 - RUBY VERSION: 1.8.6 (2008-03-03 patchlevel 114) [universal- darwin9.0] - INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8 - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/ Versions/1.8/usr/bin/ruby - EXECUTABLE DIRECTORY: /usr/bin - RUBYGEMS PLATFORMS: - ruby - universal-darwin-9 - GEM PATHS: - /Library/Ruby/Gems/1.8 - /Volumes/Maison/.gem/ruby/1.8 - /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ ruby/gems/1.8 - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - http://gems.rubyforge.org/ --- sqlite is locate here: /Library/Ruby/Gems/1.8/gems/sqlite3-ruby-1.2.4/ I checked the permissions, as mentioned in some forums. I reinstalled gem and all the gems that where uninstalled by the cleanup. I'm locked now, I don't know what to look for... Any help welcome. Thanks, Jej --~--~-~--~~~---~--~~ You received 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: help with partial
On 20 Nov 2008, at 15:37, Jose vicente Ribera pellicer wrote: > > Frederick Cheung wrote: >> On Nov 19, 11:24�pm, Jose vicente Ribera pellicer > [EMAIL PROTECTED]> wrote: >> >>> >>> Showing tickets/exportar.html.erb where line #9 raised: >>> >>> You have a nil object when you didn't expect it! >>> The error occurred while evaluating nil.items >> >> You don't seem to be setting @cartticket anywhere. >> >> Fred > > I dont`t think so, because in ticket controller this code works fine: > > def add_to_cartticket > @cartticket = find_cartticket >ticket = Ticket.find(params[:id]) >@cartticket.add_ticket(ticket) > > end > That's irrelevant. when your expotar action is called you get a new instance of the Controller - instance variables don't persist across requests. Fred > def find_cartticket >unless session[:cartticket] # if there's no cart in the session >session[:cartticket] = Cartticket.new # add a new one >end >session[:cartticket] # return existing or new cart > end > > > thanks for the answer. Now i'm not implementing this code, only > appears > in the add_to_cartticket view one table with the fields i want to > show. > Next step if I can`t sole tehe excel problem will be print it > directly. > > > -- > 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: help with partial
Frederick Cheung wrote: > On Nov 19, 11:24�pm, Jose vicente Ribera pellicer [EMAIL PROTECTED]> wrote: > >> >> Showing tickets/exportar.html.erb where line #9 raised: >> >> You have a nil object when you didn't expect it! >> The error occurred while evaluating nil.items > > You don't seem to be setting @cartticket anywhere. > > Fred I dont`t think so, because in ticket controller this code works fine: def add_to_cartticket @cartticket = find_cartticket ticket = Ticket.find(params[:id]) @cartticket.add_ticket(ticket) end def find_cartticket unless session[:cartticket] # if there's no cart in the session session[:cartticket] = Cartticket.new # add a new one end session[:cartticket] # return existing or new cart end thanks for the answer. Now i'm not implementing this code, only appears in the add_to_cartticket view one table with the fields i want to show. Next step if I can`t sole tehe excel problem will be print it directly. -- 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: Rails.cache and problem with model id?
On 20 Nov 2008, at 15:11, John Kopanas wrote: > > Nobody has ever encountered this problem before? > http://rails.lighthouseapp.com/projects/8994/tickets/785-caching-models-fails-in-development > On Wed, Nov 19, 2008 at 5:09 PM, John Kopanas <[EMAIL PROTECTED]> > wrote: >> More info... the first time when I write to the cache it works >> perfectly fine... the second time around when I am reading from the >> cache the errors start popping up. hmmm... >> >> >> On Wed, Nov 19, 2008 at 5:08 PM, John Kopanas <[EMAIL PROTECTED]> >> wrote: >>> >>> More info... the first time when I write to the cache it works >>> perfectly fine... the second time around when I am reading from >>> the cache the errors start popping up. hmmm... >>> >>> On Wed, Nov 19, 2008 at 5:02 PM, John Kopanas <[EMAIL PROTECTED]> >>> wrote: I have the following: MODEL: def self.get_tag_cloud Rails.cache.fetch('fetish_tag_cloud', :expires_in => 1.hour) do find(:all, :conditions => [ "approved_for_tag_cloud = true"], :order => "LTRIM(name)") end end CONTROLLER: def index @fetishes = Fetish.get_tag_cloud end VIEW: <% @fetishes.each do |fetish| -%> <%= link_to fetish.name, "/fetishes/#{fetish.id}", :class => "size#{fetish.tag_size}"%> <% end -%> I get the following error: stack level too deep /Library/Ruby/Gems/1.8/gems/activerecord-2.1.2/lib/active_record/ attribute_methods.rb:244:in `method_missing' /Library/Ruby/Gems/1.8/gems/activerecord-2.1.2/lib/active_record/ attribute_methods.rb:245:in `method_missing' /Library/Ruby/Gems/1.8/gems/activerecord-2.1.2/lib/active_record/ base.rb:2163:in `to_param' (eval):2:in `fetish_path' app/views/fetishes/index.html.erb:22:in `_run_erb_47app47views47fetishes47index46html46erb' app/views/fetishes/index.html.erb:21:in `each' app/views/fetishes/index.html.erb:21:in `_run_erb_47app47views47fetishes47index46html46erb' If I do not cache the query it works beautifully... basically when I cache that query anytime I try to view fetish.id I get a stack level to deep error... anyone ever get this problem? -- John Kopanas [EMAIL PROTECTED] Blog: http://www.kopanas.com Conference: http://www.cusec.net Twits: http://www.twitter.com/kopanas >>> >>> >>> >>> -- >>> John Kopanas >>> [EMAIL PROTECTED] >>> >>> Blog: http://www.kopanas.com >>> Conference: http://www.cusec.net >>> Twits: http://www.twitter.com/kopanas >> >> >> >> -- >> John Kopanas >> [EMAIL PROTECTED] >> >> Blog: http://www.kopanas.com >> Conference: http://www.cusec.net >> Twits: http://www.twitter.com/kopanas >> > > > > -- > John Kopanas > [EMAIL PROTECTED] > > Blog: http://www.kopanas.com > Conference: http://www.cusec.net > Twits: http://www.twitter.com/kopanas > > > --~--~-~--~~~---~--~~ You received 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] Running tests for acts_as_tree plugin
If I checkout the acts_as_tree plugin from git://github.com/rails/acts_as_tree.git and try to run its unit tests, I get a failure: $ rake (in /u/home/brian/git/acts_as_tree) /usr/local/bin/ruby -Ilib:lib "/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb" "test/acts_as_tree_test.rb" /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:276:in `load_missing_constant': uninitialized constant ActiveRecord::Acts (NameError) from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:468:in `const_missing' from ./test/../init.rb:1 ... etc However, I can make them run if I make a one-line addition to init.rb: diff --git a/init.rb b/init.rb index 0901ddb..3e4d07b 100644 --- a/init.rb +++ b/init.rb @@ -1 +1,2 @@ +require 'active_record/acts/tree' ActiveRecord::Base.send :include, ActiveRecord::Acts::Tree Is there something odd about my environment, or is this an error in the plugin? I have rails 2.1.2 and rake 0.8.3 gems installed, but I'm testing acts_as_tree separately, not within a rails project. Thanks, Brian Candler. -- 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: Rails.cache and problem with model id?
Nobody has ever encountered this problem before? On Wed, Nov 19, 2008 at 5:09 PM, John Kopanas <[EMAIL PROTECTED]> wrote: > More info... the first time when I write to the cache it works > perfectly fine... the second time around when I am reading from the > cache the errors start popping up. hmmm... > > > On Wed, Nov 19, 2008 at 5:08 PM, John Kopanas <[EMAIL PROTECTED]> wrote: >> >> More info... the first time when I write to the cache it works perfectly >> fine... the second time around when I am reading from the cache the errors >> start popping up. hmmm... >> >> On Wed, Nov 19, 2008 at 5:02 PM, John Kopanas <[EMAIL PROTECTED]> wrote: >>> >>> I have the following: >>> MODEL: >>> >>> def self.get_tag_cloud >>> Rails.cache.fetch('fetish_tag_cloud', :expires_in => 1.hour) do >>> find(:all, :conditions => [ "approved_for_tag_cloud = true"], :order >>> => "LTRIM(name)") >>> end >>> end >>> CONTROLLER: >>> def index >>> @fetishes = Fetish.get_tag_cloud >>> end >>> VIEW: >>> >>> <% @fetishes.each do |fetish| -%> >>> <%= link_to fetish.name, "/fetishes/#{fetish.id}", :class => >>> "size#{fetish.tag_size}"%> >>> <% end -%> >>> >>> >>> I get the following error: >>> stack level too deep >>> >>> /Library/Ruby/Gems/1.8/gems/activerecord-2.1.2/lib/active_record/attribute_methods.rb:244:in >>> `method_missing' >>> /Library/Ruby/Gems/1.8/gems/activerecord-2.1.2/lib/active_record/attribute_methods.rb:245:in >>> `method_missing' >>> /Library/Ruby/Gems/1.8/gems/activerecord-2.1.2/lib/active_record/base.rb:2163:in >>> `to_param' >>> (eval):2:in `fetish_path' >>> app/views/fetishes/index.html.erb:22:in >>> `_run_erb_47app47views47fetishes47index46html46erb' >>> app/views/fetishes/index.html.erb:21:in `each' >>> app/views/fetishes/index.html.erb:21:in >>> `_run_erb_47app47views47fetishes47index46html46erb' >>> >>> >>> If I do not cache the query it works beautifully... basically when I cache >>> that query anytime I try to view fetish.id I get a stack level to deep >>> error... anyone ever get this problem? >>> >>> >>> -- >>> John Kopanas >>> [EMAIL PROTECTED] >>> >>> Blog: http://www.kopanas.com >>> Conference: http://www.cusec.net >>> Twits: http://www.twitter.com/kopanas >> >> >> >> -- >> John Kopanas >> [EMAIL PROTECTED] >> >> Blog: http://www.kopanas.com >> Conference: http://www.cusec.net >> Twits: http://www.twitter.com/kopanas > > > > -- > John Kopanas > [EMAIL PROTECTED] > > Blog: http://www.kopanas.com > Conference: http://www.cusec.net > Twits: http://www.twitter.com/kopanas > -- John Kopanas [EMAIL PROTECTED] Blog: http://www.kopanas.com Conference: http://www.cusec.net Twits: http://www.twitter.com/kopanas --~--~-~--~~~---~--~~ You received 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: Rails 2.1.2, complex find involving complex include, bug
Have you reported it? On Nov 12, 9:30 pm, John Hohlen <[EMAIL PROTECTED]> wrote: > We have encountered similar issues. We finally decided not rely on Rails > finding any classes declared in a module namespace. We liked the > organization that the module namespace provided as our models directory > was getting pretty large. So we kept our file structure as is, but > removed the namespace. Instead, we explicity "require" the classes in > our environment.rb file. For example: > > require File.dirname(__FILE__) + '/../app/models/reports/stats_report' > require File.dirname(__FILE__) + > '/../app/models/reports/standings_report' > > This is a nasty bug and I hope it gets fixed soon. It's unfortunate > Rails does not deal with namespaces properly -- at least I think it's a > Rails issue. > > John > -- > 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-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: Beyond the simple select
Frederick Cheung escreveu: On 20 Nov 2008, at 13:29, Tom Lobato wrote: How will this ":include" change the json response? Since there is a list being selected, I need to parse it in the client side. I`m not using simple to_json, but to_ext_json (provided by the plugin: http://inside.glnetworks.de/2008/01/18/announcing-ext-scaffold-generator-plugin-for-rails/) , but I think the "include" won`t change. http://api.rubyonrails.com/classes/ActiveRecord/Serialization.html#M001417 great! Sorry for didn`t look at this doc before, but in really it was not clear even the fact that :include is a to_json option. The things was confuse for me. Now it`s clear. Thank you, Cheung! Tom Lobato --~--~-~--~~~---~--~~ You received 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: File Upload fails for large files
Oh great. Thanks for this Mark. :) On Nov 20, 7:06 pm, Mark Smith <[EMAIL PROTECTED]> wrote: > > If you are doing something similar, make sure > > you use a submit button instead of a Javascript that submits the form. > > Chirantan, look into the responds_to_parent plugin to do it via JS. > > http://sean.treadway.info/responds-to-parent/ --~--~-~--~~~---~--~~ You received 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: how to run linux command in rake file
On Nov 20, 8:06 am, Vamsi Krishna <[EMAIL PROTECTED]> wrote: > hi all, > > i need to grep a word count from a text file and i want to display the > count. > i need all the above in a rake file , i tried it by using > > today_count= system("grep -R 'time' oct_10.txt | grep -R 'hi' | wc > -l") > puts "today count is :#{today_count}" > > but today_count returns 'true' instead of count. > > plz reply ASAP. > > Thanks.. > --vamsi. > -- > Posted viahttp://www.ruby-forum.com/. Try backticks instead: output = `grep -R 'time' oct_10.txt | grep -R 'hi' | wc` backticks will return whatever went to stdout. For system(), rtfm: http://ruby-doc.org/core/ Jeff p.s. Please don't say "reply ASAP" when posting. Everyone here is donating their free time and energy already. :-) purpleworkshops.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: only one error message for a field
Thani, You can use :allow_nil, or :allow_blank to skip validation. validates_format_of :email, :with => /whatever/, :allow_blank => true # :allow_nil - If set to true, skips this validation if the attribute is nil (default is false). # :allow_blank - If set to true, skips this validation if the attribute is blank (default is false). http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#M001639 You will probably want to use allow_blank because if you create an email via params it could come back as an empty string. -- Robert Zotter Zapient, LLC Ruby on Rails Development and Consulting http://www.zapient.com http://www.fromjavatoruby.com On Nov 20, 4:42 am, Thani Ararsu <[EMAIL PROTECTED]> wrote: > in my User model i am using validations like this > > class User < ActiveRecord::Base > validates_presence_of :email > validates_format_of :email ,:with=>/something/ > > end > > if my email field is blank then i am getting 2 error messages > but i want only one that should be first one (here it is presence) > > any idea? > -- > 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-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: Beyond the simple select
On 20 Nov 2008, at 13:29, Tom Lobato wrote: > > > How will this ":include" change the json response? Since there is a > > list being selected, I need to parse it in the client side. > I`m not using simple to_json, but to_ext_json (provided by the plugin: > http://inside.glnetworks.de/2008/01/18/announcing-ext-scaffold-generator-plugin-for-rails/) > > , > but I think the "include" won`t change. > http://api.rubyonrails.com/classes/ActiveRecord/Serialization.html#M001417 > On Nov 20, 6:49 am, Frederick Cheung <[EMAIL PROTECTED]> > wrote: >> On Nov 20, 8:02 am, Tom Lobato <[EMAIL PROTECTED]> wrote: >> >>> I have 3 tables: >>> pupils: id, name, born_date, sex >>> courses:id, course_name, description >>> pupilXcourse: pupil_id, course_id >> >>> Today I run a Pupil.find(:all) and send a json response to the >>> browser, who shows a table of pupils and its attributes. >>> I want to include in this listing on the browser a field showing >>> what >>> courses each pupil got. >> >> If you're just using Rails' to_json and you've got the appropriate >> associations then you can just do pupils.to_json :include => :courses >> >> Fred >> >>> I don`t know the fast/easy method to achieve this. Maybe a custom, >>> more complex, select statment, or a additional select with >>> additional >>> json request. >> >>> If you have hints or examples, it you be very welcome. >> >>> Thank 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-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: Best Modal Popup for Rails
Hi David, David wrote: > > I have been researching modal dialog popup windows for my rails app > and have narrowed the search down to two with two main variables in > mind: ease of integration and speed. The two, that use prototype, are > Redbox and the Prototype Window Class. I am looking for any input as > to which may work better in terms of speed and integration and any > other general advice. I've been working for the past few days with Redbox. It's got some 'cruft' that needed to be cleaned up, but it was pretty easy to figure out. I haven't worked with the other. There was a brief exchange yesterday about the same topic and another library was mentioned. It was titled "what is the preferred 'lightbox' plugin". > I would also like to style the popup windows with rounded corners This is done with an image background on the div that gets rendered into your lightbox. You'll need to style it with something like: width: 999px; height: 555px; background-image: url(../images/total_box.png); The image won't display (at least it wouldn't for me) if you don't specify the width and height. HTH, Bill --~--~-~--~~~---~--~~ You received 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] how to run linux command in rake file
hi all, i need to grep a word count from a text file and i want to display the count. i need all the above in a rake file , i tried it by using today_count= system("grep -R 'time' oct_10.txt | grep -R 'hi' | wc -l") puts "today count is :#{today_count}" but today_count returns 'true' instead of count. plz reply ASAP. Thanks.. --vamsi. -- 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: File Upload fails for large files
> If you are doing something similar, make sure > you use a submit button instead of a Javascript that submits the form. Chirantan, look into the responds_to_parent plugin to do it via JS. http://sean.treadway.info/responds-to-parent/ --~--~-~--~~~---~--~~ You received 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: Beyond the simple select
How will this ":include" change the json response? Since there is a list being selected, I need to parse it in the client side. I`m not using simple to_json, but to_ext_json (provided by the plugin: http://inside.glnetworks.de/2008/01/18/announcing-ext-scaffold-generator-plugin-for-rails/), but I think the "include" won`t change. On Nov 20, 6:49 am, Frederick Cheung <[EMAIL PROTECTED]> wrote: > On Nov 20, 8:02 am, Tom Lobato <[EMAIL PROTECTED]> wrote: > > > I have 3 tables: > > pupils: id, name, born_date, sex > > courses: id, course_name, description > > pupilXcourse: pupil_id, course_id > > > Today I run a Pupil.find(:all) and send a json response to the > > browser, who shows a table of pupils and its attributes. > > I want to include in this listing on the browser a field showing what > > courses each pupil got. > > If you're just using Rails' to_json and you've got the appropriate > associations then you can just do pupils.to_json :include => :courses > > Fred > > > I don`t know the fast/easy method to achieve this. Maybe a custom, > > more complex, select statment, or a additional select with additional > > json request. > > > If you have hints or examples, it you be very welcome. > > > Thank 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-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] only one error message for a field
in my User model i am using validations like this class User < ActiveRecord::Base validates_presence_of :email validates_format_of :email ,:with=>/something/ end if my email field is blank then i am getting 2 error messages but i want only one that should be first one (here it is presence) any idea? -- 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: Overwriting / Decorating ActiveRecord association accessor
I was a bit too fast and euphoric :) Now this works better: has_many :emails do def load_target super if not @loaded_link and proxy_owner.link.respond_to?(:emails) puts "loading link" @target += proxy_owner.link.emails @loaded_link = true end @target end def reset super @loaded_link = false end 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-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] using javascript to accomplish the ajax for will_paginate
To use the ajax replacing some html element's content for my pagination,I user some js codes like following ,but pagination still work like a normal call,not ajax. How do i manage? > > document.observe("dom:loaded", function() { >// pagination is the class will_paginate wraps around the links >$$('.pagination').each(function(pagination) { > // let's put the observer on the div element and not all the > links, your browser will thank you > pagination.observe('click', function(e) { >var clicked = $(e.target); >// time to see if the clicked item was indeed one of the links >if(clicked.match('a')) { > // if it was, stop the default page refresh and fire an ajax > request instead > // let's not forget a RESTful design wants use to use GET > instead of the default POST method > e.stop(); > /new Ajax.Updater('element_id',clicked.href,{method:'get'}); >} > }) >}); > > } > --~--~-~--~~~---~--~~ You received 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] Best Modal Popup for Rails
I have been researching modal dialog popup windows for my rails app and have narrowed the search down to two with two main variables in mind: ease of integration and speed. The two, that use prototype, are Redbox and the Prototype Window Class. I am looking for any input as to which may work better in terms of speed and integration and any other general advice. I would also like to style the popup windows with rounded corners if possible and not sure if you can do that with either one. Also, if there is another library that I am leaving out that would work with me pre-req's please let me know. thanks, Dave --~--~-~--~~~---~--~~ You received 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: Overwriting / Decorating ActiveRecord association accessor
> > The trick is that link.emails isn't an array - it's an association > proxy. > I'm not sure what the write thing to do here is. Maybe something like > Thanks so much for your input. You got me in the right direction: has_many :emails do def load_target super if !loaded? and proxy_owner.link.respond_to?(:emails) @target += proxy_owner.link.emails end @target end end This works like a charm :) Thumbs up! Marcel --~--~-~--~~~---~--~~ You received 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: To use multiple databases, sets of tables or rails applications
You might want to take a look here http://railsforum.com/viewtopic.php?id=20582 On Nov 19, 10:07 pm, Mark Smith <[EMAIL PROTECTED]> wrote: > > I'm assuming all 10 tables are actually the same for each client, > > right? Just have an 11th table - "clients". Relate your other tables > > to the clients table, and use the power of ActiveRecord to query for > > all the data you need for a specific client. > > > You can use a before_filter in your application controller to look at > > the subdomain to discover which client you're supposed to be using. > > That sounds super convenient, but wouldn't it lead to really bloated > tables and slow searches in the long run? I think I would vote for > option #2, individual databases for each client. Also, obviously they > would be backed up, but this would also prevent one database getting > hosed from knocking out all your clients. --~--~-~--~~~---~--~~ You received 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: Uploading Files
Ivor Paul wrote: > Pradeep wrote: >> Hi All, >> >> I also get the same error. Even in the development mode. Can anyone >> help!! >> >> Cheers, >> Pradeep. >> >> On Dec 20 2006, 4:00 am, Mark Dodwell <[EMAIL PROTECTED] > > Hi - I got the same error on my live app. Got the call to say the site > is down. Restarted mongrel and after clearing the PID it worked and al > was well. > > I found the exact same error in the mongrel.log. > > Has anyone figured anything out? > > Ivor I faced the same problem but thankfully I was able to get out of it. In my case, I was using a javacsript to submit the form that held the file field. When I used a normal submit button, it all started working fine. :-) I really dont know what exactly is wrong in submitting form using a javascript but using the submit button instead worked. You may want to try that... Chirantan. -- 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] how to enable memcached along with nginx server
hi, I have configured nginx server and enabled header expiry + gzip component now i want to enable memcached along with it but as soon as I enable memcached header expiry stops working can any one tell me the reason for it ? 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-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] what do most use for Date selection in views & Date validation in models???
what do most use for Date selection in views & the complimentary Date validation in models?I'm just finding that the answer to this doesn't seem obvious no? --~--~-~--~~~---~--~~ You received 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: assert XSD validity
On 20 Nov 2008, at 10:56, Jarl Friis wrote: > > Thanks for the reply. > > Frederick Cheung <[EMAIL PROTECTED]> writes: > >> On 19 Nov 2008, at 13:07, Jarl Friis wrote: >> >>> >>> Hi. >>> >>> I am working on a webservice producing xml content, In my rails >>> functional test I would like to assert that this generated xml >>> (@reponse.body) conforms to a specific XSD. >>> >>> What is the best approach to do this? >>> >> Dunno about best approach but I recently did something along those >> lines (in this particular case I was generating xml to send to a >> webservice rather than your way round, but I don't think that's >> relevant) >> in the end I just popened xmllint and piped my xml in. > > Cool, but xmllint only validates against a DTD, right? I am interested > in (a more strict) validation against a XSD. Does both as far as I know ( I only had an xsd anyway) Fred > > > Jarl > > > > --~--~-~--~~~---~--~~ You received 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: Couldn't find without an ID
On 20 Nov 2008, at 11:03, Dr_Gavin wrote: > > > Well spotted Fred! > wouldn't this be even easier though: > @blog = Blog.all if you're on 2.1 or higher then yes > > > Gavin > > On Nov 20, 10:23 am, Frederick Cheung <[EMAIL PROTECTED]> > wrote: >> On 20 Nov 2008, at 09:58, Smarty 2k wrote: >> >> >> >>> def form_for_test >>> @blog= Blog.find[:all] >> >> that's wrong. You probably meant Blog.find :all or Blog.find(:all) >> (which are the same) >> >> 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-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: File Upload fails for large files
Its fixed. We were using a Javascript to submit the form that held the file field. When we used a submit button instead of the javascript, it all started working properly. I wonder whats wrong internally but for now, the code is working :-). If you are doing something similar, make sure you use a submit button instead of a Javascript that submits the form. Chirantan On Nov 20, 10:02 am, Chirantan <[EMAIL PROTECTED]> wrote: > Hi, > I am using mongrel with nginx and I am facing problem when I try to > upload a large file. After googling about this, I came to know that I > need to configure nginx.conf file by setting 'client_max_body_size' > to > a value of desired maximum file size. I did that but still it does > not > seem to work. Files above 200 KB do not get uploaded. I also get a > weird error about sockets (Given below the nginx.conf file) > What am I doing wrong? Please help. > > My nginx.conf lokos like this: > > user postgres ; > worker_processes 2; > error_log /var/www/webapps/FileSharing/log/error.log notice; > pid /var/www/webapps/FileSharing/log/nginx.pid; > events { > worker_connections 1024; > > } > > http { > include mime.types; > default_type application/octet-stream; > # no sendfile on OSX uncomment > #this if your on linux or bsd > #sendfile on; > tcp_nopush on; > keepalive_timeout 65; > tcp_nodelay on; > upstream mongrel { > server 127.0.0.1:4000; > server 127.0.0.1:4001; > server 127.0.0.1:4002; > } > gzip on; > gzip_min_length 1100; > gzip_buffers 4 8k; > gzip_types text/plain; > server { > listen 80; > server_name something.com; > access_log /var/www/webapps/FileSharing/log/access.log; > error_log /var/www/webapps/FileSharing/log/error.log; > root /var/www/webapps/FileSharing/public; > access_log on; > rewrite_log on; > #client_max_body_size 1048576k; > client_max_body_size 1024M; > client_body_buffer_size 512k; > client_header_buffer_size 1048576k; > location /ui > { > root /var/www/webapps/FileSharing/public; > } > location ~ ^/$ { > if (-f /index.html){ > rewrite (.*) /index.html last; > } > proxy_pass http://mongrel; > } > location / { > if (!-f $request_filename.html) { > proxy_pass http://mongrel; > } > rewrite (.*) $1.html last; > } > location ~ .html { > root /Users/ez/nginx/public; > } > location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar| > bz2| > doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov)$ { > access_log off; > expires 30d; > } > location / { > # needed to forward user's IP address to rails > proxy_set_header X-Real-IP $remote_addr; > # needed for HTTPS > #proxy_set_header X_FORWARDED_PROTO https; > #proxy_set_header X-Forwarded-For > $proxy_add_x_forwarded_for; > proxy_set_header Host $http_host; > proxy_redirect false; > #proxy_max_temp_file_size 1048576k; > proxy_max_temp_file_size 1024M; > # If the file exists as a static file serve it directly > without > # running all the other rewite tests on it > if (-f $request_filename) { > break; > } > # this is the meat of the rails page caching config > # it adds .html to the end of the url and then checks > # the filesystem for that file. If it exists, then we > # rewite the url to have explicit .html on the end > # and then send it on its way to the next config rule. > # if there is no file on the fs then it sets all the > # necessary headers and proxies to our upstream mongrels > if (-f $request_filename.html) { > rewrite (.*) $1.html break; > } > if (!-f $request_filename) { > proxy_passhttp://mongrel; > break; > } > error_page 500 502 503 504 /500.html; > location = /500.html { > root /var/www/webapps/FileSharing/public; > } > } > } > > } > > Error: > > Thu Nov 20 10:47:37 +0530 2008: Error reading HTTP body: > # > /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/ > http_request.rb:107:in `read_socket' > /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/ > http_request.rb:77:in `read_body' > /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/ > http_request.rb:55:in `initialize' > /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/ > mongrel.rb: > 149:in `new' > /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/ > mongrel.rb: > 149:in `process_client' > /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/ > mongrel.rb: > 285:in
[Rails] Apche + SSL Configuration Issue
Hi, I am trying to setup the SSL for my site. i am using apache as webserver and mongrel cluster as application server and Ubuntu as server OS. I have configured my apache server for the SSL setup as per the certificate files i got from Go daddy. I configure apache server according to below link. http://www.williambharding.com/blog/rails/ultimate-guide-to-setup-ssl-on-rails-and-apache-2-with-ubuntu-seasoning/ After configuring all the things and restarting apache when i am hitting url in browser as "Network Timeout" with page load error. Checking at apache error log getting error as "caught SIGWINCH, shutting down gracefully Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.1 with Suhosin-Patch mod_ssl/ 2.2.8 OpenSSL/0.9.8g configured -- resuming normal operations " Checking the application log getting error as "Filter chain halted as [#] returned_false." Does anyone come across same issue ? Thanks in Adavance. Piyush. --~--~-~--~~~---~--~~ You received 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: Couldn't find without an ID
Well spotted Fred! wouldn't this be even easier though: @blog = Blog.all Gavin On Nov 20, 10:23 am, Frederick Cheung <[EMAIL PROTECTED]> wrote: > On 20 Nov 2008, at 09:58, Smarty 2k wrote: > > > > > def form_for_test > > [EMAIL PROTECTED] Blog.find[:all] > > that's wrong. You probably meant Blog.find :all or Blog.find(:all) > (which are the same) > > 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-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: Couldn't find without an ID
Well spotted Fred! wouldn't this be even easier though: @blog = Blog.all Gavin On Nov 20, 10:23 am, Frederick Cheung <[EMAIL PROTECTED]> wrote: > On 20 Nov 2008, at 09:58, Smarty 2k wrote: > > > > > def form_for_test > > [EMAIL PROTECTED] Blog.find[:all] > > that's wrong. You probably meant Blog.find :all or Blog.find(:all) > (which are the same) > > 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-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: Sending a fire&forget http request in a model class.
Thanks Fred... I totally agree, i actually build up all the params in a hash anyway. Here it is in your recommended format. One of the params has the complication of actually being a full url with params itself. Curl seems to deal happily with this, i'm guessing it escapes everything nicely. But trying this, i get the same 401 error back (#). host = "www.l-mail.biz" port = 80 path = "/scripts/lia/lia.php" param_hash = { :l_cid => '1106', :l_key => 'cg3608898b74a4c688787ab479b8bb9f', :l_content => 'http://ir.chazanga.com/letter/show?encoded=MTE4MiZpdCdzIHdlZG5lc2RheQ==', :l_pb_url => 'http://ir.chazanga.com/letter/confirm', :l_sname => 'chazanga', :l_rname => 'Max Williams', :l_rcname => 'chazanga', :l_raddress1 => 'Suites 17 & 18', :l_raddress2 => '9-12 Middle Street', :l_rcity => 'Brighton', :l_rpostcode => 'BN1 3TN', :l_rcountry => '3', :l_email => '[EMAIL PROTECTED]', :l_fb_emails => '1', :p_user_id => '2054' } response = Net::HTTP.start(host, port) do |http| get = Net::HTTP::Get.new path get.form_data = param_hash get.content_type = "application/x-www-form-urlencoded" http.request get 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-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: assert XSD validity
Thanks for the reply. Frederick Cheung <[EMAIL PROTECTED]> writes: > On 19 Nov 2008, at 13:07, Jarl Friis wrote: > >> >> Hi. >> >> I am working on a webservice producing xml content, In my rails >> functional test I would like to assert that this generated xml >> (@reponse.body) conforms to a specific XSD. >> >> What is the best approach to do this? >> > Dunno about best approach but I recently did something along those > lines (in this particular case I was generating xml to send to a > webservice rather than your way round, but I don't think that's > relevant) > in the end I just popened xmllint and piped my xml in. Cool, but xmllint only validates against a DTD, right? I am interested in (a more strict) validation against a XSD. Jarl --~--~-~--~~~---~--~~ You received 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: Couldn't find without an ID
On 20 Nov 2008, at 09:58, Smarty 2k wrote: > > def form_for_test > @blog= Blog.find[:all] > that's wrong. You probably meant Blog.find :all or Blog.find(:all) (which are the same) 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-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: Couldn't find without an ID
Hi! just briefly glancing over this but try adding '.id' to the :id => on your form_for tag So: <% form_for :blog, :url => { :action => 'save', :id => @blog.id } do |f| %> Gavin On Nov 20, 9:58 am, Smarty 2k <[EMAIL PROTECTED]> wrote: > hi friends... > my rhtml is for_for_test.rhtml > > > Form_For Tester > > > <% form_for :blog, :url => { :action => 'save', :id => @blog } do > |f| %> > Name: <%= f.text_field :blog %> > <%= submit_tag 'Save' %> > <% end %> > > > > controller is > > def form_for_test > @blog= Blog.find[:all] > end > def save > blog = Blog.find(params[:id]) > blog.update_attributes(params[:blog]) > redirect_to :action => 'form_for_test' > end > > error msg: Couldn't find Blog without an ID > -- > 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-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: Code changes are ignored due to code minor ver. were cached
Jeff Cohen wrote: > On Nov 18, 10:03�am, Frederick Cheung <[EMAIL PROTECTED]> > wrote: >> >> use require_dependency instead of require. >> >> Fred > > But if the file name follows conventions (so a class named MyToolClass > would go in a file named app/models/my_tool_class.rb or lib/ > my_tool_class.rb), then no require or require_dependency should be > needed and code changes will be automatically reloaded in development > mode. > > If you're not following naming conventions, then do as Fred > suggests :-) > > Jeff > > www.purpleworkshops.com Many thanks, guys! I put each my class into it's own file in app's lib directory following naming conventions and Voila! After that every change in these files are incorporated immediately without require or require_dependency calls. That's great! -- 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: Sending a fire&forget http request in a model class.
On 20 Nov 2008, at 09:38, Max Williams wrote: > > Thanks Fred > > I'm not having any luck with it so far - this is the curl call i was > making (with some changes to protect the innocent): > > curl http://www.l-mail.biz/scripts/lia/lia.php \ > -d l_cid='1106' \ > -d l_key='cg3608898b74a4c688787ab479b8bb9f' \ > -d > l_content='http://ir.chazanga.com/letter/show?encoded=MTE4MiZpdCdzIHdlZG5lc2RheQ==' > \ > -d l_pb_url='http://ir.chazanga.com/letter/confirm' \ > -d l_sname='chazanga' \ > -d l_rname='Max Williams' \ > -d l_rcname='chazanga' \ > -d l_raddress1='Suites 17 & 18' \ > -d l_raddress2='9-12 Middle Street' \ > -d l_rcity='Brighton' \ > -d l_rpostcode='BN1 3TN' \ > -d l_rcountry='3' \ > -d l_email='[EMAIL PROTECTED]' \ > -d l_fb_emails='1' \ > -d p_user_id='2054' > > So, when i tried to use Net::HTTP i was trying to deal with this > massive > params string. I split it up like so: > > domain = "www.l-mail.biz" > > path = "/scripts/lia/lia.php" > > params = > "l_cid=1106&l_key=cg3608898b74a4c688787ab479b8bb9f&l_content=http://ir.chazanga.com/letter/show?encoded=MTE4MiZpdCdzIHdlZG5lc2RheQ==&l_pb_url=http://ir.chazanga.com/letter/confirm&l_sname=chazanga&l_rname=Max-Williams&l_rcname=chazanga&l_raddress1=Suites-17-18&l_raddress2=9-12-Middle-Street&l_rcity=Brighton&l_rpostcode=BN1-3TN&l_rcountry=3&[EMAIL > PROTECTED]&l_fb_emails=1&p_user_id=2054 > " > > The params string had spaces and & signs in it, so i just replaced > them > with safe characters temporarily while i played with Net::HTTP (with > escaping them properly down for a later task). > > I tried this: > > http = Net::HTTP.new("#{domain}") > headers, body = http.get("#{path}?#{params}") Yuck. would be a lot easier to take a hash of params (ie {'l_cid' => '1106', 'l_key' => 'cg3608898b74a4c688787ab479b8bb9f', ...} and then call to_query on it. Net::HTTP will also do that for you, with something like response = Net::HTTP.start(host, port) do |http| get = Net::HTTP::Get.new path get.form_data = some_hash get.content_type = "application/x-www-form-urlencoded" http.request get end 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-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] Testing ActiveResource models with HttpMock
Hi all, I have already spent (too) many hours trying to wire HttpMock in my test suite and I am stuck. I'm setting up my "remote fixtures" using a technique quite similar to what's described here: http://giantrobots.thoughtbot.com/2007/2/2/activeresource-and-testing but even the simplest of my test requests are not accepted. I always bump into "ActiveResource::InvalidRequestError: No response recorded for ..." I see two problems: 1. The real API requires HTTP Basic Authentication so all my client requests include an authorization header which I've added to my request. But as there's no documentation at all about how to do this, I might be mistaken. I am adding the expected request header as follow: request_headers = { 'Authorization' => 'Basic REPLACEDBUTYOUGETTHEIDEA==' } ActiveResource::HttpMock.respond_to do |mock| mock.get "/contacts.xml", request_headers, load_remote_fixtures ('contacts.xml') end 2. I am wondering if this bug http://codeintensity.blogspot.com/2007/05/bug-in-activeresources-httpmock.html has actually ever been fixed, looking at HttpMock's code, I don't see how the ordering of the hash key is guaranteed, unless there's some more ActiveSupport magic involved (but I don't think so). Any help about this will be greatly appreciated. If I judge by the number of results returned by my various Google searches on that topic, it seems like there are not many people using ActiveResource testing... or only a bunch unlucky few have problems with it. ;) Regards, Xavier --~--~-~--~~~---~--~~ You received 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 -~--~~~~--~~--~--~---