[Rails] Re: Getting the associated model in a join table
I don't think a delegate would work. Okay, just to recap on the database structure: products | id | name | price | | 1 | a | 2.50 | | 2 | b | 1.50 | suppliers | id | name | | 1 | s_a | | 2 | s_b | products_suppliers | id | supplier_id | product_id | supplier_type | | 1 | 1 | 1 | vendor | | 2 | 1 | 2 | manufacturer| Firstly, I don't think that 'products_suppliers' is a good name since this form is only a requirement for HABTM to work. It should be more descriptive of the relationship, but your call. Okay, so I believe that you want to do something like this: p = Product.first p.vendors # = [# Supplier id: 1, name: s_a, #Supplier id: 2, name: s_b] p.manufacturer # = # Supplier id: 1, name: s_a You might want to try this: class Product ActiveRecord::Base has_many :products_suppliers has_many suppliers, :through = products_suppliers named_scope :vendors, :conditions = [supplier_type = ?, vendor] named_scope :manufacturer, :conditions = [supplier_type = ?, manufacturer] end This does not restrict the manufacturer to a one-to-many relationship, so you will have to ensure that each product will have only one manufacturer (you can do this pretty easily with some validations). On Apr 8, 11:14 am, Matt Jones al2o...@gmail.com wrote: On Apr 7, 1:28 pm, Marcelo de Moraes Serpa celose...@gmail.com wrote: So let's take this code p = Product.find(1) What I need is a specific products_suppliers related to specific combo of (supplier_id,product_id) keys, so I can get the supplier_type data related to this product+supplier. However, I the has_many relationship in Supplier reaturns all the products_suppliers that has supplier_id == the id of this supplier -- To get the specific products_supplier I would also need the id of the product that owns this supplier, but I can't get it. So, the first thing I though was something like has_one :through. That's why I said, a has_one relationship through a link table. The thing is, I need the product_id that owns this supplier from the supplier model. I might as well just leave AR and do some raw SQL, or maybe use sql :select statemente in the association to fetch the type from the link table into the association. Does that make sense? Maybe this is too obvious, but given the example above, couldn't you just use: p.products_suppliers.find_by_supplier_id(some_supplier_id) That will give you the supplier that you're looking for. BTW, I'd recommend a different name for the supplier_type column - that pattern (same as the foreign key, with _type instead of _id) is the Rails convention for single table inheritance, which is NOT what you're looking for here. It shouldn't cause a problem, but the AR association code is known to sometimes get really weird indigestion from that situation... Hope this helps, --Matt Jones --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Validate file format: not by extension
Hi All, I want to validate a file format before uploaded on server. I know it can be validate by content-type or using regex. But I wonder if someone change the extension of file and then uploaded it I have to validate only two format: 1) wav 2) gsm 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to use Net::SSH
On Tue, Apr 7, 2009 at 10:27 PM, Shripad shripad.josh...@gmail.com wrote: Hi all, I am having following code in ruby require 'net/ssh' require 'net/sftp' begin Net::SSH.start ('132.147.161.159',:password='k',:port=1234,:username='k') do |ssh| ssh.sftp.connect do |sftp| Dir.foreach('.') do |file| puts file end end end rescue Exception= Ex puts Ex.message end After executing the above code it is giving me following error Bad file descriptor - connect(2) username, password, and ipaddress are fine What I want is to take data from remote machine to server. Please Help me out. Thanks and Regards, Shri What are you wanting to do? SFTP or SSH? From the code, it appears that you're trying to move a file from point A to B. Thus, here's a brief outline of the things that you can do with SFTP: require 'net/sftp' Net::SFTP.start('host', 'username', :password = 'password') do |sftp| # upload a file or directory to the remote host sftp.upload!(/path/to/local, /path/to/remote) # download a file or directory from the remote host sftp.download!(/path/to/remote, /path/to/local) # grab data off the remote host directly to a buffer data = sftp.download!(/path/to/remote) # open and write to a pseudo-IO for a remote file sftp.file.open(/path/to/remote, w) do |f| f.puts Hello, world!\n end # open and read from a pseudo-IO for a remote file sftp.file.open(/path/to/remote, r) do |f| puts f.gets end # create a directory sftp.mkdir! /path/to/directory # list the entries in a directory sftp.dir.foreach(/path/to/directory) do |entry| puts entry.longname end end Good luck, -Conrad --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to pass data to Javascript variable from Ruby on Rails
The most straightforward way of doing what you want is: %= my_var % On Wed, Apr 8, 2009 at 7:31 AM, SpringFlowers AutumnMoon rails-mailing-l...@andreas-s.net wrote: I wonder on RoR, will there be a need sometimes to pass some data from Ruby to Javascript? 1) var title = __ ; What is the proper way to do it (fill in the code for __ ) if title can have newline character, or single / double quote or any weird character. and what's more, what if the title from database can have script tags, so the code need to do cross-site scripting (xss) prevention, say, if the title needs to be set into a div's innerHTML later. 2) further more, what if we do a href=# onclick=changeIt(__); return false;Click me/a This case is more complicated, since I think there is a rule that says, anything inside the attribute's value will first be parsed by the browser as HTML first, so this is a little trickier than case (1). Any standard way in Rails to do 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Adding files in git
Do I need to add each new file in git that is created after init? Or does it happen when I do git commit -a -v -m 'test'? If so, can I just use git . and it will take new files and skip old ones? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Rails 2.3 memcache performance drop
After much effort I upgraded our fairly large Rails app from 2.1 to 2.3. After deployment yesterday I noticed an across the board increase in response times. It seems that every call to memcache now takes 10x longer than before. Here are some example numbers from my development log (below), with memcache running locally. We see similar scale of performance drop in production as well - average memcache call before 2ms, now 20ms. It adds up to a significant hit. Before Rails 2.3 upgrade: Cached fragment hit: views/homepage_recent_blog_posts (0.00043) Cached fragment hit: views/homepage_active_threads (0.00033) Cached fragment hit: views/homepage_weekly_feature (0.00029) Cached fragment hit: views/homepage_recent_approved_items (0.00036) Cached fragment hit: views/homepage_popular_items (0.00037) Cached fragment hit: views/number_of_members (0.00032) After Rails 2.3 upgrade: Cached fragment hit: views/homepage_recent_blog_posts (3.2ms) Cached fragment hit: views/homepage_active_threads (3.5ms) Cached fragment hit: views/homepage_weekly_feature (2.9ms) Cached fragment hit: views/homepage_recent_approved_items (2.8ms) Cached fragment hit: views/homepage_popular_items (3.1ms) Cached fragment hit: views/number_of_members (6.7ms) Before I start delving into the memcache internals in Rails 2.3, has anyone else experienced this degradation on their apps? Is there a magic 'make it fast again' switch that I can flick? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to use Net::SSH
Hi, Thanks Conrad for ur urgent reply What I want to do is just pickup the images from machine A to machine B. I did what you say but I am getting error as follows E:/InstantRails/ruby/lib/ruby/gems/1.8/gems/net-sftp-2.0.2/lib/net/ sftp.rb:43:in `start': undefined method `shutdown!' for nil:NilClass (NoMethodError) from SSHTransfer.rb:8 what I write is this sftp=Net::SFTP.start('132.147.161.159', 'k',:password = 'k') Thanks and Regards On Apr 8, 11:24 am, Conrad Taylor conra...@gmail.com wrote: On Tue, Apr 7, 2009 at 10:27 PM, Shripad shripad.josh...@gmail.com wrote: Hi all, I am having following code in ruby require 'net/ssh' require 'net/sftp' begin Net::SSH.start ('132.147.161.159',:password='k',:port=1234,:username='k') do |ssh| ssh.sftp.connect do |sftp| Dir.foreach('.') do |file| puts file end end end rescue Exception= Ex puts Ex.message end After executing the above code it is giving me following error Bad file descriptor - connect(2) username, password, and ipaddress are fine What I want is to take data from remote machine to server. Please Help me out. Thanks and Regards, Shri What are you wanting to do? SFTP or SSH? From the code, it appears that you're trying to move a file from point A to B. Thus, here's a brief outline of the things that you can do with SFTP: require 'net/sftp' Net::SFTP.start('host', 'username', :password = 'password') do |sftp| # upload a file or directory to the remote host sftp.upload!(/path/to/local, /path/to/remote) # download a file or directory from the remote host sftp.download!(/path/to/remote, /path/to/local) # grab data off the remote host directly to a buffer data = sftp.download!(/path/to/remote) # open and write to a pseudo-IO for a remote file sftp.file.open(/path/to/remote, w) do |f| f.puts Hello, world!\n end # open and read from a pseudo-IO for a remote file sftp.file.open(/path/to/remote, r) do |f| puts f.gets end # create a directory sftp.mkdir! /path/to/directory # list the entries in a directory sftp.dir.foreach(/path/to/directory) do |entry| puts entry.longname end end Good luck, -Conrad --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Initializers not available in controllers...
On Apr 7, 10:05 pm, Neal L neal.lo...@gmail.com wrote: In my account signup controller, I call: @plan_cost = app_plan...@plan_name][Price] but I get an error: uninitialized constant ClientsController::APP_PLANS So what am I doing wrong here? Why can't I get to the variable I initialized??? Did you restart the server after adding/changing this initializer ? Fred 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Problem with MYSQL after re-installing rails
On Apr 8, 12:25 am, Gavin ga...@thinkersplayground.com wrote: Hmmm - have downloaded and re-installed MYSQL 5.1.33 but did you get the 32bit version ? (and have you tried using --with- mysql-config=/path/to/mysql_config ?) Fred Still getting the same issue. In pref pane it shows that mysql is running. Can anybody think of anything else I can check/do? Really need to get my database back up and running soon :S Thanks On Apr 7, 8:31 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Apr 7, 7:36 pm, Dean Richardson rails-mailing-l...@andreas-s.net wrote: Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.7 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.7/gem_make.out Any suggestions for diagnosing my mistake here? That sounds like a different issue ( in Gavin's case it just the headers/libs for mysql it can't locate) - maybe you don't have all of the stuff from the Dev tools you need ? Fred Thanks! Dean Richardson -- 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Anyone know a way to create html comments with the names of the views?
On Apr 8, 1:54 am, Emanuele Tozzato etozz...@gmail.com wrote: I'm using it and it's cool, but it should probably check if any layout statement is present on the controller: if layout is nil then I probably don't need/want any comment in the template :) More precisely if what it's rendering isn't html it probably shouldn't be putting html comments in! Fred (found this with the :tex view of instiki clone) thanks 4 the plugin! On Fri, Apr 3, 2009 at 10:50 AM, Frederick Cheung frederick.che...@gmail.com wrote: For what it's worth i've pluginised this:http://github.com/fcheung/tattler/tree/master -- Emanuele Tozzato +1 (619) 549 3230 1985 Sherington Place, #E302 Newport Beach, CA 92663http://mekdigital.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: AR.find :include is adding stuff I don't want
On Apr 8, 5:35 am, Greg Willits rails-mailing-l...@andreas-s.net wrote: When I use the code above, I get data from Article (good), Extras (good), and Assets (bad), and nothing from Pages (curious). I don't understand why Assets is being included, and I don't know how to keep that data out of the results. Odd. Maybe you could show the sql it is executing ? Fred What am I missing? Thx. -- gw -- 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Conditionally respond with HTTP redirect for xml_http_request
On Apr 8, 6:51 am, Ram yourstruly.vi...@gmail.com wrote: Hi all, I have select box in one of my views which lists a few contacts. I also have an option in this select box to add a new contact. There is also an observe_field hook to this select box that Ajax requests further info about the selected contact from the controller and displays it in an adjacent info div. Now, I need to redirect the user to the New Contact page from the controller if the selected value from the select box is new contact. This is the controller code I have now if request.xml_http_request? if !...@contact.blank? render :partial = show, :layout = false elsif params[:id] == new contact redirect_to new_contact_path else render :text = Please select a contact end end This renders the New Contact page in the info div. Whereas, I want the user to be completely redirected to the New Contact page like a HTTP response would. Any thoughts on how I can handle this? Any ideas welcome.. Thanks! Two ways of doing this: either the observe_field thingy has a callback that redirects in the right circumstances or you switch to using render :update (and then use page.redirect_to), In the latter case you have to use render :update for all of these 3 possibilities and you need to change your observe_field invocation to not pass the :update option. 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Ajax Rails
On Apr 8, 5:45 am, esdevs seanpdev...@gmail.com wrote: ok - I am trying to do something seemingly straight forward. Essentially I want to list out a bunch of items and for each item individually, if the user clicks on it, the corresponding web link will appear underneath -- if the user clicks on the item again, then the weblink disappears. This should work for each item in the list. I have tried but to no avail - below is a vid clip of what is happening as well as the code that I am using -- any help is greatly appreciated Well by the looks of things you have multiple divs with the same id (never a good) idea, you're using link_to_remote but not actually making an ajax call (link_to_function might be more appropriate) and if my memory is correct and you want to select that link, next() selects siblings whereas it looks like you want to select children (which is what down does) Fred http://www.screentoaster.com/watch/stU0… BeQlVeXV5e (partial _post.html.erb) h2%= link_to_remote(#{post.title}, :after = $('link').next (1).toggle()) %/h2 div id=link style=display: none; %= post.link % /div --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Adding files in git
You have to add files to git with: git add . This will add all new files. Command git commit -a -m '' with add only already tracked and changed files and commit them with given message. On Apr 8, 9:02 am, Pål Bergström rails-mailing-l...@andreas-s.net wrote: Do I need to add each new file in git that is created after init? Or does it happen when I do git commit -a -v -m 'test'? If so, can I just use git . and it will take new files and skip old ones? -- 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Conditionally respond with HTTP redirect for xml_http_request
Hi Fred, Thanks for your response. render :update Ive got quite a few Ruby conditions and styling going in the js.erb file im using now to display the contact information. And ive got more possibilities than the 3 ive shown above in the controller. So this might not be the right option for me. Right? observe_field callback This might work for me. Right now, the only callbacks I have on the observe_field are showing and hiding the spinner. I have never written custom callbacks on Rails JS helpers. Could you help me through this? So im guessing I should be having something like this %= observe_field 'contact_id', :frequency = 0.5, :update = 'info', :before = Element.show('spinner'), :success = handle_contact_request(value);, :url = show_contact_path,:method =:get, :with = 'contact_id' % and in application.js function handle_contact_request(value){ Element.hide('spinner'); if value==new contact { //how do i redirect to the New Contact page? } else { //show contact info. But how do I handle the conditions and styling?? } } Am I getting the basic idea right? If yes, how can I handle the conditional redirecting and the rest in Javascript? Thanks again Fred. On Apr 8, 12:20 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Apr 8, 6:51 am, Ram yourstruly.vi...@gmail.com wrote: Hi all, I have select box in one of my views which lists a few contacts. I also have an option in this select box to add a new contact. There is also an observe_field hook to this select box that Ajax requests further info about the selected contact from the controller and displays it in an adjacent info div. Now, I need to redirect the user to the New Contact page from the controller if the selected value from the select box is new contact. This is the controller code I have now if request.xml_http_request? if !...@contact.blank? render :partial = show, :layout = false elsif params[:id] == new contact redirect_to new_contact_path else render :text = Please select a contact end end This renders the New Contact page in the info div. Whereas, I want the user to be completely redirected to the New Contact page like a HTTP response would. Any thoughts on how I can handle this? Any ideas welcome.. Thanks! Two ways of doing this: either the observe_field thingy has a callback that redirects in the right circumstances or you switch to using render :update (and then use page.redirect_to), In the latter case you have to use render :update for all of these 3 possibilities and you need to change your observe_field invocation to not pass the :update option. 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Adding files in git
Bosko Ivanisevic wrote: You have to add files to git with: git add . This will add all new files. Command git commit -a -m '' with add only already tracked and changed files and commit them with given message. On Apr 8, 9:02�am, P�l Bergstr�m rails-mailing-l...@andreas-s.net 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] problem in understanding respond_to in rails 2.0 and above
Hi, I am using rails 2.2. I have created a controller using ruby script/generate scaffold person. This created the code like this. def index @people = Person.find(:all) respond_to do |format| format.html format.xml { render :xml = @people.to_xml } end end I am new in rails 2.0 and above. I worked on rails 1.2.3. I an not able to understand what is the use of respond_to do |format| format.html format.xml { render :xml = @people.to_xml } end this code. Can anyone focus for me? Help appreciated. Also there are some code like this respond_to do |format| format.html format.js format.xml { render :xml = @people.to_xml } end Thanks, Tushar -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Error in Mysql Connection
Trejkaz Xx wrote: Hao Zhao wrote: 1. download older MySQL client library, for example one from InstantRails: http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll 2. copy the downloaded file to C:\Ruby\bin (or wherever you installed Ruby) 3. restart MySQL server I did steps 1 and 2 (I don't run the server on localhost so step 3 appears to be pointless for me.) I then got an error like: Access Denied: C:/Ruby/bin/.../mysql.so Turns out when the mysql gem installed, it didn't set mysql.so to be executable. I went into Explorer and manually turned it on, and it started to work. Explorer was showing the read permission but not the execute permission. Goes to show that this flag does take effect in Windows after all. :rollseyes: I'm just documenting this in case someone else finds their way here and has the same issue. TX Actually, after your prompt to drop the lib in the %RUBY_HOME%\bin I tried the one that is in the %MYSQL_HOME%\bin i.e. not the one downloaded from InstantRails and it now works (well it seems to, no probs yet). So this clearly indicates that Ruby really can't see libmySQL.dll on the path i.e. as installed with MySQL itself (5.1 for me). So for now simply try cp %MYSQL_HOME%\bin\libmySQL.dll %RUBY_HOME%\bin. Cheers -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Conditionally respond with HTTP redirect for xml_http_request
On Apr 8, 8:38 am, Ram yourstruly.vi...@gmail.com wrote: Hi Fred, Thanks for your response. render :update Ive got quite a few Ruby conditions and styling going in the js.erb file im using now to display the contact information. And ive got more possibilities than the 3 ive shown above in the controller. So this might not be the right option for me. Right? I'm not sure this would be a problem - seems like a few calls to page.replace_html 'info', :partial = 'blah' would do it in the other cases. observe_field callback This might work for me. Right now, the only callbacks I have on the observe_field are showing and hiding the spinner. I have never written custom callbacks on Rails JS helpers. Could you help me through this? So im guessing I should be having something like this %= observe_field 'contact_id', :frequency = 0.5, :update = 'info', :before = Element.show('spinner'), :success = handle_contact_request(value);, :url = show_contact_path,:method =:get, :with = 'contact_id' % Nearly. your success callback gets 2 thigns: response and responseJSON. responseJSON contains whatever JSON you put in the X- JSON header of your response. You callback can be as simple as check_for_redirect(json){ if(json json.redirect) page.location = json.redirect } and then pass :success = check_for_redirect(responseJSON). All you need to do is to set that header appropriately if you want a redirect to happen. 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Ultrasphinx::UsageError (Invalid class name Place)
Hi, all .. My application can run normally on development environment ,but when i change it to production, I got the problem below: Ultrasphinx::UsageError (Invalid class name Place): /vendor/plugins/ultrasphinx/lib/ultrasphinx/search/internals.rb:88:in `build _request_with_options' /vendor/plugins/ultrasphinx/lib/ultrasphinx/search/internals.rb:85:in `map' /vendor/plugins/ultrasphinx/lib/ultrasphinx/search/internals.rb:85:in `build _request_with_options' /vendor/plugins/ultrasphinx/lib/ultrasphinx/search.rb:333:in `run' The Ultrasphinx configure , index and daemon:start all seem to have gone. Does anyone have an idea on this ? Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to use Net::SSH
On Wed, Apr 8, 2009 at 12:08 AM, Shripad shripad.josh...@gmail.com wrote: Hi, Thanks Conrad for ur urgent reply What I want to do is just pickup the images from machine A to machine B. I did what you say but I am getting error as follows E:/InstantRails/ruby/lib/ruby/gems/1.8/gems/net-sftp-2.0.2/lib/net/ sftp.rb:43:in `start': undefined method `shutdown!' for nil:NilClass (NoMethodError) from SSHTransfer.rb:8 what I write is this sftp=Net::SFTP.start('132.147.161.159', 'k',:password = 'k') Thanks and Regards On Apr 8, 11:24 am, Conrad Taylor conra...@gmail.com wrote: On Tue, Apr 7, 2009 at 10:27 PM, Shripad shripad.josh...@gmail.com wrote: Hi all, I am having following code in ruby require 'net/ssh' require 'net/sftp' begin Net::SSH.start ('132.147.161.159',:password='k',:port=1234,:username='k') do |ssh| ssh.sftp.connect do |sftp| Dir.foreach('.') do |file| puts file end end end rescue Exception= Ex puts Ex.message end After executing the above code it is giving me following error Bad file descriptor - connect(2) username, password, and ipaddress are fine What I want is to take data from remote machine to server. Please Help me out. Thanks and Regards, Shri What are you wanting to do? SFTP or SSH? From the code, it appears that you're trying to move a file from point A to B. Thus, here's a brief outline of the things that you can do with SFTP: require 'net/sftp' Net::SFTP.start('host', 'username', :password = 'password') do |sftp| # upload a file or directory to the remote host sftp.upload!(/path/to/local, /path/to/remote) # download a file or directory from the remote host sftp.download!(/path/to/remote, /path/to/local) # grab data off the remote host directly to a buffer data = sftp.download!(/path/to/remote) # open and write to a pseudo-IO for a remote file sftp.file.open(/path/to/remote, w) do |f| f.puts Hello, world!\n end # open and read from a pseudo-IO for a remote file sftp.file.open(/path/to/remote, r) do |f| puts f.gets end # create a directory sftp.mkdir! /path/to/directory # list the entries in a directory sftp.dir.foreach(/path/to/directory) do |entry| puts entry.longname end end Good luck, -Conrad Can you upgrade the gem and retrying what you did before? You can upgrade by doing the following: sudo gem update -Conrad --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Ultrasphinx::UsageError (Invalid class name Place)
Hi, all .. My application can run normally on development environment ,but when i change it to production, I got the problem below: Ultrasphinx::UsageError (Invalid class name Place): /vendor/plugins/ultrasphinx/lib/ultrasphinx/search/internals.rb:88:in `build _request_with_options' /vendor/plugins/ultrasphinx/lib/ultrasphinx/search/internals.rb:85:in `map' /vendor/plugins/ultrasphinx/lib/ultrasphinx/search/internals.rb:85:in `build _request_with_options' /vendor/plugins/ultrasphinx/lib/ultrasphinx/search.rb:333:in `run' The Ultrasphinx configure , index and daemon:start all seem to have gone. Does anyone have an idea on this ? Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to use Net::SSH
Hi, I updated the gem. but still it is showing me the same error. I am using windows, is that a problem for SFTP? IS OpenSSH require for SFTP to connect to remote machine? Is there any other way to do this? Thanks and Regards, Shripad On Apr 8, 12:58 pm, Conrad Taylor conra...@gmail.com wrote: On Wed, Apr 8, 2009 at 12:08 AM, Shripad shripad.josh...@gmail.com wrote: Hi, Thanks Conrad for ur urgent reply What I want to do is just pickup the images from machine A to machine B. I did what you say but I am getting error as follows E:/InstantRails/ruby/lib/ruby/gems/1.8/gems/net-sftp-2.0.2/lib/net/ sftp.rb:43:in `start': undefined method `shutdown!' for nil:NilClass (NoMethodError) from SSHTransfer.rb:8 what I write is this sftp=Net::SFTP.start('132.147.161.159', 'k',:password = 'k') Thanks and Regards On Apr 8, 11:24 am, Conrad Taylor conra...@gmail.com wrote: On Tue, Apr 7, 2009 at 10:27 PM, Shripad shripad.josh...@gmail.com wrote: Hi all, I am having following code in ruby require 'net/ssh' require 'net/sftp' begin Net::SSH.start ('132.147.161.159',:password='k',:port=1234,:username='k') do |ssh| ssh.sftp.connect do |sftp| Dir.foreach('.') do |file| puts file end end end rescue Exception= Ex puts Ex.message end After executing the above code it is giving me following error Bad file descriptor - connect(2) username, password, and ipaddress are fine What I want is to take data from remote machine to server. Please Help me out. Thanks and Regards, Shri What are you wanting to do? SFTP or SSH? From the code, it appears that you're trying to move a file from point A to B. Thus, here's a brief outline of the things that you can do with SFTP: require 'net/sftp' Net::SFTP.start('host', 'username', :password = 'password') do |sftp| # upload a file or directory to the remote host sftp.upload!(/path/to/local, /path/to/remote) # download a file or directory from the remote host sftp.download!(/path/to/remote, /path/to/local) # grab data off the remote host directly to a buffer data = sftp.download!(/path/to/remote) # open and write to a pseudo-IO for a remote file sftp.file.open(/path/to/remote, w) do |f| f.puts Hello, world!\n end # open and read from a pseudo-IO for a remote file sftp.file.open(/path/to/remote, r) do |f| puts f.gets end # create a directory sftp.mkdir! /path/to/directory # list the entries in a directory sftp.dir.foreach(/path/to/directory) do |entry| puts entry.longname end end Good luck, -Conrad Can you upgrade the gem and retrying what you did before? You can upgrade by doing the following: sudo gem update -Conrad --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Conditionally respond with HTTP redirect for xml_http_request
:) You were right. It was easy enough to use render :update and replace_html with :partial to accomplish it. I am however curious as to how we can do this using JSON. I started reading about JSON for another feature I needed but I realised I dint need JSON for it. I feel it would be a good exercise for me to implement it in tackling this problem. Could you explain a little bit more about the code you have shown me above or point me to where I can find the documentation explaining this? From what I remember, JSON is a format (Object Notation) to represent ActiveRecord objects (in Rails) for JS to handle. But setting the header, responseJSON et all is new to me. Thanks Fred! On Apr 8, 12:57 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Apr 8, 8:38 am, Ram yourstruly.vi...@gmail.com wrote: Hi Fred, Thanks for your response. render :update Ive got quite a few Ruby conditions and styling going in the js.erb file im using now to display the contact information. And ive got more possibilities than the 3 ive shown above in the controller. So this might not be the right option for me. Right? I'm not sure this would be a problem - seems like a few calls to page.replace_html 'info', :partial = 'blah' would do it in the other cases. observe_field callback This might work for me. Right now, the only callbacks I have on the observe_field are showing and hiding the spinner. I have never written custom callbacks on Rails JS helpers. Could you help me through this? So im guessing I should be having something like this %= observe_field 'contact_id', :frequency = 0.5, :update = 'info', :before = Element.show('spinner'), :success = handle_contact_request(value);, :url = show_contact_path,:method =:get, :with = 'contact_id' % Nearly. your success callback gets 2 thigns: response and responseJSON. responseJSON contains whatever JSON you put in the X- JSON header of your response. You callback can be as simple as check_for_redirect(json){ if(json json.redirect) page.location = json.redirect } and then pass :success = check_for_redirect(responseJSON). All you need to do is to set that header appropriately if you want a redirect to happen. 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Conditionally respond with HTTP redirect for xml_http_request
I am trying to implement Craig Ambrose's Redbox for some form submissions. Ideally for me, when the user selects Add contact a redbox modal window should open with the New Contact form and on submission, the contacts select box on the main page should get updated with the newly added contact. I was looking into invoking Redbox from the controller for this (http://ahref.in/8dc58) but I couldnt quite grasp the discussion there. Can Redbox be brought in here without too much trouble? thanks again for you inputs! On Apr 8, 1:46 pm, Ram yourstruly.vi...@gmail.com wrote: :) You were right. It was easy enough to use render :update and replace_html with :partial to accomplish it. I am however curious as to how we can do this using JSON. I started reading about JSON for another feature I needed but I realised I dint need JSON for it. I feel it would be a good exercise for me to implement it in tackling this problem. Could you explain a little bit more about the code you have shown me above or point me to where I can find the documentation explaining this? From what I remember, JSON is a format (Object Notation) to represent ActiveRecord objects (in Rails) for JS to handle. But setting the header, responseJSON et all is new to me. Thanks Fred! On Apr 8, 12:57 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Apr 8, 8:38 am, Ram yourstruly.vi...@gmail.com wrote: Hi Fred, Thanks for your response. render :update Ive got quite a few Ruby conditions and styling going in the js.erb file im using now to display the contact information. And ive got more possibilities than the 3 ive shown above in the controller. So this might not be the right option for me. Right? I'm not sure this would be a problem - seems like a few calls to page.replace_html 'info', :partial = 'blah' would do it in the other cases. observe_field callback This might work for me. Right now, the only callbacks I have on the observe_field are showing and hiding the spinner. I have never written custom callbacks on Rails JS helpers. Could you help me through this? So im guessing I should be having something like this %= observe_field 'contact_id', :frequency = 0.5, :update = 'info', :before = Element.show('spinner'), :success = handle_contact_request(value);, :url = show_contact_path,:method =:get, :with = 'contact_id' % Nearly. your success callback gets 2 thigns: response and responseJSON. responseJSON contains whatever JSON you put in the X- JSON header of your response. You callback can be as simple as check_for_redirect(json){ if(json json.redirect) page.location = json.redirect } and then pass :success = check_for_redirect(responseJSON). All you need to do is to set that header appropriately if you want a redirect to happen. 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: AR.find :include is adding stuff I don't want
On Apr 8, 9:52 am, Greg Willits rails-mailing-l...@andreas-s.net wrote: Frederick Cheung wrote: On Apr 8, 5:35 am, Greg Willits rails-mailing-l...@andreas-s.net wrote: So, I dunno. But shouldn't that second finder case (without :include) not be returning :assets nor :extras? I end up using debug() to output the results to confirm what is actually being loaded, and I get those two associations, but no :pages data. Seems weird. Random question: are you doing this from the console or is this output from an app. Are you sure the load is coming from the find and not from the association been accessed subsequently (eg put a log statement after the find(..., :include) ? ) Fred -- gw -- 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Restful design is a headache?
Hi, So i really, really want to do restful rails. I've got the Peepcode screencast, read the tutorials, etc. BUT - I still don't get it. The problem is, tutorials only cover the basic stuff, and none of the application design elements. For example, I have a shop. The shop has products. The products can only be edited by an admin. So I scaffold products, and password protect the lot, that's my admin area done. Now I create a shop and I want to 'view' products. Oh wait, that's in products already, and that's not one of the 'restful 7'. I'm completely confused. What about resetting a password? Do I have to create a new reset_password resource? Any pointer would be much, much appreciated. Thank you! -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: AR.find :include is adding stuff I don't want
Frederick Cheung wrote: On Apr 8, 9:52�am, Greg Willits rails-mailing-l...@andreas-s.net wrote: Frederick Cheung wrote: On Apr 8, 5:35 am, Greg Willits rails-mailing-l...@andreas-s.net wrote: So, I dunno. But shouldn't that second finder case (without :include) not be returning :assets nor :extras? I end up using debug() to output the results to confirm what is actually being loaded, and I get those two associations, but no :pages data. Seems weird. Random question: are you doing this from the console or is this output from an app. Are you sure the load is coming from the find and not from the association been accessed subsequently (eg put a log statement after the find(..., :include) ? ) @#$#! After writing a big long thing to prove there was no other action taking place, and taking one more wider look before sending it to be sure I wasn't making an idiot of myself, I just scrolled down a little further in the model to re-discover an after_find I wrote which would in fact touch assets extras. I had just so compartmentalized the :include thing in my mind, I wasn't remembering after_find. Egads. So sorry to waste your time Fred. But proving there was no log statement question pushed me to at least solve the (not so puzzling) puzzle. Thanks. -- gw -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: export to excel
Hi thanks for the reply . I saw http://spreadsheet.rubyforge.org/ What about this? Have you used it? Sijo -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Export to PDF
Hi Alain I tried prawn for pdf creation. 1. gem install prawn 2. script/plugin install git://github.com/thorny-sun/prawnto.git 2. In environment.rb file add the line config.gem 'prawn' 3. i wrote in the following code in show.pdf.prawn it's located in(/app/view/orders/show.pdf.prawn) pdf.text Hello, World! 4. In my controller is def show end 5. http://localhost:3001/orders/show 6. In this aspect where to give the file name? How to create simple pdf file using prawn library i followed this url but can create the simple file this format def show Prawn::Document.generate hello-ttf.pdf do fill_color ff text Hello World, :at = [200,720], :size = 32 text This is chalkboard wrapping * 20 end end Regards R.Devi -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: AR.find :include is adding stuff I don't want
Frederick Cheung wrote: On Apr 8, 5:35�am, Greg Willits rails-mailing-l...@andreas-s.net wrote: When I use the code above, I get data from Article (good), Extras (good), and Assets (bad), and nothing from Pages (curious). I don't understand why Assets is being included, and I don't know how to keep that data out of the results. Odd. Maybe you could show the sql it is executing ? Hmm. now I am seeing something different. With this code (more verbatim this time)... class Article ActiveRecord::Base self.primary_key = 'rcrd_id' has_many :extras, :dependent = :destroy has_many :pages, :order = 'sortOrder', :dependent = :destroy has_many :assets, :dependent = :destroy def self.get_list list = self.find(:all, :include = [:extras], :conditions = [ #{self.table_name}.rcrd_status='Y' AND ready='Y' AND publishDate = :today, {:today = Date.today.to_s} ]) end end Or with this code.. def self.get_list list = self.find(:all, :conditions = [ #{self.table_name}.rcrd_status='Y' AND ready='Y' AND publishDate = :today, {:today = Date.today.to_s} ]) end I now see these same queries in the log. (and this is restarting Rails after each time I change the code, just to be sure) [4;36;1mArticle Load (1.6ms) [0m[0;1mSELECT * FROM `articles` WHERE (articles.rcrd_status='Y' AND ready='Y' AND publishDate = '2009-04-08') [0m [4;35;1mAsset Load (0.8ms) [0m[0mSELECT * FROM `assets` WHERE (`assets`.article_id = 'abc123') [0m [4;36;1mExtra Load (1.1ms) [0m[0;1mSELECT * FROM `extras` WHERE (`extras`.article_id = 'abc123') [0m I know it was different before, I even showed someone to confirm it. I don't see anything odd about the other models, they both have a simple belongs_to articles statement, and nothing else. Pages has a belongs_to articles, and a has_many to another model. Maybe that keeps pages from being loaded? So, I dunno. But shouldn't that second finder case (without :include) not be returning :assets nor :extras? I end up using debug() to output the results to confirm what is actually being loaded, and I get those two associations, but no :pages data. Seems weird. -- gw -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to use Net::SSH
On Wed, Apr 8, 2009 at 1:09 AM, Shripad shripad.josh...@gmail.com wrote: Hi, I updated the gem. but still it is showing me the same error. I am using windows, is that a problem for SFTP? IS OpenSSH require for SFTP to connect to remote machine? Is there any other way to do this? Thanks and Regards, Shripad Shripad, I'm not sure of the state of Capistrano on Windows. I'm sure that you'll need the OpenSSH library installed on your system. Thus, it may be easier to install Cygwin and install OpenSSH from there. Otherwise, you can switch to Linux or Mac OS X or other Unix variant. Good luck, -Conrad On Apr 8, 12:58 pm, Conrad Taylor conra...@gmail.com wrote: On Wed, Apr 8, 2009 at 12:08 AM, Shripad shripad.josh...@gmail.com wrote: Hi, Thanks Conrad for ur urgent reply What I want to do is just pickup the images from machine A to machine B. I did what you say but I am getting error as follows E:/InstantRails/ruby/lib/ruby/gems/1.8/gems/net-sftp-2.0.2/lib/net/ sftp.rb:43:in `start': undefined method `shutdown!' for nil:NilClass (NoMethodError) from SSHTransfer.rb:8 what I write is this sftp=Net::SFTP.start('132.147.161.159', 'k',:password = 'k') Thanks and Regards On Apr 8, 11:24 am, Conrad Taylor conra...@gmail.com wrote: On Tue, Apr 7, 2009 at 10:27 PM, Shripad shripad.josh...@gmail.com wrote: Hi all, I am having following code in ruby require 'net/ssh' require 'net/sftp' begin Net::SSH.start ('132.147.161.159',:password='k',:port=1234,:username='k') do |ssh| ssh.sftp.connect do |sftp| Dir.foreach('.') do |file| puts file end end end rescue Exception= Ex puts Ex.message end After executing the above code it is giving me following error Bad file descriptor - connect(2) username, password, and ipaddress are fine What I want is to take data from remote machine to server. Please Help me out. Thanks and Regards, Shri What are you wanting to do? SFTP or SSH? From the code, it appears that you're trying to move a file from point A to B. Thus, here's a brief outline of the things that you can do with SFTP: require 'net/sftp' Net::SFTP.start('host', 'username', :password = 'password') do |sftp| # upload a file or directory to the remote host sftp.upload!(/path/to/local, /path/to/remote) # download a file or directory from the remote host sftp.download!(/path/to/remote, /path/to/local) # grab data off the remote host directly to a buffer data = sftp.download!(/path/to/remote) # open and write to a pseudo-IO for a remote file sftp.file.open(/path/to/remote, w) do |f| f.puts Hello, world!\n end # open and read from a pseudo-IO for a remote file sftp.file.open(/path/to/remote, r) do |f| puts f.gets end # create a directory sftp.mkdir! /path/to/directory # list the entries in a directory sftp.dir.foreach(/path/to/directory) do |entry| puts entry.longname end end Good luck, -Conrad Can you upgrade the gem and retrying what you did before? You can upgrade by doing the following: sudo gem update -Conrad --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: export to excel
try for the spreadsheet-excel gem .you can google for spreadsheet-excel gem.You will get the sample code for it.if you dont get it just mail me i will provide you the sample code On Wed, Apr 8, 2009 at 2:57 PM, Daniel Bush dlb.id...@gmail.com wrote: 2009/4/8 Sijo Kg rails-mailing-l...@andreas-s.net Hi I have some data to be exported as well as imported to/from my rails application to Excel.Could anybody please point me some good advise on how to do this..Also expect some good links on the same Thanks in advance Sijo -- Posted via http://www.ruby-forum.com/. The exporting bit came up on the roro list recently. See the last post in the thread. I've just been using csv format and fastercsv myself with some visual basic to help the end user. Often wondered about the xml format of excel as well... http://groups.google.com/group/rails-oceania/browse_thread/thread/9de19f779a944d2a/50438843fd8d4993?hl=en -- Daniel Bush http://blog.web17.com.au http://github.com/danielbush/sifs/tree/master http://github.com/danielbush --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Ruby Developer role - upto £60k - web 2.0 gr eenfield - London, UK
Our exciting new Web 2.0 venture requires 2 strong Ruby-on-Rails gurus who can bring their expertise to our growing team. Main skills required: . Ruby on Rails . MYSQL (or equivalent) . JavaScript using Prototype/Scriptaculous . HTML/CSS . Linux/Unix . Subversion . Pref TDD and/or BDD, Agile, Web 2.0 experience, Coldfusion or PHP We will provide you with an excellent financial package, free quality coffee, state of the art chairs(!), XBox360, Wii, LCD TV's, Rock Band Guitar Hero, Mario Kart, football table, and so on! Salary is upto £60k depending on how great you are at Ruby. Interviews will take place ASAP, so what are you waiting for? Send your CV in the first instance to simo...@psr-rec.com or call me on 0789 170 8160. Thanks! Simon Johnston Director PSR Ltd - A leading provider of IT Professionals Talent Management Solutions a 30 St Georges Road I Wimbledon I London I SW19 4BD t 0870 013 6380 f 0870 013 6381 m +44 (0)789 170 8160 e simo...@psr- rec.com http://www.linkedin.com/in/simonjohnston This e-mail (which includes any files transmitted with it) is intended for the above named only. It may contain privileged, confidential and/ or price sensitive information. If you are not the intended recipient please notify the sender immediately and confirm that all copies have been destroyed and it has been deleted from your computer system. This e-mail is protected by copyright. Unless you are the intended recipient you should not use, disclose or copy the e-mail nor should you rely upon it in any way whatsoever. All liability for viruses is excluded to the fullest extent permitted by law. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of PSR Recruitment Ltd. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Multi Model Forms and Validations
Just wanted to say that someone helped me with the solution here: http://railsforum.com/viewtopic.php?id=29103 Apparently, it's as simple as: def valid_or_nil?( model ) model.nil? ? true : model.valid? end if @person.valid? valid_or_nil?(@cat) valid_or_nil?(@dog) Person.transaction do @person.save! @cat.save! unless @cat.nil? @dog.save! unless @dog.nil? end else FAIL end On Apr 8, 1:17 am, sshefer shai.she...@gmail.com wrote: Sure. My scenario is a bit different. I have an application form that needs to be filled in by a user. If the user is not registered on my site I have a few fields that allow the user to quickly enter name and email and their account will be created when the application is submitted. At the same time, the application allows a user to pick from a list of documents they've uploaded. However, I also have fields incase a user would like to upload a document that is not on the list (to save them the hassle of going back, uploading and returning to the application). Therefore, my application will always have a new @application and sometimes a new @user or @document. The document model is polymorphic. The application belongs_to the user and has a field for document_id but I did not create an explicit relationship in the model. Thanks for any help. On Apr 8, 1:03 am, Ram yourstruly.vi...@gmail.com wrote: Hmmm.. Are Cat and Dog associated to the Person model? there may not always be a @cat or @dog Meaning the parameters for these models will be passed in from the form but they will be empty? In which case you can have a before_validation callback and check if all the params for these models are blank. If they are, then return false. This will still throw a Cat/Dog is invalid validation error. That can be handled by hacking into error_messages_for. Its all quite ugly but it works. I can tell you more if you can explain the context better. On Apr 7, 2:26 pm, sshefer shai.she...@gmail.com wrote: Jim Neath's walkthru (http://jimneath.org/2008/09/06/multi-model-forms- validations-in-ruby-on-rails/) talks about validating multiple objects before saving. His example is below: if @person.valid? @cat.valid? @dog.valid? Person.transaction do @person.save! @cat.save! @dog.save! end else FAIL end I am trying to do something similar but in my situation there may not always be a @cat or @dog (there will always be a @person though). Does anyone know of a way that I can run the same validation but allow for the conditional presence of the 2 objects? 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Problem with MYSQL after re-installing rails
VICTORY! Installed an earlier version of MYSQL (5.0.37) and it all seems to be working fine now Thanks for your help fred On Apr 8, 9:59 am, Gavin ga...@thinkersplayground.com wrote: Yea - 32 bit version I tried installing the mysql gem with sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/ mysql_config and it worked! - kind of Now when I run gem list it appears.. actionmailer (2.3.2, 2.1.0) actionpack (2.3.2, 2.1.0) activerecord (2.3.2, 2.1.0) activerecord-jdbc-adapter (0.9.1) activerecord-jdbcmysql-adapter (0.9.1) activeresource (2.3.2, 2.1.0) activesupport (2.3.2, 2.1.0) arrayfields (4.7.2) builder (2.1.2) capistrano (2.5.5) cgi_multipart_eof_fix (2.5.0) chronic (0.2.3) cucumber (0.2.3) daemons (1.0.10) diff-lcs (1.1.2) fastthread (1.0.6) fattr (1.0.3) fixrbconfig (1.2) gem_plugin (0.2.3) highline (1.5.0) hoe (1.12.1) hpricot (0.8.1) jdbc-mysql (5.0.4) main (2.8.3) mocha (0.9.5) mongrel (1.1.5) mysql (2.7) net-scp (1.0.2) net-sftp (2.0.2) net-ssh (2.0.11) net-ssh-gateway (1.0.1) nifty-generators (0.2.3) nokogiri (1.2.3) orderedhash (0.0.6) packet (0.1.15) polyglot (0.2.5) rack (0.9.1) rails (2.3.2, 2.1.0) rake (0.8.4) redgreen (1.2.2) rspec (1.2.2) rspec-rails (1.2.2) rubyforge (1.0.3) rubygems-update (1.3.1) sources (0.0.1) sqlite3-ruby (1.2.4) systemu (1.2.0) term-ansicolor (1.0.3) treetop (1.2.5) webrat (0.4.3) ZenTest (4.0.0) However, when I try to run rake db:migrate or make a db query I get this error: !!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql. rake aborted! dlsym(0x103290, Init_mysql): symbol not found - /usr/local/lib/ruby/ gems/1.8/gems/mysql-2.7/lib/mysql.bundle Any ideas guys? On Apr 8, 8:13 am, Frederick Cheung frederick.che...@gmail.com wrote: On Apr 8, 12:25 am, Gavin ga...@thinkersplayground.com wrote: Hmmm - have downloaded and re-installed MYSQL 5.1.33 but did you get the 32bit version ? (and have you tried using --with- mysql-config=/path/to/mysql_config ?) Fred Still getting the same issue. In pref pane it shows that mysql is running. Can anybody think of anything else I can check/do? Really need to get my database back up and running soon :S Thanks On Apr 7, 8:31 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Apr 7, 7:36 pm, Dean Richardson rails-mailing-l...@andreas-s.net wrote: Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.7 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.7/gem_make.out Any suggestions for diagnosing my mistake here? That sounds like a different issue ( in Gavin's case it just the headers/libs for mysql it can't locate) - maybe you don't have all of the stuff from the Dev tools you need ? Fred Thanks! Dean Richardson -- 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: export to excel
2009/4/8 Sijo Kg rails-mailing-l...@andreas-s.net Hi I have some data to be exported as well as imported to/from my rails application to Excel.Could anybody please point me some good advise on how to do this..Also expect some good links on the same Thanks in advance Sijo -- Posted via http://www.ruby-forum.com/. The exporting bit came up on the roro list recently. See the last post in the thread. I've just been using csv format and fastercsv myself with some visual basic to help the end user. Often wondered about the xml format of excel as well... http://groups.google.com/group/rails-oceania/browse_thread/thread/9de19f779a944d2a/50438843fd8d4993?hl=en -- Daniel Bush http://blog.web17.com.au http://github.com/danielbush/sifs/tree/master http://github.com/danielbush --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to pass data to Javascript variable from Ruby on Ra
Chris Kottom wrote: The most straightforward way of doing what you want is: %= my_var % On Wed, Apr 8, 2009 at 7:31 AM, SpringFlowers AutumnMoon are you sure? if my_var contains a newline character, then the Javascript code becomes var title = hello world; and it will break? sorry i haven't used RoR for a long time so don't know if any quote is given for %= my_var % -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: AR.find :include is adding stuff I don't want
On 8 Apr 2009, at 10:44, Greg Willits wrote: @#$#! After writing a big long thing to prove there was no other action taking place, and taking one more wider look before sending it to be sure I wasn't making an idiot of myself, I just scrolled down a little further in the model to re-discover an after_find I wrote which would in fact touch assets extras. I had just so compartmentalized the :include thing in my mind, I wasn't remembering after_find. Egads. So sorry to waste your time Fred. But proving there was no log statement question pushed me to at least solve the (not so puzzling) puzzle. Thanks. D'oh! Happens to all of us :-) Fred -- gw -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] [ActiveRecord] strange issue, would like to understand before I wake up...
running 2.3.2 simple case (db table created : 'emails' with a :type field) I have the following Email model class Email ActiveRecord::Base end class RequestEmail Email end TESTING in the console : script/console Loading development environment (Rails 2.3.2) Email.new = #Email id: nil, sender_email: nil, subject: nil, content: nil, user_id: nil, created_at: nil, updated_at: nil, title: mr, firstname: , lastname: Anonymous, type: nil(Note : type is nil, not Email ... ?) RequestEmail.new = #RequestEmail id: nil, sender_email: nil, subject: nil, content: nil, user_id: nil, created_at: nil, updated_at: nil, title: mr, firstname: , lastname: Anonymous, type: RequestEmail exit now TESTING again.. script/console Loading development environment (Rails 2.3.2) RequestEmail.new NameError: uninitialized constant RequestEmail ...const_missing I'll appreciate some feedback , should I buy a 2nd glass ? LOL 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Testing RJS
David wrote: I have some questions about testing RJS. First of all, just generally, how important is testing RJS? It seems, that for effects at least, if I can see that the effect is working, then that is good enough for me? In View testing in general, there are some overlapping rules of thumb: - do test what you don't want to break - don't test glitz (colors, shiny things, animated GIFs, etc.) - do test that your business-side variables got embedded correctly - do test navigation (such as links and redirect_to) The goal is if you add new features and make a mistake the code will break as early as possible. But if you break glitz, you can easily see it's broke, and you can easily fix it without affecting your new features. I would like to test certain RJS redirect_to's however. I came across the ARTS plugin. Has anyone had any experience using this with rails 2.2 or 2.3? Yes; just install the plugin. After you start using assert_rjs, look up my assert_rjs_. It's nearly a drop-in replacement for the most common RJS situations, but it's much more powerful and accurate. http://groups.google.com/group/rubyonrails-talk/msg/c2fba12dd5e2735a It does not test redirect_to, but if it did then it would not be much more powerful than assert_rjs Classic, so use that for now. I saw somewhere that it was included in 2.2, but when I try: assert_rjs :redirect_to, :action = 'show' I get an unknown method error. The documentation for the ARTS will tell you how to install a plugin. Something to do with script/plugin install... assert_rjs_ is a gem, not a plugin, because test-side things don't need to deploy to your server. Use assert_rjs_ when you start working with replace_html. -- Phlip --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Restful design is a headache?
view one = show, view many = index, whether its the admin viewing products, or a user viewing products, there's just one HTTP verb and url pattern in use... /products/ as a GET request. If it were /products/ as a POST request, it better be accompanied by sufficient parameters to define the new product resource, since that's a RESTful create request pattern. The basis of REST is the four HTTP 'verbs' GET, PUT, POST, DELETE. Rails scaffolding builds REST out with 'standard' methods of: index, show, new, edit, create, update, destroy which pair a url pattern with one of the four HTTP request types index: /plural_resource_name/ + GET - return a collection of the desired resource create: /plural_resource_name/ + POST - create a new instance of the resource new: /plural_resource_name/new + GET - return a new instance of the resource show: /plural_resource_name/id + GET - return a single instance of the resource update: /plural_resource_name/id + PUT - update a single instance of the resource destroy: /plural_resource_name/id + DELETE - destroy a single instance of the resource -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Finding record between 2 dates
I am very new to ruby on rails programming, I am using the oracle as my database, In my project there r 2 text box fields and in first and second text boxes i want the date field to be enter by the client and want to display the record between those 2 dates how can i do the same, plz be more specific Thanks in advance, Vaibhavi... Not so good not so bad -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: update page with results as they are scraped
On Apr 8, 12:10 pm, Adam Akhtar rails-mailing-l...@andreas-s.net wrote: ive found that this pattern is called multi stage download. Its used by kayak.com which is famous for its user interface. That site makes finding cheap flights actually enjoyable. Here are some general background links i found this discusses the pattern in general http://ajaxpatterns.org/Multi-Stage_Download#Code_Example and this is a review of the user interface for kayak http://konigi.com/podcast/kayak-com But i still dont know where to start looking for a rails implementation how to. Where should i start looking (ive googled for ages, cant find anything appropriate) Given that this is all client side, what would a rails implementation be (maybe the odd helper function but the lack of them certainly shouldn't stop you getting started). As far as your particular case goes all you need is something on the page that every however often pings your controller to say 'do you have any more data for me'. It would be wise to push the actual scraping into a separate process 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: update page with results as they are scraped
ive found that this pattern is called multi stage download. Its used by kayak.com which is famous for its user interface. That site makes finding cheap flights actually enjoyable. Here are some general background links i found this discusses the pattern in general http://ajaxpatterns.org/Multi-Stage_Download#Code_Example and this is a review of the user interface for kayak http://konigi.com/podcast/kayak-com But i still dont know where to start looking for a rails implementation how to. Where should i start looking (ive googled for ages, cant find anything appropriate) -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Rails 2.3 Upgrade Issue with MemCache
Steve, Try throwing require 'memcache' in your environment.rb? I think that is how I finally got around it... Thanks, Tom On Apr 7, 11:19 pm, Steve Odom steve.o...@gmail.com wrote: I'm having the same issue as Tom, but I'm not using Starling. I'm using spawn. I don't have anything in an initializer to wrap in a after_initialize. Any ideas how to get workling to work in 2.3? Steve On Apr 7, 7:14 pm, Freddy Andersen fre...@cfandersen.com wrote: I'm not sure why this happens, BUT in rails 2.3.2 you have to wrap your Workling loader a after_init like so: config.after_initialize do Workling::Remote.dispatcher = Workling::Remote::Runners::StarlingRunner.new end On Mar 20, 6:42 am, TomRossi7 t...@themolehill.com wrote: One of the plugins I use is Workling. It throws the following error when I try to run it under 2.3: /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/ dependencies.rb:443:in `load_missing_constant': uninitialized constantMemCache(NameError) The offending line is: @@memcache_client_class ||= ::MemCache I don't know a lot aboutmemcache, so I'm not sure what changed with 2.3 that could cause the error. Anyone have some ideas? Thanks! Tom --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Problem with MYSQL after re-installing rails
Yea - 32 bit version I tried installing the mysql gem with sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/ mysql_config and it worked! - kind of Now when I run gem list it appears.. actionmailer (2.3.2, 2.1.0) actionpack (2.3.2, 2.1.0) activerecord (2.3.2, 2.1.0) activerecord-jdbc-adapter (0.9.1) activerecord-jdbcmysql-adapter (0.9.1) activeresource (2.3.2, 2.1.0) activesupport (2.3.2, 2.1.0) arrayfields (4.7.2) builder (2.1.2) capistrano (2.5.5) cgi_multipart_eof_fix (2.5.0) chronic (0.2.3) cucumber (0.2.3) daemons (1.0.10) diff-lcs (1.1.2) fastthread (1.0.6) fattr (1.0.3) fixrbconfig (1.2) gem_plugin (0.2.3) highline (1.5.0) hoe (1.12.1) hpricot (0.8.1) jdbc-mysql (5.0.4) main (2.8.3) mocha (0.9.5) mongrel (1.1.5) mysql (2.7) net-scp (1.0.2) net-sftp (2.0.2) net-ssh (2.0.11) net-ssh-gateway (1.0.1) nifty-generators (0.2.3) nokogiri (1.2.3) orderedhash (0.0.6) packet (0.1.15) polyglot (0.2.5) rack (0.9.1) rails (2.3.2, 2.1.0) rake (0.8.4) redgreen (1.2.2) rspec (1.2.2) rspec-rails (1.2.2) rubyforge (1.0.3) rubygems-update (1.3.1) sources (0.0.1) sqlite3-ruby (1.2.4) systemu (1.2.0) term-ansicolor (1.0.3) treetop (1.2.5) webrat (0.4.3) ZenTest (4.0.0) However, when I try to run rake db:migrate or make a db query I get this error: !!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql. rake aborted! dlsym(0x103290, Init_mysql): symbol not found - /usr/local/lib/ruby/ gems/1.8/gems/mysql-2.7/lib/mysql.bundle Any ideas guys? On Apr 8, 8:13 am, Frederick Cheung frederick.che...@gmail.com wrote: On Apr 8, 12:25 am, Gavin ga...@thinkersplayground.com wrote: Hmmm - have downloaded and re-installed MYSQL 5.1.33 but did you get the 32bit version ? (and have you tried using --with- mysql-config=/path/to/mysql_config ?) Fred Still getting the same issue. In pref pane it shows that mysql is running. Can anybody think of anything else I can check/do? Really need to get my database back up and running soon :S Thanks On Apr 7, 8:31 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Apr 7, 7:36 pm, Dean Richardson rails-mailing-l...@andreas-s.net wrote: Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.7 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.7/gem_make.out Any suggestions for diagnosing my mistake here? That sounds like a different issue ( in Gavin's case it just the headers/libs for mysql it can't locate) - maybe you don't have all of the stuff from the Dev tools you need ? Fred Thanks! Dean Richardson -- 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] job oppurtunity for Ruby on Rails developers
Hi there, I have job oppurtunities for ruby on rails developers, with one of my client based in London. if you are interested then Email your resume to: t...@leapfrogcareers.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Rename file name with file_column plugin
Hi All Is there any way to rename file name during uploaded by file_column plugin -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: strange issue, would like to understand before I wake up...
found a trcik , but I don't understand why In my ApplicationController require_dependency 'email' On 8 avr, 14:11, Erwin yves_duf...@mac.com wrote: running 2.3.2 simple case (db table created : 'emails' with a :type field) I have the following Email model class Email ActiveRecord::Base end class RequestEmail Email end TESTING in the console : script/console Loading development environment (Rails 2.3.2) Email.new = #Email id: nil, sender_email: nil, subject: nil, content: nil, user_id: nil, created_at: nil, updated_at: nil, title: mr, firstname: , lastname: Anonymous, type: nil (Note : type is nil, not Email ... ?) RequestEmail.new = #RequestEmail id: nil, sender_email: nil, subject: nil, content: nil, user_id: nil, created_at: nil, updated_at: nil, title: mr, firstname: , lastname: Anonymous, type: RequestEmail exit now TESTING again.. script/console Loading development environment (Rails 2.3.2) RequestEmail.new NameError: uninitialized constant RequestEmail ...const_missing I'll appreciate some feedback , should I buy a 2nd glass ? LOL 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Testing RJS
I have some questions about testing RJS. First of all, just generally, how important is testing RJS? It seems, that for effects at least, if I can see that the effect is working, then that is good enough for me? I would like to test certain RJS redirect_to's however. I came across the ARTS plugin. Has anyone had any experience using this with rails 2.2 or 2.3? I saw somewhere that it was included in 2.2, but when I try: assert_rjs :redirect_to, :action = 'show' I get an unknown method error. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Testing RJS
On Apr 8, 10:31 am, David dly...@gmail.com wrote: I have some questions about testing RJS. First of all, just generally, how important is testing RJS? It seems, that for effects at least, if I can see that the effect is working, then that is good enough for me? I would like to test certain RJS redirect_to's however. I came across the ARTS plugin. Has anyone had any experience using this with rails 2.2 or 2.3? I saw somewhere that it was included in 2.2, but when I try: I still use arts. I don't think it is quite true to say that 2.2/2.3 (and I think 2.1) replaces arts, although it does have similar functionality via assert_select_rjs (don't remember if that covers redirect_to though) I'd say testing is as important as it is elsewhere (although I would probably worry less about pure eye candy than about stuff that would impact usage (ie this div should be shown and this button enabled)). Fred assert_rjs :redirect_to, :action = 'show' I get an unknown method error. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Localization problem in nested-attributes validation
Hey, I recently run into a problem with the new feature for activerecord: nested attributes. When the nested object (Activist) is invalid, the error messages are shown, but the object name is noch translated. (My project is in german) So I get int the error box: Bitte überprüfen Sie die folgenden Felder: * Activist surename muss ausgefüllt werden * Activist city muss ausgefüllt werden In my appropriate localization file (de.yml) I defined the object/ attributes names correctly. de: activerecord: models: protest_mail: Protestmail activist: Aktivistin attributes: protest_mail: subject: Betreff body: Inhalt activist: surename: Nachname city: Stadt The error messages for protest_mail are transalated correctly, so I guess, the problems applies to the new nested-attributes feature. Any idea how to fix this? best regards, benni --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Help with Redbox Styling and auto-resizing like Lightbox?
Hi all, Redbox I think is by far the easiest to implement in Rails as a light- box/modal pop-up solution. Even more so if you want to avoid using JQuery. It would however be sweeter if it has better styling and that cool auto-resizing thing that lightbox does. I couldnt find anything online that addressed this problem (although I HAVE seen the feature in many sites). So I thought ill start a discussion here.. Some notes.. -Lightbox accomplishes auto-resizing by using the image's size attributes. This however, is not available in the case of forms (which is probably the biggest use-case for something like Redbox in Rails apps). -How can the resizing visual effect be accomplished using Prototype +Scriptaculous? -RB_window is the css id in redbox.css which ive been playing with for repositioning. Thats probably where most of the styling for this should go (?) -Using the original code, the redbox always appears at the top of the viewport/window and widthwise center of it regardless of the scroll position (dont know about others). How does one make it appear at the center of the viewport (heightwise as well as widthwise) no matter the scroll position. Hope this generates enough interest to answer some of these questions. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Help with acts_as_audited
Sounds like you may need to create a model over the associationlike cats_dogs.rb: class CatDog ActiveRecord::Base ... end You'll probably need to extend your habtm table with an auto-increment surrogate key so that acts_as_audited can play well with the primary key Peter Fitzgibbons (847) 687-7646 Email: peter.fitzgibb...@gmail.com IM GTalk: peter.fitzgibbons IM Yahoo: pjfitzgibbons IM MSN: pjfitzgibb...@hotmail.com IM AOL: peter.fitzgibb...@gmail.com On Sun, Feb 22, 2009 at 3:10 PM, Diego Bernardes rails-mailing-l...@andreas-s.net wrote: Hi everyone, Im using the plugin acts_as_audited to audit my whole program, but i have a problem, when the change is in a association table (has and belongs to many) the change isnt captured by the plugin, anyone know any fast hot fix to this? Thanks! -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Ajax Rails
ok - so I changed the code to the below and getting similar results. What I think is happening is that because it is a partial that is being called (in this example 3 times) but the div is static, it is only updating the first one (i.e. div 1). Is there a way to make a dynamic div? New code below... %= link_to_function post.title, Element.toggle('div 1') % div id=div 1 style=display: none; %= post.link % /div On Apr 8, 3:23 am, Frederick Cheung frederick.che...@gmail.com wrote: On Apr 8, 5:45 am, esdevs seanpdev...@gmail.com wrote: ok - I am trying to do something seemingly straight forward. Essentially I want to list out a bunch of items and for each item individually, if the user clicks on it, the corresponding web link will appear underneath -- if the user clicks on the item again, then the weblink disappears. This should work for each item in the list. I have tried but to no avail - below is a vid clip of what is happening as well as the code that I am using -- any help is greatly appreciated Well by the looks of things you have multiple divs with the same id (never a good) idea, you're using link_to_remote but not actually making an ajax call (link_to_function might be more appropriate) and if my memory is correct and you want to select that link, next() selects siblings whereas it looks like you want to select children (which is what down does) Fred http://www.screentoaster.com/watch/stU0…BeQlVeXV5e (partial _post.html.erb) h2%= link_to_remote(#{post.title}, :after = $('link').next (1).toggle()) %/h2 div id=link style=display: none; %= post.link % /div --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Ajax Rails
never mind - figured it out - the issue was in the div (and made them dynamic through below)...works -- thanks! h3%= link_to_function post.title, Element.toggle('#{post.title}') %/h3 div id=%= post.title % style=display: none; %= post.link % /div On Apr 8, 9:01 am, esdevs seanpdev...@gmail.com wrote: ok - so I changed the code to the below and getting similar results. What I think is happening is that because it is a partial that is being called (in this example 3 times) but the div is static, it is only updating the first one (i.e. div 1). Is there a way to make a dynamic div? New code below... %= link_to_function post.title, Element.toggle('div 1') % div id=div 1 style=display: none; %= post.link % /div On Apr 8, 3:23 am, Frederick Cheung frederick.che...@gmail.com wrote: On Apr 8, 5:45 am, esdevs seanpdev...@gmail.com wrote: ok - I am trying to do something seemingly straight forward. Essentially I want to list out a bunch of items and for each item individually, if the user clicks on it, the corresponding web link will appear underneath -- if the user clicks on the item again, then the weblink disappears. This should work for each item in the list. I have tried but to no avail - below is a vid clip of what is happening as well as the code that I am using -- any help is greatly appreciated Well by the looks of things you have multiple divs with the same id (never a good) idea, you're using link_to_remote but not actually making an ajax call (link_to_function might be more appropriate) and if my memory is correct and you want to select that link, next() selects siblings whereas it looks like you want to select children (which is what down does) Fred http://www.screentoaster.com/watch/stU0…BeQlVeXV5e (partial _post.html.erb) h2%= link_to_remote(#{post.title}, :after = $('link').next (1).toggle()) %/h2 div id=link style=display: none; %= post.link % /div --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Alternative to render :update
Jaryl Sim wrote: If that's the case, then you should split it up into multiple requests. I believe that you can only send back one response per request, so that is an inherent problem. Sure that's the case, that's how HTTP protocol works. One response for one request. I think of it as similar to an event loop, where each cycle through the loop processes one event. The difference is that an event loop is continuous, where a request-response cycle sleeps between each cycle. In other words the event loop runs continuously checking an event queue, where as HTTP sleeps until it is sent a request, which causes it to awake and process the request and generate a response. After the response is processes it sleeps again until awoken by another request. Perhaps you may try sending a request once the a valid file is selected in the file upload field. As far as I know, the behavior you're after is going to require some client-side code. I know there are a number of solutions floating around, some taking advantage of Flash (as I assume the swfupload does). Some others I've heard of make use of a Java applet. But, I would imagine this behavior could be built with JavaScript/AJAX. In any case I think the brains of this feature will need to be implemented client-side. The AJAX should be able to send requests to a server-side action responsible to accepting one file, and the client-side code would make one request per file, plus additional request to manipulate the DOM. Please note this is all speculation. I have no proof-of-concept code to offer. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: update page with results as they are scraped
Given that this is all client side, what would a rails implementation be (maybe the odd helper function but the lack of them certainly shouldn't stop you getting started). As far as your particular case goes all you need is something on the page that every however often pings your controller to say 'do you have any more data for me'. It would be wise to push the actual scraping into a separate process Thanks Frederick, cna you (or anybody reading this) provide me with some helper names or subject names that i should be investigating re: pining the controller? is this a common rails thing? thanks so far for your help -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: update page with results as they are scraped
pining the controller? should have read PINGING the controller. sorry -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Ajax Rails
esdevs wrote: never mind - figured it out - the issue was in the div (and made them dynamic through below)...works -- thanks! h3%= link_to_function post.title, Element.toggle('#{post.title}') %/h3 div id=%= post.title % style=display: none; %= post.link % /div Just make sure that %= post.title % is unique for the page. Also note that a cleaner solution (assuming post is an ActiveRecord subclass) is to use div_for since it will automatically generate a unique id for your div representing your post: http://www.railsbrain.com/api/rails-2.3.2/doc/index.html?a=M002465name=div_for -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Rails 2.3 Upgrade Issue with MemCache
Thanks Tom. The crappy part is I'm not using memcache for anything at the moment. Steve On Apr 8, 7:31 am, tomrossi7 t...@themolehill.com wrote: Steve, Try throwing require 'memcache' in your environment.rb? I think that is how I finally got around it... Thanks, Tom On Apr 7, 11:19 pm, Steve Odom steve.o...@gmail.com wrote: I'm having the same issue as Tom, but I'm not using Starling. I'm using spawn. I don't have anything in an initializer to wrap in a after_initialize. Any ideas how to get workling to work in 2.3? Steve On Apr 7, 7:14 pm, Freddy Andersen fre...@cfandersen.com wrote: I'm not sure why this happens, BUT in rails 2.3.2 you have to wrap your Workling loader a after_init like so: config.after_initialize do Workling::Remote.dispatcher = Workling::Remote::Runners::StarlingRunner.new end On Mar 20, 6:42 am, TomRossi7 t...@themolehill.com wrote: One of the plugins I use is Workling. It throws the following error when I try to run it under 2.3: /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/ dependencies.rb:443:in `load_missing_constant': uninitialized constantMemCache(NameError) The offending line is: @@memcache_client_class ||= ::MemCache I don't know a lot aboutmemcache, so I'm not sure what changed with 2.3 that could cause the error. Anyone have some ideas? Thanks! Tom --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Alternative to render :update
Thanks everyone for the replies. For now I'm just going with good 'ol standard HTML response until I figure out what I'm going 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: update page with results as they are scraped
On 8 Apr 2009, at 14:28, Adam Akhtar wrote: Given that this is all client side, what would a rails implementation be (maybe the odd helper function but the lack of them certainly shouldn't stop you getting started). As far as your particular case goes all you need is something on the page that every however often pings your controller to say 'do you have any more data for me'. It would be wise to push the actual scraping into a separate process Thanks Frederick, cna you (or anybody reading this) provide me with some helper names or subject names that i should be investigating re: pining the controller? is this a common rails thing? thanks so far for your help To make things clear, pinging just means (in this context) make a request every so often. If you're using prototype PeriodicalExecuter is a good way to go (periodically_call_remote is a helper for that) 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] What does the ' %s ' mean ?
Hi there, can anyone explain to me how I have to understand the: %s in the following code line: yield :error, There was a problem resending your activation code, please try again or %s., resend_activation_path Whant does it stand for, what does it mean, what does it do? Thanks! Tom -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Rails 2.3 Upgrade Issue with MemCache
Ugh. But did it solve the problem? On Apr 8, 9:59 am, Steve Odom steve.o...@gmail.com wrote: Thanks Tom. The crappy part is I'm not using memcache for anything at the moment. Steve On Apr 8, 7:31 am, tomrossi7 t...@themolehill.com wrote: Steve, Try throwing require 'memcache' in your environment.rb? I think that is how I finally got around it... Thanks, Tom On Apr 7, 11:19 pm, Steve Odom steve.o...@gmail.com wrote: I'm having the same issue as Tom, but I'm not using Starling. I'm using spawn. I don't have anything in an initializer to wrap in a after_initialize. Any ideas how to get workling to work in 2.3? Steve On Apr 7, 7:14 pm, Freddy Andersen fre...@cfandersen.com wrote: I'm not sure why this happens, BUT in rails 2.3.2 you have to wrap your Workling loader a after_init like so: config.after_initialize do Workling::Remote.dispatcher = Workling::Remote::Runners::StarlingRunner.new end On Mar 20, 6:42 am, TomRossi7 t...@themolehill.com wrote: One of the plugins I use is Workling. It throws the following error when I try to run it under 2.3: /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/ dependencies.rb:443:in `load_missing_constant': uninitialized constantMemCache(NameError) The offending line is: @@memcache_client_class ||= ::MemCache I don't know a lot aboutmemcache, so I'm not sure what changed with 2.3 that could cause the error. Anyone have some ideas? Thanks! Tom --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Read remote zip
Those are good points. For now, I whipped up something simple which basically: begin `wget #{url}` `unzip #{localfilename}` # do stuff with file (FasterCSV) rescue ensure # delete local files end I don't like relying on `` but sometimes it's just too easy to pass up. My original message was trying to avoid `wget url` Thanks! On Apr 7, 9:53 pm, Phlip phlip2...@gmail.com wrote: RobRwrote: I'd like to decompress the contents of: http://host.com/file.zip in memory without having to download the file (e.g. `wget`) first. Suggestions? Without having to download the file first is an example of premature optimization. It is the root of all evil. On any OS configured to be a server (as opposed to a wrist watch, for example) all memory and files map each other virtually. If you Net::HTTP read() that file to a file location, the OS will generally reserve a slot on the hard drive, then put the file into its matching memory location. In the next split microsecond, your code reads that file and unzips it, using only the memory image. If you then delete the file, it may never reach the hard drive. By that analysis, if you write simple code that downloads the file and hits it with common tools, you can finish your feature faster. However, there are also situations where you _don't_ know which option is faster. Write the simpler code anyway, and then profile it to identify the real bottlenecks. They are invariably _not_ the places you would have guessed. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Ajax Rails
div id=%= post.title % style=display: none; Just make sure that %= post.title % is unique for the page. An id must conform to roughly the same rules as a JavaScript identifier. No leading numbers, no spaces, no funny business. Of course no browser bothers to enforce that, but such rules exist to help us Rails programmers write rigorous code that goes far beyond browser forgiveness. div id=post_%= post.id % style=display: none; --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: What does the ' %s ' mean ?
Tom Ha wrote: yield :error, There was a problem resending your activation code, please try again or %s., resend_activation_path Whant does it stand for, what does it mean, what does it do? Google for printf, alone. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: What does the ' %s ' mean ?
2009/4/9 Tom Ha rails-mailing-l...@andreas-s.net Hi there, can anyone explain to me how I have to understand the: %s in the following code line: yield :error, There was a problem resending your activation code, please try again or %s., resend_activation_path Whant does it stand for, what does it mean, what does it do? I'm not familiar with that particular bit of code, but I think this relates to the % method for String classes in ruby. See http://www.ruby-doc.org/core/classes/String.html#M000785 . This is ruby's way of doing format control letters and modifiers. If you've programmed in C etc or something like awk, you often use these in print statements (eg printf) to format strings and numbers etc. Whenever I have to look these up I check out the gawk reference - here's one online: http://www.gnu.org/software/gawk/manual/gawk.html#Control-Letters Simple example in ruby: foo%s % bar = foobar foo%05d % 1 = foo1 -- Daniel Bush http://blog.web17.com.au http://github.com/danielbush/sifs/tree/master http://github.com/danielbush --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Calendar control
what is sedu gem? how to get that use calendar control -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Using builder templates outside of controller
Hi, I'm using a builder template to generate atom feeds. So far so good, but I'd like to use the template inside a rake task to generate static files every 10 minutes or so. Would anyone care to suggest a Rails idiomatic way to do it? Thanks! -- Adriano --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Errors not logged to the screen in dev mode in 2.3.2
I've just upgraded a Rails 2.0.2 app to Rails 2.3.2 to take advantage of the I18n framework. I had to change application.rb application_controller.rb, after that Mongrel launches. Still, I have a problem. Even if I launch in development mode, I don't see errors logged to the screen, I get the Something went wrong page. Any suggestion? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Ajax Rails
2009/4/9 Phlip phlip2...@gmail.com div id=%= post.title % style=display: none; Just make sure that %= post.title % is unique for the page. An id must conform to roughly the same rules as a JavaScript identifier. No leading numbers, no spaces, no funny business. Of course no browser bothers to enforce that, but such rules exist to help us Rails programmers write rigorous code that goes far beyond browser forgiveness. div id=post_%= post.id % style=display: none; Just to complicate things, it was recommended in the past not to use underscores for id and class names because of the css specs. http://devedge-temp.mozilla.org/viewsource/2001/css-underscores/ I don't think it's a problem these days but I started to hyphenate in place of underscoring because I noticed my syntax highlighter didn't like underscores which led me to this whole weird issue. -- Daniel Bush http://blog.web17.com.au http://github.com/danielbush/sifs/tree/master http://github.com/danielbush --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Finding record between 2 dates
You can do this very easily with a named scope in your model: named_scope :between, lambda {|start_date, end_date| {:conditions = [created_at BETWEEN :start AND :end, {:start = start_date, :end = end_date}]}} On Apr 8, 5:51 pm, Vaibhav Deshpande rails-mailing-l...@andreas- s.net wrote: I am very new to ruby on rails programming, I am using the oracle as my database, In my project there r 2 text box fields and in first and second text boxes i want the date field to be enter by the client and want to display the record between those 2 dates how can i do the same, plz be more specific Thanks in advance, Vaibhavi... Not so good not so bad -- 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Ajax Rails
On 8 Apr 2009, at 15:31, Phlip wrote: div id=%= post.title % style=display: none; Just make sure that %= post.title % is unique for the page. An id must conform to roughly the same rules as a JavaScript identifier. No leading numbers, no spaces, no funny business. Of course no browser bothers to enforce that, but such rules exist to help us Rails programmers write rigorous code that goes far beyond browser forgiveness. div id=post_%= post.id % style=display: none; Or use the div_for helper 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: [ActiveRecord] strange issue, would like to understand before I wake up...
On 8 Apr 2009, at 13:11, Erwin wrote: TESTING in the console : script/console Loading development environment (Rails 2.3.2) Email.new = #Email id: nil, sender_email: nil, subject: nil, content: nil, user_id: nil, created_at: nil, updated_at: nil, title: mr, firstname: , lastname: Anonymous, type: nil(Note : type is nil, not Email ... ?) RequestEmail.new = #RequestEmail id: nil, sender_email: nil, subject: nil, content: nil, user_id: nil, created_at: nil, updated_at: nil, title: mr, firstname: , lastname: Anonymous, type: RequestEmail exit now TESTING again.. script/console Loading development environment (Rails 2.3.2) RequestEmail.new NameError: uninitialized constant RequestEmail ...const_missing I'll appreciate some feedback , should I buy a 2nd glass ? LOL If you try an eval a constant that does not exist const_missing is called (which by default raises NameError) Rails implements a const_missing that tries to load the file containing the constant for you. Rails can't guess where you've put your models, so this only works if you stick to the conventions: email.rb contains Email, FooController is in foo_controller.rb etc. If you use Email before RequestEmail then email.rb is loaded (which defines both those classes) because Rails knows to load email.rb is const_missing triggers on Email. WHen you do things the other way round rails does not know what to do with RequestEmail since there is no request_email.rb. require_dependency works because it loads email.rb Fred 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: What does the ' %s ' mean ?
Thanks a lot! -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: update page with results as they are scraped
I do something similar in one of my apps. The way I handle it is using periodically_call_remote every 6 seconds and check it against a controller action which looks at the DB to see if any new records were added for that user since the last time it checked. If there are, do a render :update |page| and add an insert_html with the new record on top. Naturally you can increase or decrease the time between checks, but I figure 5-10 seconds should be good for anyone. For my specific app, if I was scraping 5 items specifically, the periodically_call_remote function would turn itself off after I returned 5 records. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Finding record between 2 dates
Vaibhav Deshpande wrote: I am very new to ruby on rails programming, I am using the oracle as my database, In my project there r 2 text box fields and in first and second text boxes i want the date field to be enter by the client and want to display the record between those 2 dates how can i do the same, plz be more specific I'm not sure if this is an issue or not, but note that Oracle's DATE field is also used for storing DATETIME. Maybe the Rails Oracle adaptor handles this properly, but I just wanted to mention it in case you see weird behavior. I am using the oracle as my database, P. S. I wish my application could use The Oracle as its database. It would always get the correct response even if it doesn't know what to ask. ;-) http://www.imdb.com/character/ch765/ -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Calendar control
Sushrut Sathe wrote: what is sedu gem? I've never heard of a sedu gem and Google search turns up nothing interesting. how to get that use calendar control jQuery UI appears to have a nice calendar control. http://jqueryui.com/demos/datepicker/ -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: initializing collection_select
Thanks for the replies. The code, as y'all noted, was incorrect. This fixed it: collection_select(:observation, :observation_category_id, ObservationCategory.find(:all), :id, :name) I read somewhere that if the :method parameter returns a value in the :value parameter, that value will default to the selected item in the list, and this turned out to be true, thus eliminating the need for :selected. If I understand your points, the f.collection_select syntax is preferred over what I have. I'll make that update, and thanks for the advice. -Luke On Apr 7, 11:56 pm, Ram yourstruly.vi...@gmail.com wrote: ive come across this problem and as far as my searching took me, collection_select does not support the :selected option. you can handle this by initializing the selected value in the controller for the appropriate attribute before rendering the partial. The code you have shown above is slightly flawed in the syntax of collection_select as Fred has already pointed out. I think you want %= f.collection_select :observation_category_id, ObservationCategory.find(:all), :id, :name % So in your case, the problem really was the syntax. The above should work for your edit form ie. the correct option will be selected based on the existing value (built into collection_select). The lack of support for the :selected option in collection_select however, is a side issue. Anyone know if there's a fix for it? Besides initializing the value for it in the controller before rendering the partial? On Apr 7, 12:43 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Apr 7, 5:21 am,LukeGlgill...@gmail.com wrote: I'm a noob. I've trolled the web and groups for help, but I just don't know enough Rails to apply the solutions to my particular problem. I even got the screencast from Pragmatic Programmers, but still no dice. I'm having a problem getting my collection_select to initialize with a previously stored value. I have items and categories, with many items to one category. When I edit an item, the category list populates correctly, but I cannot figure out how to set the default to whatever category was already stored for that item. collection_select is like the various model helpers in that you do collection_select 'instance_variable_name', 'method_name', ... ie in this instance collection_select 'observation', 'category_id', ... Seeing as how you've already got a form_for setup, you should be able to do f.collection_select 'category_id', ... Calling it on the form builder means you don't need to tell rails which object you are working with. Fred Running Rails 2.3.2, here is the code: *controller:* def edit @observation = Observation.find(params[:id]) end *view:* %= f.label Category %br / %= collection_select(:observation_category_id, @category_id, ObservationCategory.find(:all), :id, :name, {:selected = @observation.observation_category_id}) % *models:* class Observation ActiveRecord::Base attr_accessible :name, :icon_url, :observation_catategory_id belongs_to :observation_category end class ObservationCategory ActiveRecord::Base has_many :observations end *html:* label for=observation_CategoryCategory/labelbr / select id=observation_category_id_ name=observation_category_id []option value=1exercise/option option value=2finance/option option value=3nutrition/option option value=4mood/option option value=5energy/option option value=6focus/option option value=7sleep/option option value=8junk_cat/option option value=9satiation/option/select --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Calendar control
On Apr 8, 7:43 am, Sushrut Sathe rails-mailing-l...@andreas-s.net wrote: what is sedu gem? how to get that use calendar control For calendars, I use either of the following two, depending on the purpose: http://code.google.com/p/calendardateselect/ http://github.com/topfunky/calendar_helper/tree/master --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: installing ruby-postgres gem
change /usr/include/libpq-fe.h (extern const char *pg_encoding_to_char(int encoding); to extern char *pg_encoding_to_char(int encoding);) # remove const -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Find and order
I have a find that look likes this: @values = UdidValue.find(:all, :conditions = ['udid_id = ?', x.id], :order = 'value ASC') The problem is that 'value' could be a street address, for example, numbers. So, when I do the :order if they are strings the get order wonderfully, but in one case I have values that are numbers, for example, 234, 233, 219, 25, 199, which get order as 199, 25, 219, 233, 234. Which is not what I want. I would like to order as 25, 199, 219, 233, 234. Is there a way to get the order to order properly regardless if it is a number of string? Thanks, -S -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Error during migrations using Community Engine
Hello all, I use community engine in my web application. when I create a new application and integrate CE it works perfect. But when i integrate CE in my application it is not working. please give suggestions. My problem is that my application has database aflatune_development . I setup CE in my application as per instruction given at http://communityengine.org/ documentation.html. It create migration file in my db/migrate/ 20090408130952_community_engine_to_version_61.rb Before this my database contains two tables roles and users which are also present in CE so i renamed my these two tables first and then tried. when I execute migration using rake db:migrate, It executes some migration and then throws error that rake aborted! An error has occurred, all later migrations canceled: following is some executed migration and error == CreateFavoritables: migrating = -- create_table(:favorites) - 0.0620s -- add_column(:clippings, :favorited_count, :integer, {:default=0}) - 0.1250s -- add_column(:posts, :favorited_count, :integer, {:default=0}) - 0.1090s -- add_index(:favorites, [:user_id], {:name=fk_favorites_user}) - 0.1090s == CreateFavoritables: migrated (0.7810s) == AddPublishedAsToPosts: migrating == -- add_column(:posts, :published_as, :string, {:default=draft, :limit=16}) - 0.1090s == AddPublishedAsToPosts: migrated (0.3440s) = == AddPublishedAtToPosts: migrating == -- add_column(:posts, :published_at, :datetime) - 0.1410s == AddPublishedAtToPosts: migrated (0.2350s) = == CreateRoles: migrating -- create_table(:roles) - 0.0630s rake aborted! An error has occurred, all later migrations canceled: An error has occurred, all later migrations canceled: undefined method `enumeration_model_updates_permitted=' for Role(id: integer, na me: string):Class Where i'm doing wrong? Thanks, Vikas -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to pass data to Javascript variable from Ruby on Rai
SpringFlowers AutumnMoon wrote: I wonder on RoR, will there be a need sometimes to pass some data from Ruby to Javascript? 1) var title = __ ; script type=text/javascript charset=utf-8 var title = '%= h @my_var -%' /script What is the proper way to do it (fill in the code for __ ) if title can have newline character, or single / double quote or any weird character. and what's more, what if the title from database can have script tags, so the code need to do cross-site scripting (xss) prevention, say, if the title needs to be set into a div's innerHTML later. 2) further more, what if we do a href=# onclick=changeIt(__); return false;Click me/a This case is more complicated, since I think there is a rule that says, anything inside the attribute's value will first be parsed by the browser as HTML first, so this is a little trickier than case (1). a href=# onclick=changeIt('%= h @my_var -%'); return false;Click me/a However, I think you're right about the format of the string object. HTML escape won't provide what you want so you probably need to write your own sanitizing helper and use that in place of html_escape (h) helper. A quick-and-dirty one I came up with was my_var.gsub(/[\n\'\]/, ). I'm sure that's probably not comprehensive, but does seem to take care of the issues mentioned here. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Adding files in git
Pål Bergström wrote: Bosko Ivanisevic wrote: You have to add files to git with: git add . This will add all new files. Command git commit -a -m '' with add only already tracked and changed files and commit them with given message. On Apr 8, 9:02�am, P�l Bergstr�m rails-mailing-l...@andreas-s.net Thanks :-) Also note that git add --all does what git add . does, but this form might only attempt to add modified and untracked files, rather than attempting to add every file in the project. I don't know if it actually matters though in practice. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Ajax Rails
Brilliant on all accounts - thanks guys!! sean On Apr 8, 11:04 am, Frederick Cheung frederick.che...@gmail.com wrote: On 8 Apr 2009, at 15:31, Phlip wrote: div id=%= post.title % style=display: none; Just make sure that %= post.title % is unique for the page. An id must conform to roughly the same rules as a JavaScript identifier. No leading numbers, no spaces, no funny business. Of course no browser bothers to enforce that, but such rules exist to help us Rails programmers write rigorous code that goes far beyond browser forgiveness. div id=post_%= post.id % style=display: none; Or use the div_for helper 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Best practice for passing vars etc...
Thanks Fredrick. The tip on nested routes was just what I needed. On Apr 7, 4:32 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Apr 7, 8:24 pm,elliottgx...@simplecircle.net wrote: In order for the products_controller actions to operate they all need access to params[:category]. Currently I am passing that attribute around thru a combination of hidden for_for fields and stuff like this: link_to 'Edit', edit_product_path(product, :category =params [:category]) I am running into a lot of issues keeping track of passing this info around through the various views and actions that are in play. It feels sloppy and prone to problems. It's like I'm working in PHP again. You might want to read up on nested resources Should I use global varibles or sessions to solve these kinds of problems? I really wouldn't - that's definitely grungy (both server side and from the point of view of the user) 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Find and order
I have a find that look likes this: @values = UdidValue.find(:all, :conditions = ['udid_id = ?', x.id], :order = 'value ASC') The problem is that 'value' could be a street address, for example, numbers. So, when I do the :order if they are strings the get order wonderfully, but in one case I have values that are numbers, for example, 234, 233, 219, 25, 199, which get order as 199, 25, 219, 233, 234. Which is not what I want. I would like to order as 25, 199, 219, 233, 234. Is there a way to get the order to order properly regardless if it is a number of string? Thanks, Google for natural sort for your particular database. If mysql, maybe... http://blog.feedmarker.com/2006/02/01/how-to-do-natural-alpha-numeric-sort-in-mysql/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Application Release Tracking Version Numbers
With a day to let this sit, I thought more about it (and did more searches), and did not find anything compartmentalized to handle this. I'll probably move forward with making this into a gem. Is anyone interested? Are there particular features you'd like to see this handle? -Kevin On Apr 7, 2009, at 12:50 PM, Kevin Elliott wrote: Forgive me if this has been solved in its entirety, although I've only seen bits and pieces of this solved in various ways. I'm hoping a few of you have figured out an elegant solution to this problem. Over time I've noticed that it would be immensely helpful if we were able to easily correlate which git commit version was running in all of our environments of our application. Capistrano is kind and stores this deployment version value in REVISION, and the deployment time in the timestamp of the deployment directory. Seth Ladd wrote about a couple of helper methods he wrote to acquire these values at http://blog.semergence.com/2008/11/03/displaying-deployment-date-and-time-and-git-revision-number-in-rails-views I'd like to take this up a notch and mark known good commits with releases (i.e. 1.0, 1.1, 1.2, 1.2.1, etc). At the footer of all pages, it would be excellent to be able to see something like PROD - 1.0 (3425) (ENVIRONMENT - VERSION (BUILD)) where BUILD corresponds to a git commit hash (somehow). I'd like to be able to catalog which commit hash maps to which version (and do this semi-automatically, through a rake/cap task, aka: cap deploy:version:increment only when a major/ minor release occurs). Then, I'd also like to extract all dependency version numbers, and combine all of this into exception reporting. So when an exception is thrown (gracefully to the end user with an error page), email is generated with: environment (production, staging, development, etc) particular app server hostname/ip/port app version (1.0, 1.0.1, 1.2, 1.3, etc) build version (3425) git commit hash dependent gems and plugins versions of each gem and plugin REQUIRED for the release versions of each gem and plugin installed Is anyone aware of a single tool that has combined all of this together? There are certainly some solutions, such as exception_notifier, hoptoad, etc, which do the exception notifications, but do not handle release management or release correlation. If not, I think this might be worthy of a plugin or gem that I'd consider building. -Kevin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Adding files in git
Robert Walker wrote: Pål Bergström wrote: Also note that git add --all does what git add . does, but this form might only attempt to add modified and untracked files, rather than attempting to add every file in the project. I don't know if it actually matters though in practice. I see. Good to know. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to change the response charset
Well, I fixed this issue following Charset conversion rules from this blog post: http://blog.grayproductions.net/articles/encoding_conversion_with_iconv James (the blog author) actually has the most comprehensive treatment on Ruby Strings (both for 1.8 1.9). Hope this helps somebody someday! :) On Apr 8, 12:45 am, xabriel xabri...@gmail.com wrote: Hi all, I have the following on a controller method: render :text = A string message I want that response body to be converted to US-ASCII. (BTW, Ruby seems to default to UTF-8) Any ideas? I know theres a 'response.charset', but that seems to only change the response's charset header. I need the actual body string to be changed to US-ASCII. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to change the response charset
Well, I fixed this issue following Charset conversion rules from this blog post: http://blog.grayproductions.net/articles/encoding_conversion_with_iconv James (the blog author) actually has the most comprehensive treatment on Ruby Strings (both for 1.8 1.9). Hope this helps somebody someday! :) On Apr 8, 12:45 am, xabriel xabri...@gmail.com wrote: Hi all, I have the following on a controller method: render :text = A string message I want that response body to be converted to US-ASCII. (BTW, Ruby seems to default to UTF-8) Any ideas? I know theres a 'response.charset', but that seems to only change the response's charset header. I need the actual body string to be changed to US-ASCII. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to pass data to Javascript variable from Ruby on Rai
On Apr 8, 6:00 pm, Robert Walker rails-mailing-l...@andreas-s.net wrote: SpringFlowers AutumnMoon wrote: me/a However, I think you're right about the format of the string object. HTML escape won't provide what you want so you probably need to write your own sanitizing helper and use that in place of html_escape (h) helper. A quick-and-dirty one I came up with was my_var.gsub(/[\n\'\]/, ). I'm sure that's probably not comprehensive, but does seem to take care of the issues mentioned here. I normally use to_json Fred -- Posted viahttp://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Ajax Rails
Frederick Cheung wrote: div id=post_%= post.id % style=display: none; Or use the div_for helper (Didn't know that! But..) sometimes it ain't a div. you can twiddle the innards of a span or table or li. Not to say you _should_... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Clearing string attribute
I am missing something very basic. I have a string attribute which I need to clear before saving the record. model.attribute = nil is not working. It works fine for another attribute which is a number The string attribute is nullable and was created via migration Thanks, Deepak --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] ADVANCED Rails Mailing List?
Is there an advanced rails mailing list? I've noticed that much of the issues on this list are for beginner to intermediate issues, and posters asking more advanced issues are rarely answered. I still find this list to be very useful, but I would love to find a community of more advanced RoR folks to discuss expert level implementations. -Kevin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Method to remove html escape characters from strings
Is there a convenient way of removing html escape characters from Strings? I could do using reg exp as in: = hello amp; goodbye hello amp; goodbye.gsub(/amp;/, ) = hello goodbye but I figured there might be a better way. thx. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---