[Rails] Re: Define id in xml
Thanks for the 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] Deep has_many through
Hey everyone, I tried searching for this and asking in #rubyonrails but got no answer. Given: class Aye; has_many :bee; end class Bee; has_many :cees; end class Cee; has_many :dees end Is this possible?: aye.dees I know how that with has_many through you can get aye.cees but can it go further than that? While searching I came accross http://wiki.rubyonrails.org/rails/pages/ThroughAssociations that talked about it (but this was a wish): class Manufacturer # using an array specifies the order in which the relationships occur. has_many :review_comments, :through => [:products, :reviews] # For that matter, we should be able to string together as many relationships as we like. # For example, for intergalactic commerce, we might want to find out which moons are associated with a given manufacturer. has_many :moons, :through => [:distributors, :space_stations, :planets, :moons] end Thanks, Ramon Tayag --~--~-~--~~~---~--~~ You received 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] "No such file to load" error when running Rspec
Mac OS 10.4 rspec (1.1.11, 1.1.4, 1.1.3, 0.5.15) rspec-rails (1.1.11) rspec_generator (0.5.15) rails 2.2.2 ruby 1.8.6 (2007-03-13 patchlevel 0) [universal-darwin8.0] Created a new project... $ rails myproject Installed rspec into the project... $ script/generate rspec Generated a resource... $ script/generate rspec_scaffold myresource name:string description:text Tried to run specs... $ rake spec Got this error: /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- ./spec/models/../../ vendor/generators/rspec/lib/rspec_on_rails (MissingSourceFile) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:31:in `require' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/ lib/active_support/dependencies.rb:155:in `require' from ./spec/models/../spec_helper.rb:3 from ./spec/models/entry_spec.rb:1:in `require' from ./spec/models/entry_spec.rb:1 from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/ spec/runner/example_group_runner.rb:14:in `load' from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/ spec/runner/example_group_runner.rb:14:in `load_files' from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/ spec/runner/example_group_runner.rb:13:in `each' from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/ spec/runner/example_group_runner.rb:13:in `load_files' from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/ spec/runner/options.rb:98:in `run_examples' from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/ spec/runner/command_line.rb:10:in `run' from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/bin/ spec:4 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- /Users/ethan/project/ project/spec/../vendor/generators/rspec/lib/rspec_on_rails (MissingSourceFile) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:31:in `require' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/ lib/active_support/dependencies.rb:155:in `require' from /Users/ethan/project/project/spec/spec_helper.rb:3 from ./spec/controllers/entries_controller_spec.rb: 1:in `require' from ./spec/controllers/entries_controller_spec.rb:1 from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/ spec/runner/example_group_runner.rb:14:in `load' from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/ spec/runner/example_group_runner.rb:14:in `load_files' from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/ spec/runner/example_group_runner.rb:13:in `each' from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/ spec/runner/example_group_runner.rb:13:in `load_files' from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/ spec/runner/options.rb:98:in `run_examples' from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/ spec/runner/command_line.rb:10:in `run' from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.11/bin/ spec:4 Indeed, there is no such file... vendor/generators, ls: rspec_controllerrspec_model Any insight would be greatly appreciated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Fwd: Loading Hash during testing using Fixtures
Never mind After stepping back and actually thinking about what I was trying to achieve, I worked it out. For those of you following at home from a google search, here is how to do it. one: id: 1 options: {name1: value1, name2: value2} Cheers Simon --- Forwarded message --- From: "Simon Macneall" To: "rubyonrails-talk@googlegroups.com" Cc: Subject: Loading Hash during testing using Fixtures Date: Wed, 07 Jan 2009 15:46:57 +0900 Hi all, I am finally starting to use the testing framework that rails provides, however I have come across a problem that I can't work out. Our model has a serialized hash as one of the members, and I can't work out the syntax in the YML file to populate the hash during testing. Any suggestions? Cheers Simon --~--~-~--~~~---~--~~ You received 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] Loading Hash during testing using Fixtures
Hi all, I am finally starting to use the testing framework that rails provides, however I have come across a problem that I can't work out. Our model has a serialized hash as one of the members, and I can't work out the syntax in the YML file to populate the hash during testing. Any suggestions? Cheers Simon --~--~-~--~~~---~--~~ You received 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 Implement ACL (Access Control List) in ROR?
Thanks both of you, well i have implemented the user authentication and I know how to do that but I am searching a solution for a Group Based ACL, I just want to know that if there is any plugin available for this or not? And I have visited the github site as well but its examples or can say solutions are mostly in old versions of rails. Thanks & Regards, Shahroon On Wed, Jan 7, 2009 at 11:01 AM, Robert Walker < rails-mailing-l...@andreas-s.net> wrote: > > shahroon ali wrote: > > Hey All, Could any body tell me about implementation of ACL in RoR, > > becasue > > i was searching on it for last two days but I haven't got anything very > > helpful. I have downloaded the restful_authentication plugin for it, but > > I > > dont have any tutorial about using this plugin. Or tell me if there is > > any > > other plugin for this. > > Thanks & Regards, > > Shahroon > > First of all restful_authentication does not implement ACL. It is a > authentication plugin not an authorization plugin. > > I have not investigated any of these but a quick search for ACL on > Github list a good number of solutions: > > http://github.com/search?q=acl&x=0&y=0 > -- > Posted via http://www.ruby-forum.com/. > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-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: RoR, Apache2, fcgid and ubuntu...
I'm using the module fcgid with apache and so along with it I need the fcgi gem. I tried using fastcgi module but it would crashso I switched to fcgid which is much reliable than fastcgi... I've also installed and used phusion passenger and ruby enterprise edition...but no use It too gives me a 404 error:-(( Can you please suggest any other way in which I can SUCCESSFULLY deploy my rails application on apache? Thanks. Bobnation wrote: > > > I guess my question would start with this: why are you using fcgi? > > On Jan 6, 2:57 am, ZebaMomin wrote: >> Hi. >> I'm trying to deploy my rails application on ubuntu server using apache2 >> and fcgid..but have not been successful.. >> I am using ruby 1.8.6, rails 2.2.2 and fcgi 0.8.7 gem... >> I am able to start apache successfully and view the Aptana RadRails >> welcome page..But giving my controller's name gives me a 404 error... >> I have made required changes in my /public/.htaccess and >> /public/dispatch.fcgi filesas=> >> >> .htaccess(w/o comments) >> >> AddHandler fastcgi-script .fcgi >> AddHandler fcgid-script .fcgi >> AddHandler cgi-script .cgi >> Options +FollowSymLinks +ExecCGI >> dispatch.*fcgi* >> RewriteEngine On >> RewriteRule ^$ index.html [QSA] >> RewriteRule ^([^.]+)$ $1.html [QSA] >> RewriteCond %{REQUEST_FILENAME} !-f >> RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] >> >> ErrorDocument 500 "Application errorRails application failed to >> start properly" >> >> dispatch.fcgi >> >> #!/usr/bin/ruby >> require File.dirname(__FILE__) + "/../config/environment" >> require 'fcgi_handler' >> require 'rubygems' >> require_gem 'fcgi' >> RailsFCGIHandler.process! >> >> I am attaching my httpd.conf file... >> >> I have checked that my VirtualHost works perfectly...but it doesn't seem >> to start my rails application >> >> Can someone please tell me where am I going wrong >> Thanks in advance.. >> >> -- >> View this message in >> context:http://www.nabble.com/RoR%2C-Apache2%2C-fcgid-and-ubuntu...-tp2130562... >> Sent from the RubyOnRails Users mailing list archive at Nabble.com. > > > > -- View this message in context: http://www.nabble.com/RoR%2C-Apache2%2C-fcgid-and-ubuntu...-tp21305625p21325494.html Sent from the RubyOnRails Users mailing list archive at Nabble.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 Implement ACL (Access Control List) in ROR?
shahroon ali wrote: > Hey All, Could any body tell me about implementation of ACL in RoR, > becasue > i was searching on it for last two days but I haven't got anything very > helpful. I have downloaded the restful_authentication plugin for it, but > I > dont have any tutorial about using this plugin. Or tell me if there is > any > other plugin for this. > Thanks & Regards, > Shahroon First of all restful_authentication does not implement ACL. It is a authentication plugin not an authorization plugin. I have not investigated any of these but a quick search for ACL on Github list a good number of solutions: http://github.com/search?q=acl&x=0&y=0 -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-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: Can we create FTP users within Rails?
Jb Li wrote: > I concern about possible the security issues with FTP, but most security > cameras (I know of) has FTP feature. If you do end up using FTP for this you might want to check your devices to see if they support Secure FTP (SFTP). At least that way the content they would be transporting would be encrypted while traversing the network. You will still need to carefully consider (and probably monitor) any automatically created FTP accounts. It might also be important to investigate the FTP server software you use for any known security related bugs. FTP servers are a hot target for hackers and warez bots, as I'm sure you are aware. Unfortunately FTP is one of those protocols invented before anyone cared much about security. -- 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] Acts_as_commentable_with_threading
Has anybody used plugin 'Acts_as_commentable_with_threading'? Can anybody tell me how to use it or implement it in my application? Thanks in advance. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-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] NEED HELP
Hai guys. I have problem in Rails.. Can u help me? please. My problem: I want to make code for maintenance database... I want like migration... can change to another version... so when I import some data, I must revert to before version.. example: file import 1 --> import to database... version 1 user1 add some data file import 2 --> import to database... version 2 user2 add some data file import 3 --> import to database... version 3 if file import 3 wrong data, then I can change to version2 with some data form user2.(last data base before file import3 exceuted) do anybody know about it?? if must use plugin.. what are they?? Thank you. -- Wu You Duan --~--~-~--~~~---~--~~ You received 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: A/B testing & stats plugins?
Thanks for the link, Steve. It's clarified what Website Optimizer is capable of a little bit, but it still doesn't cover what I want to test. The problem is that it defines conversions as singular events. There doesn't seem to be a way to test what I mentioned above. I develop Facebook apps, and one of the basic needs is to test how different factors affect the number of friends a user invites. I can't do that just based on % who end up on some "success" page. Any ideas? Steve Ross wrote: > You might find this of interest: > http://adwords.google.com/support/bin/topic.py?topic=10808 -- 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: Installing RoR for a Newbie is a nightmare
Good on you for persisting I'm sure things will run smoothly from now on. Good luck. Dave Porter On Jan 7, 9:20 am, squashua wrote: > Hi everyone, > > First off, thanks so much for your interest and help. I sat down with > a colleague today and in 5 minutes he had me up and going. It appears > with my installs and reinstalls it created a ruby folder > (rubygems-1.3.1) and a bin folder. Apparently it's the bin folder > where I wanted my PATH to go and not the other. Setting the PATH to > bin and then running the command line scripts made everything work. > > So thanks again! > > Sincerely, > > Squashua > > On Jan 4, 3:40 pm, Davo wrote: > > > Hi Philip, > > > I think this defeats the purpose - many people including me are using > > Rails on Windows and have no problems. > > ( everything manually installed and using Netbeans IDE ) > > > It should work, it does work. > > > Personally I find this Windows/Mac comparison elitist. They can both > > co-exist quite happily. > > At the end of the day isn't the whole point of developing Web > > Applications that it does not matter what O/S the end user is on ? > > > BTW: I am a Windows and Mac owner - I do RoR on WIndows because I > > find some things annoying on the Mac. > > > cheers Dave > > > On Jan 5, 8:32 am, Phlip wrote: > > > > Has anyone pointed out the root problem here is Windows? > > > > Install either CygWin or Linux, and spend more time programming and less > > > time > > > futzing with the platform!! --~--~-~--~~~---~--~~ You received 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 monkeypatch Hash's []= method
I was focusing on the "=" being the problem... Worked nicely. Many thanks! On Tue, Jan 6, 2009 at 7:20 PM, Frederick Cheung wrote: > > > On 6 Jan 2009, at 23:56, Harold A. Giménez Ch. wrote: > > > Thanks for the response. > > > > So how in the world is this implemented? The []= method's source > > code is in C. Other classes override it in a subclass, which works > > fine, but how would I go about implementing a method that works like > > the Hash class' []= method? > > > > I'm not sure what you mean by "skipping alias_method_chain" this > > time. If I do > > > > alias :[]_without_feature=, :[]= > > alias :[]=, :[]_with_feature > > > > I get the same error, as expected. So how would I go about changing > > this method's behavior? > > > > just call it square_bracket_without feature or something like that. > the problem isn;t the method aliasing it's defining a method called > []_with_feature= > > Fred > > > Thanks again, > > -H > > > > On Tue, Jan 6, 2009 at 6:49 PM, Frederick Cheung < > frederick.che...@gmail.com > > > wrote: > > > > > > On 6 Jan 2009, at 23:36, Harold wrote: > > > > > > > > I'm trying to monkeypatch the []= method in the Hash class: > > > > > > > doesn't seem to be anything to do with alias_method_chain - just > > sticking > > def []_with_feature=(a,b) > > puts 'foo' > > end > > > > into irb causes similar errors. You'll just have to skip alias method > > chain this time. > > > > Fred > > > Hash.class_eval do > > > def []_with_feature=(a,b) > > >puts 'foo' > > > end > > > alias_method_chain :[]=, :feature > > > end > > > > > > Something is wrong with the syntax, but I can't figure out what. The > > > alias_method_chain method does look for punctuation (= in this case) > > > and expects it to be at the end of the aliased method ([] > > > _with_feature=), but I get the following syntax error: > > > > > > SyntaxError: compile error > > > (irb):5: syntax error, unexpected ')', expecting '=' > > > (irb):7: syntax error, unexpected kEND, expecting ')' > > > (irb):9: syntax error, unexpected kEND, expecting ')' > > > > > > Any ideas? > > > > > > Thanks, > > > -H > > > > > > > > > > > > > > > > > > > > > > --~--~-~--~~~---~--~~ You received 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] attachment_fu, deferred thumbnail li
Hi, I'm using attachment_fu with great success, but have run into a requirement that I'd like to solve elegantly -- but I've outstripped my ruby skills. I have a class that returns a hash of thumbnail definitions, like so: class Thumb def self.get_thumbs(style) return { :small => "100x50", :large => "200x100" } if style == 'landscape' return { :small => "50x100", :large => "100x200" } if style == 'portrait' end end My attachment model is defined like this: class Photo < ActiveRecord::Base has_attachment :content_type => :image, :thumbnails => Thumb.get_thumbs(??) [...more stuff ...] end My photos controller has the following line: @photo = Photo.new(params[:photo]) My question: I'd like dynamically determine what value to set to Thumbnail.get_thumbs based on values set in the Photo.new constructor. Is this possible? I've fooled around with attr_accessors, lambdas, etc, but, I can't seem to do what I want. Is it possible to make such a run-time decision as I'm trying to make? Which is to say, if params[:photo][:style] = 'portrait', i'd like to cut the thumbnails accordingly? Does anyone have an elegant solution for this? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] How does observe_field work recursively
I use observe_field in a view page to monitor a field (field1). Whenever field1 changed, a action will render a partial (partial1). In partial1, I use observe_field to monitor a field (field2). so the problem is: when a user changed the field1, its action will set some variables and render the partial1. In partial1, the field2 changed because of some variables changed in the action, but the observe_field doesn't invoke its action. If the user changed the field2 manually, the observe_field works fine. So I wander why the observe_field doesn't work if the field changed according to a render. -- 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: MVC architecture
Valentino Lun wrote: > In the MVC architecture framework, the Model is actually communicate > with database. In my rails project, there is a model/ssh.rb that is not > connect with database. Is it a good practice for this arrangement in my > project? Am I violate the rules of MVC architecture? Or is it better to > move all the codes from models to controllers? What do you think? Thank > you. MVC has two meanings. The most important meaning is a set of Guidelines (_not_ "Rules") for where to put what logic. For example, if you put HTML code in the Controller or Model, you had better be prepared to answer why. MVC's other meaning is the answer to these questions for most GUIs: 1. do all your tests pass? 2. is your code simple and easy to read? 3. are you as DRY as possible without violating 2 (or 1)? 4. is your code minimal, without run-on modules? The game is to apply each item, in order, while not breaking the previous items. Don't DRY your code (meaning Don't Repeat Yourself) if you break tests, or make your code unreadable. Don't remove lines of code if tests break? (That is "refactoring".) The ideal of MVC is that a good design that follows those guidelines ought to automatically fall out as three layers, with the data accessors in one layer; the "switchboard operators" in another layer, plugging everything together, and the views in another layer, stretching it all out for the users. So, in theory, if you apply those Simplicity Guidelines an MVC pattern ought to emerge for you. Put anything you like in the models folder, so long as it's something that controllers mix and match together. > models/ssh.rb > $LOADED_FEATURES[$LOADED_FEATURES.length] = > 'net/ssh/authentication/pageant.rb' > require 'net/ssh' > > class Ssh > > def self.execute(cmd) > ssh=Net::SSH.start("ahnibm71", "testlib", :port => 19207, :paranoid > => false, :auth_methods => ["publickey"], :passphrase => "hellokitty", > :keys => ["C:/testing/id_rsa"]) > output = ssh.exec!(cmd) > ssh.close > if output.nil? > return "NULL" > else > return output.gsub("\n", "") Firstly, this mixes HTML and Model. That is not DRY, because it repeats the concept of a view down here. Remove that gsub, and render your output like this: <%=h output %> Nextly, all your code should be pure XHTML (google assert_xpath for more on this subject!), so you should have used . XHTML makes your pages super-easy to test, and this, in turn, keeps your code quality extremely high. Lack of tests is a much, much bigger problem than any variations in MVC ideals! > end > end > > end > > controllers/ssh_controller.rb > class SshController < ApplicationController Does this control SSHs? What is the concept on the SSH wire that's so important? Is this a "RemoteCommandController"? > def main If you have a main.html.erb file, and if it takes care of itself, you don't need this action in here. > end > > def test > render :text => Ssh.execute(params[:command]) Exactly. Models are typically things that respond to Hash options, and yours does. But put the tag up here, like this: render :inline => "<%=h Ssh.execute(params[:command]) %>" Why did I use :inline, instead of :text with a #{} masher? Because h() is not visible at this level, and :inline opens up a little bitty View inside your Controller. Yet your existing design was already very DRY, so these are only suggestions. The only technical fix is the h(). Further, shouldn't some other Model object intermediate between the raw SSH layer and the Controller? What concept is is the SSH object? -- 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: Why render doesn't work
Quoting Zhao Yi : > > Frederick Cheung wrote: > > That's just the way it is, divs aren't allowed there (just as you > > can't do either). Try putting your html > > through the w3c validator > > > > Fred > A render must be in an element. If I can't use div in this case, how can > I render it? Your element (the ...) isn't in a valid place. You have it between a row and the end of the table. Is it supposed to straddle the table boundary? Either move it into the ... or outside the table as appropriate. Or put it in a table row of its own. Jeffrey --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: A question about render
Can anyone help me on this? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Why render doesn't work
Frederick Cheung wrote: > That's just the way it is, divs aren't allowed there (just as you > can't do either). Try putting your html > through the w3c validator > > Fred A render must be in an element. If I can't use div in this case, how can I render it? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Styling rails elements
On 6 Jan 2009, at 20:54, Ryan Ororie wrote: > > I'm having some trouble with styling my views. > > Here is a particular snippet that I think illustrates well: > > <%= @tour_request.booked_datetime ? "Confirmed For: strong> > #...@tour_request.booked_datetime_string} > ":"Date and time requested: > #...@tour_request.daterequested} | #...@tour_request.preferredtime_string} > Alternative date and time requested: > #...@tour_request.altdaterequested} > #...@tour_request.preferredtime_string}" > %> > > That will prevent the page from loading, showing a custom error > screen. At a basic level that code boils down to "blahblahblah"red"blabblahblah" which isn't syntactically correct (quotes in strings need to be escaped) Fred > > > But this, will display fine: > > <%= @tour_request.booked_datetime ? "Confirmed For: strong> > #...@tour_request.booked_datetime_string} > ":"Date > and time requested: #...@tour_request.daterequested} | > #...@tour_request.preferredtime_string} Alternative date and > time > requested: #...@tour_request.altdaterequested} > #...@tour_request.preferredtime_string}" %> > > The only difference is on the first example I had class="red">#...@tour_request.booked_datetime_string} and the > second I had #...@tour_request.booked_datetime_string} > > I know I could just do <%= > @tour_request.booked_datetime_string %> but this field won't always be > displaying, so I need to find a way to make whichever that particular > tour has filled out showing, whether it's booked_datetime_string, > tour_request.daterequested, preferredtime_string or altdaterequested > > Would appreciate any 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: how to monkeypatch Hash's []= method
On 6 Jan 2009, at 23:56, Harold A. Giménez Ch. wrote: > Thanks for the response. > > So how in the world is this implemented? The []= method's source > code is in C. Other classes override it in a subclass, which works > fine, but how would I go about implementing a method that works like > the Hash class' []= method? > > I'm not sure what you mean by "skipping alias_method_chain" this > time. If I do > > alias :[]_without_feature=, :[]= > alias :[]=, :[]_with_feature > > I get the same error, as expected. So how would I go about changing > this method's behavior? > just call it square_bracket_without feature or something like that. the problem isn;t the method aliasing it's defining a method called []_with_feature= Fred > Thanks again, > -H > > On Tue, Jan 6, 2009 at 6:49 PM, Frederick Cheung > wrote: > > > On 6 Jan 2009, at 23:36, Harold wrote: > > > > > I'm trying to monkeypatch the []= method in the Hash class: > > > > doesn't seem to be anything to do with alias_method_chain - just > sticking > def []_with_feature=(a,b) > puts 'foo' > end > > into irb causes similar errors. You'll just have to skip alias method > chain this time. > > Fred > > Hash.class_eval do > > def []_with_feature=(a,b) > >puts 'foo' > > end > > alias_method_chain :[]=, :feature > > end > > > > Something is wrong with the syntax, but I can't figure out what. The > > alias_method_chain method does look for punctuation (= in this case) > > and expects it to be at the end of the aliased method ([] > > _with_feature=), but I get the following syntax error: > > > > SyntaxError: compile error > > (irb):5: syntax error, unexpected ')', expecting '=' > > (irb):7: syntax error, unexpected kEND, expecting ')' > > (irb):9: syntax error, unexpected kEND, expecting ')' > > > > Any ideas? > > > > Thanks, > > -H > > > > > > > > > > --~--~-~--~~~---~--~~ You received 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 RoR for a Newbie is a nightmare
Hi everyone, First off, thanks so much for your interest and help. I sat down with a colleague today and in 5 minutes he had me up and going. It appears with my installs and reinstalls it created a ruby folder (rubygems-1.3.1) and a bin folder. Apparently it's the bin folder where I wanted my PATH to go and not the other. Setting the PATH to bin and then running the command line scripts made everything work. So thanks again! Sincerely, Squashua On Jan 4, 3:40 pm, Davo wrote: > Hi Philip, > > I think this defeats the purpose - many people including me are using > Rails on Windows and have no problems. > ( everything manually installed and using Netbeans IDE ) > > It should work, it does work. > > Personally I find this Windows/Mac comparison elitist. They can both > co-exist quite happily. > At the end of the day isn't the whole point of developing Web > Applications that it does not matter what O/S the end user is on ? > > BTW: I am a Windows and Mac owner - I do RoR on WIndows because I > find some things annoying on the Mac. > > cheers Dave > > On Jan 5, 8:32 am, Phlip wrote: > > > Has anyone pointed out the root problem here is Windows? > > > Install either CygWin or Linux, and spend more time programming and less > > time > > futzing with the platform!! --~--~-~--~~~---~--~~ You received 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 monkeypatch Hash's []= method
Thanks for the response. So how in the world is this implemented? The []= method's source code is in C. Other classes override it in a subclass, which works fine, but how would I go about implementing a method that works like the Hash class' []= method? I'm not sure what you mean by "skipping alias_method_chain" this time. If I do alias :[]_without_feature=, :[]= alias :[]=, :[]_with_feature I get the same error, as expected. So how would I go about changing this method's behavior? Thanks again, -H On Tue, Jan 6, 2009 at 6:49 PM, Frederick Cheung wrote: > > > On 6 Jan 2009, at 23:36, Harold wrote: > > > > > I'm trying to monkeypatch the []= method in the Hash class: > > > > doesn't seem to be anything to do with alias_method_chain - just > sticking > def []_with_feature=(a,b) > puts 'foo' > end > > into irb causes similar errors. You'll just have to skip alias method > chain this time. > > Fred > > Hash.class_eval do > > def []_with_feature=(a,b) > >puts 'foo' > > end > > alias_method_chain :[]=, :feature > > end > > > > Something is wrong with the syntax, but I can't figure out what. The > > alias_method_chain method does look for punctuation (= in this case) > > and expects it to be at the end of the aliased method ([] > > _with_feature=), but I get the following syntax error: > > > > SyntaxError: compile error > > (irb):5: syntax error, unexpected ')', expecting '=' > > (irb):7: syntax error, unexpected kEND, expecting ')' > > (irb):9: syntax error, unexpected kEND, expecting ')' > > > > Any ideas? > > > > Thanks, > > -H > > > > > > > > --~--~-~--~~~---~--~~ You received 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] Update_attributes on multiple models, revert back on error
Hi, I have one method, 'updateStuff', that will call 'update_attributes' on 3 different models in the DB. How can I account for validation to revert back all updates if one of the models is not valid? I've looked into Model.valid? which doesn't seem to work for me .. Any idea? 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] restful_authentication installation setup problem
I'm new to rails and trying to get restful_authentication working, but I am getting errors when I try to create a user or login. I followed the instructions at the github repository and everything generated fine and http://localhost:3000/login loads correctly, but when I click the log in button I get the error: NameError in SessionsController#create uninitialized constant User::Authentication RAILS_ROOT: /home/irvin/code/rails/todo Application Trace | Framework Trace | Full Trace /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/ dependencies.rb:102:in `const_missing' app/models/user.rb:4 lib/authenticated_system.rb:138:in `logout_keeping_session!' app/controllers/sessions_controller.rb:10:in `create' Also when I go to http://localhost:3000/signup I get the following: NameError in UsersController#new uninitialized constant User::Authentication RAILS_ROOT: /home/irvin/code/rails/todo Application Trace | Framework Trace | Full Trace /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/ dependencies.rb:102:in `const_missing' app/models/user.rb:4 app/controllers/users_controller.rb:5:in `new' I am using the following environment: Ruby version1.8.7 (i486-linux) RubyGems version1.3.1 Rails version 2.2.2 Active Record version 2.2.2 Action Pack version 2.2.2 Active Resource version 2.2.2 Action Mailer version 2.2.2 Active Support version 2.2.2 Application root/home/irvin/code/rails/todo Environment development Database adaptersqlite3 Database schema version 20090106210012 Thanks for any help! --~--~-~--~~~---~--~~ You received 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 Hosting
Sure, I have multiple domains on one slice. Be aware of the type of server you run, and how you configure it, when thinking about memory. My app was veeery slow initially for configuration reasons. On Jan 6, 11:09 pm, pete wrote: > Does a "slice" allow me to have multiple apps running? For example, > say I have 2 prototypes, app1 and app2. > > Can I deploy app1 and app2, and if I have the domain "app1.com" and > "app2.com" can I set up the DNS to correctly map to the applications > seperately? > > I'll check out slicehost, but thought I would put that question out > there... > > Thanks! > > On Jan 6, 2:50 pm, Bobnation wrote: > > > A $20 slice or a cheap VPS from somewhere would do the trick for > > you ... at least that is what it sounds like. > > > On Jan 6, 3:41 pm, John Yerhot wrote: > > > > > Ok, I'll check it out. And I guess the main thing I am looking for is > > > > a sandbox where I can test remote deploys with Cap and Git, setup the > > > > database, basically anything I would do with a "production" level > > > > app. > > > > in that case, I'd just get a $20 slice at Slicehost. --~--~-~--~~~---~--~~ You received 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 Hosting
I use webfaction and am very pleased. Great service and great price. I had to install git myself but no big deal. Brandon On Tue, 6 Jan 2009 13:50:45 -0800 (PST), Bobnation wrote: > > A $20 slice or a cheap VPS from somewhere would do the trick for > you ... at least that is what it sounds like. > > On Jan 6, 3:41 pm, John Yerhot wrote: >> > Ok, I'll check it out. And I guess the main thing I am looking for > is >> > a sandbox where I can test remote deploys with Cap and Git, setup the >> > database, basically anything I would do with a "production" level >> > app. >> >> in that case, I'd just get a $20 slice at Slicehost. > -- -- Brandon Martin --~--~-~--~~~---~--~~ You received 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: Change the default folder for image_tag, javascript_include_
> I don't want my default folder to be mysite.com/images/logo.png, but > instead mysite.com/common/images/logo.png > > How can I change that? Same applies to stylesheets and javascripts. Don't know if there's an official way, but you could monkey patch some of the methods... Look at actionpack/lib/action_view/helpers/asset_tag_helper.rb... and override these methods: def compute_javascript_paths(*args) expand_javascript_sources(*args).collect { |source| compute_public_path(source, 'javascripts', 'js', false) } end def compute_stylesheet_paths(*args) expand_stylesheet_sources(*args).collect { |source| compute_public_path(source, 'stylesheets', 'css', false) } end def image_path(source) compute_public_path(source, 'images') end -philip --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Empty collection returned for model with has_many relationship
On 6 Jan 2009, at 22:20, Mark Reginald James wrote: > > The association_collection << method could easily be changed > to respect the identity of objects being added to a collection. > Should this be done to respect the POLS, violated for the OP? > Possibly. This area is fraught with subtleties though. Fred > -- > Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.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 monkeypatch Hash's []= method
On 6 Jan 2009, at 23:36, Harold wrote: > > I'm trying to monkeypatch the []= method in the Hash class: > doesn't seem to be anything to do with alias_method_chain - just sticking def []_with_feature=(a,b) puts 'foo' end into irb causes similar errors. You'll just have to skip alias method chain this time. Fred > Hash.class_eval do > def []_with_feature=(a,b) >puts 'foo' > end > alias_method_chain :[]=, :feature > end > > Something is wrong with the syntax, but I can't figure out what. The > alias_method_chain method does look for punctuation (= in this case) > and expects it to be at the end of the aliased method ([] > _with_feature=), but I get the following syntax error: > > SyntaxError: compile error > (irb):5: syntax error, unexpected ')', expecting '=' > (irb):7: syntax error, unexpected kEND, expecting ')' > (irb):9: syntax error, unexpected kEND, expecting ')' > > Any ideas? > > Thanks, > -H > > --~--~-~--~~~---~--~~ You received 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] how to monkeypatch Hash's []= method
I'm trying to monkeypatch the []= method in the Hash class: Hash.class_eval do def []_with_feature=(a,b) puts 'foo' end alias_method_chain :[]=, :feature end Something is wrong with the syntax, but I can't figure out what. The alias_method_chain method does look for punctuation (= in this case) and expects it to be at the end of the aliased method ([] _with_feature=), but I get the following syntax error: SyntaxError: compile error (irb):5: syntax error, unexpected ')', expecting '=' (irb):7: syntax error, unexpected kEND, expecting ')' (irb):9: syntax error, unexpected kEND, expecting ')' Any ideas? Thanks, -H --~--~-~--~~~---~--~~ You received 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] randomly dropping sessions
Hey all, Most of our customers get through our shopping cart no problem so orders continue to flow. However we've recently (past 10 days) started receiving reports of people not being able to add items to their cart. This seems to be affecting 2-3% of our customers. Taking a look at the logs I can see the sessions getting completely lost just as if the client had cookies disabled. I see no other warnings or errors. We did have nearly 350k sessions accumulated in our sessions table which I cleared out to around 40k last night. We haven't got any reports since then but I can't say yet if it's helped. I'm sure their have been other times when our sessions table got that large without this problem. We have >>very<< beefy hardware for our needs so I would expect to be able to handle that number of sessions without trouble. The site has been up for going on 3 years with no significant issues and has had no code changes other than some minor template/html tweaks in a couple months. ubuntu 8.10 rails 2.1.0 && active_record_store mysql 5.0.51 Any thoughts greatly appreciated. Thanks in advance! Tim --~--~-~--~~~---~--~~ You received 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: Empty collection returned for model with has_many relationship
Frederick Cheung wrote: >> Why does only the first object in the collection >> have a different object_id, and why does this >> difference go away if the empty a.steps is loaded >> before b is added? Is it a proxy thing? >> > Because .first will hit the database and load a fresh copy (if the > collection is not already loaded). I waffled about this a bit a while > ago: http://www.spacevatican.org/2008/11/15/first-foremost-and-0 Thanks Fred for pointing out the new behaviour of "first" and "last". However that's not the problem here. You get the same behaviour if you use steps[0]. Looking at it again after some sleep, I see that the different b object is actually loaded at the "a.steps << b" line. That is, the object is added by updating the foreign key in the database, loading the collection, then folding in any new_records, which ends up giving you the different b from the database. The association_collection << method could easily be changed to respect the identity of objects being added to a collection. Should this be done to respect the POLS, violated for the OP? -- Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.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: Calling System on winows batch file
Ryan Mckenzie wrote: > I put in the absolute paths and the bat file executes now but the .exe > file displays an output in a new Internet Explorer window. > Sorry this blank output is different from the expected outcome... the .exe file produces an output file which is then rendered in the Internet Explorer -- 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: Calling System on winows batch file
I put in the absolute paths and the bat file executes now but the .exe file displays an output in a new Internet Explorer window. I'm not sure if there is a problem within the .exe file with the .default.ard path being absolute. How would I echo the path in the bat file? Sorry I'm not very firmilar with 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] Re: Newbie automation testing web services with ruby
Hi Fred, Ah my mistake, started new discussion on the wrong window. Thanks for pointing it out to me. Lucas On Jan 6, 9:22 pm, Frederick Cheung wrote: > On 6 Jan 2009, at 05:17, winstan wrote: > > > > > Hi all, > > > First post on this group and I hope you guys are as helpful as the > > other guys have been for me on the watir group. Fingers crossed. > > You might want to try the ruby talk list as this isn't actually a > rails question. > > Fred > > > > > I have been successfully making HTTP POST protocol requests via an in > > house GUI using watir REXML to parse and validate the data, however > > now I wish to make SOAP calls with ruby. I have been doing research > > for days on this and am in need of a little help. > > > Due to the sensitivity of the work I am carrying out I will be as > > detailed as possible with the actual code I am using but at times I > > may be a little vague so please don’t just pass by not knowing what > > I’m talking about but please take the time to ask me for some more > > information. > > > Ok so back to my research. I came across a good example for sending a > > request to the web service and just outputting the response. However > > the response kept returning the line: “Server did not recognize the > > value of HTTP Header SOAPAction:”… so further I went with my > > investigation. > > > Here is the code I have been trying to use (without my edits to the > > LOCALHOST_ENDPOINT & request_xml_string): > > > require 'soap/element' > > require 'soap/rpc/driver' > > require 'soap/processor' > > require 'soap/streamHandler' > > require 'soap/property' > > > LOCALHOST_ENDPOINT = "http://localhost:8080/services/Service"; > > request_xml_string = 'xml...' > > > stream = SOAP::HTTPStreamHandler.new(SOAP::Property.new) > > header = SOAP::SOAPHeader.new > > body_item = SOAP::SOAPElement.new('getResponse', request_xml_string) > > body = SOAP::SOAPBody.new(body_item) > > envelope = SOAP::SOAPEnvelope.new(header, body) > > > request_string = SOAP::Processor.marshal(envelope) > > request = SOAP::StreamHandler::ConnectionData.new(request_string) > > resp_data = stream.send(LOCALHOST_ENDPOINT, request, 'getResponse') > > > It would appear that the xml response that I am seeking doesn’t have a > > header and that it is not an essential element of an xml (I later > > learnt). EASY I thought, I will just comment out the header line and > > remove it from the envelope line, resulting in this: > > > stream = SOAP::HTTPStreamHandler.new(SOAP::Property.new) > > #header = SOAP::SOAPHeader.new > > body_item = SOAP::SOAPElement.new('getResponse', request_xml_string) > > body = SOAP::SOAPBody.new(body_item) > > envelope = SOAP::SOAPEnvelope.new(body) > > > Again to no prevail, this is the output I get from SciTE: > > > c:/ruby/lib/ruby/1.8/soap/element.rb:246:in `encode': undefined method > > `length' for # (NoMethodError) > > from c:/ruby/lib/ruby/1.8/soap/generator.rb:129:in `encode_element' > > from c:/ruby/lib/ruby/1.8/soap/generator.rb:70:in `encode_data' > > from c:/ruby/lib/ruby/1.8/soap/generator.rb:58:in `generate' > > from c:/ruby/lib/ruby/1.8/soap/processor.rb:30:in `marshal' > > from WsRequestClientByShortName_test.rb:29 > > > Now I'm really lost and don’t know what to do now. > > > Many thanks with anticipation, and I look forward to speaking with you > > all at some stage. > > > Lucas- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ You received 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 Hosting
Does a "slice" allow me to have multiple apps running? For example, say I have 2 prototypes, app1 and app2. Can I deploy app1 and app2, and if I have the domain "app1.com" and "app2.com" can I set up the DNS to correctly map to the applications seperately? I'll check out slicehost, but thought I would put that question out there... Thanks! On Jan 6, 2:50 pm, Bobnation wrote: > A $20 slice or a cheap VPS from somewhere would do the trick for > you ... at least that is what it sounds like. > > On Jan 6, 3:41 pm, John Yerhot wrote: > > > > Ok, I'll check it out. And I guess the main thing I am looking for is > > > a sandbox where I can test remote deploys with Cap and Git, setup the > > > database, basically anything I would do with a "production" level > > > app. > > > in that case, I'd just get a $20 slice at Slicehost. > > --~--~-~--~~~---~--~~ You received 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 deep clone
Ran into this a while back. your_ar_instance.dup will keep the child records as well. On Jan 6, 1:25 pm, Michael Rigart wrote: > Hi all, > > I'm having problems with cloning an ActiveRecord Object. The object > consists of multiple child objects, so when I use the normal clone > method, it only clones the attributes of the parent object. > > Could someone help me out telling me how I can clone the child objects > as wel? I have tried like: > > tmp.my_items.each do |item| > @clone.my_items.build(item.clone) > end > > but that didn't help. I know it must be something fairly easy, but I > can't figure it out. > > Thank you in advance for the help. > -- > 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: RoR, Apache2, fcgid and ubuntu...
I guess my question would start with this: why are you using fcgi? On Jan 6, 2:57 am, ZebaMomin wrote: > Hi. > I'm trying to deploy my rails application on ubuntu server using apache2 > and fcgid..but have not been successful.. > I am using ruby 1.8.6, rails 2.2.2 and fcgi 0.8.7 gem... > I am able to start apache successfully and view the Aptana RadRails > welcome page..But giving my controller's name gives me a 404 error... > I have made required changes in my /public/.htaccess and > /public/dispatch.fcgi filesas=> > > .htaccess(w/o comments) > > AddHandler fastcgi-script .fcgi > AddHandler fcgid-script .fcgi > AddHandler cgi-script .cgi > Options +FollowSymLinks +ExecCGI > dispatch.*fcgi* > RewriteEngine On > RewriteRule ^$ index.html [QSA] > RewriteRule ^([^.]+)$ $1.html [QSA] > RewriteCond %{REQUEST_FILENAME} !-f > RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] > > ErrorDocument 500 "Application errorRails application failed to > start properly" > > dispatch.fcgi > > #!/usr/bin/ruby > require File.dirname(__FILE__) + "/../config/environment" > require 'fcgi_handler' > require 'rubygems' > require_gem 'fcgi' > RailsFCGIHandler.process! > > I am attaching my httpd.conf file... > > I have checked that my VirtualHost works perfectly...but it doesn't seem > to start my rails application > > Can someone please tell me where am I going wrong > Thanks in advance.. > > -- > View this message in > context:http://www.nabble.com/RoR%2C-Apache2%2C-fcgid-and-ubuntu...-tp2130562... > Sent from the RubyOnRails Users mailing list archive at Nabble.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 Hosting
A $20 slice or a cheap VPS from somewhere would do the trick for you ... at least that is what it sounds like. On Jan 6, 3:41 pm, John Yerhot wrote: > > Ok, I'll check it out. And I guess the main thing I am looking for is > > a sandbox where I can test remote deploys with Cap and Git, setup the > > database, basically anything I would do with a "production" level > > app. > > in that case, I'd just get a $20 slice at Slicehost. --~--~-~--~~~---~--~~ You received 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: Editing cell_text in calendar helper
This is really random, but I figured out the problem. Rails chokes on double quotes, so you have precede them with a slash: (this code is specific to integrating the DOM popup kit with the calendar helper plugin) cell_text << "Click here for popup" On Jan 5, 2:23 pm, David wrote: > Im wondering if there is a way to add a link with the html or > tag in the calendar helper > plugin:http://wiki.rubyonrails.org/rails/pages/Calendar+Helper+Plugin. > I am able to add links using the link_to helper, but I would like to > be able to add a link using one of the html tags so that I can add a > css class to it. > > I am trying to add a popup link to each day of the calendar using the > DOM popup kit which constructs the popups using the following format: > > Testing > > Does anyone know where I can put this code into the calendar helper? > It seems that the cell_text container rejects this code, so I am > thinking I am going to have to add it directly into the > calendar_helper.rb file itself. Thanks for any help, Im pretty much > stuck right now. --~--~-~--~~~---~--~~ You received 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: items.destroy doesn't work
How about Item.destroy_all(conditions) Which will call the destroy callback methods (slow if you are destroying many records). If you don't care about callbacks, use delete_all instead. http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001974 On Jan 6, 3:22 pm, scott wrote: > why doesn't this work > items.destroy if items = find(:all, :conditions => ...) > > right now i have this that works, but it seems ugly and inefficient. > > if items = find(:all, :conditions => ...) > items.each do |item| > item.destroy > end > end > > there must be a better way --~--~-~--~~~---~--~~ You received 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 Hosting
> Ok, I'll check it out. And I guess the main thing I am looking for is > a sandbox where I can test remote deploys with Cap and Git, setup the > database, basically anything I would do with a "production" level > app. in that case, I'd just get a $20 slice at Slicehost. --~--~-~--~~~---~--~~ You received 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: IntegrationTest doesn't affect model [SOLVED]
Summary: I was trying to write an IntegrationTest. I did a post_via_redirect that ought to result in a record being deleted from my (fixture-primed) database. The same post worked as expected in the functional test. In the integration test, the record was not deleted. My error: I had been using a session instance (returned by open_session, with a couple of singleton methods) for the test. Once committed to the session object, I issued post_via_redirect ... instead of session_inst.post_via_redirect ... The convenient way ActionController::IntegrationTest makes the post*, get*, etc methods available blinded me to the fact that they were façades for the same methods of an implicit session instance. So if I wanted them to apply to a session, I had to send them to that instance. Obvious, now that I understand it. And of like an idiot I "simplified" that detail out of my sample code. Sorry for the bandwidth. — F -- 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: New cheat sheet: Jump Start Credit Card Processing in Ruby
> Ok, it says a lot when I find myself chuckling at the sheer cuteness > of a technical guide. Forgot to mention - Great Job. --~--~-~--~~~---~--~~ You received 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 Hosting
I use a small orange and I am very pleased not only with the service but with the price. Also, if you do a search threw the forum here, you should run into several other posts that give lists and other opinions. -- 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: A/B testing & stats plugins?
You might find this of interest: http://adwords.google.com/support/bin/topic.py?topic=10808 On Jan 5, 2009, at 8:36 PM, Robert Matei wrote: > > Is there nothing like this in the Rails world? I've been looking for a > good testing framework for months, not finding anything, so I've just > been building my own. > > This is what I want to do: > - track arbitrary behaviors (e.g. photos viewed, comments posted) > - track correlation between arbitrary variables and those behaviors > (e.g, how do different versions of this prompt affect average photos > viewed?) > > This kind of thing should be a core part of agile development. What's > out there? I know Google Website Optimizer is one of the answers, > but it > seems pretty limited and awkward compared to a Rails-based solution. > -- > 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: New cheat sheet: Jump Start Credit Card Processing in Ruby
Ok, it says a lot when I find myself chuckling at the sheer cuteness of a technical guide. On Jan 6, 9:46 am, Amy Hoy wrote: > Hey guys... it's me ;) > > I've come out of a long cheat sheet-free period! > > I want to share with you my new, really massive "cheat sheet" on credit > card processing: > > * the process, > * how it works, > * what you need to get the right accounts, and of course, > * how to get started with ActiveMerchant. > > Download it here:http://jumpstartcc.com/ > > Aaaand... Thomas Fuchs contributed a spiffy JavaScript for detecting CC > types and validating against the Luhn10 algorithm. > > This little guide is based on what we learned developing our new time > tracking service, freckle:http://letsfreckle.com. Even with the help of > some excellent existing libraries, the whole process was brutal! > > I hate being brutalized! And there is crap all for resouces out there on > this topic, so I figured I'd share the knowledge. :) > > Let me know what you think! > > Amy > -- > 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] Change the default folder for image_tag, javascript_include_
Hi, I don't want my default folder to be mysite.com/images/logo.png, but instead mysite.com/common/images/logo.png How can I change that? Same applies to stylesheets and javascripts. 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: Plugin auto_complete
Just coming back after holidays... Thanks a lot to Mauricio, Matt and Jakub, but I'm still a newbie on RoR and I prefer not to use Edge Rails yet... As I previously used auto_complete plugin under Windows, I just copied /vendor/plugins/auto_complete directory to its new location under OS X and it works out! 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: Rails Hosting
Ok, I'll check it out. And I guess the main thing I am looking for is a sandbox where I can test remote deploys with Cap and Git, setup the database, basically anything I would do with a "production" level app. Thanks again for the suggestion, I'll check it out. On Jan 6, 1:57 pm, John Yerhot wrote: > Sounds like a cheap shared host like Dreamhost would work ok for you. > > On Jan 6, 1:35 pm, pete wrote: > > > Hi- > > > I've done some searching, but since there are many options, I'd like > > to get some feedback from the group at large. > > > I have a couple of Rails apps that will likely not see too much > > traffic and I would like to find a public home for them. Since these > > sites are not generating any revenue for me, I'd like to find a less > > expensive home. > > > Anyone have a suggestion, or know of a good resource, for a good, less- > > expensive hosting service to get up and running? > > > 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: Calling System on winows batch file
Ryan - On 6-Jan-09, at 3:59 PM, Ryan Mckenzie wrote: > > Hi guys, > Thanks for your input. I tried using the console and it seems that > ruby > does not like the content that is in the .bat file for some reason > (but > the command does work). > > The bat file contains this line of text which executes a .exe file to > open along with the default.ard file as being a model with the other > parameters > > resOp default.ard maxcutset="10" outputtype="XML" > > If I double click the bat file from windows explorer it runs fine for > some reason? Any ideas? > > Thanks again, > McKenzie likely env issue - echo the path in the bat file. you might need to set the path correctly @ the top J --~--~-~--~~~---~--~~ You received 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: Calling System on winows batch file
Hi guys, Thanks for your input. I tried using the console and it seems that ruby does not like the content that is in the .bat file for some reason (but the command does work). The bat file contains this line of text which executes a .exe file to open along with the default.ard file as being a model with the other parameters resOp default.ard maxcutset="10" outputtype="XML" If I double click the bat file from windows explorer it runs fine for some reason? Any ideas? Thanks again, McKenzie -- 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 Hosting
Sounds like a cheap shared host like Dreamhost would work ok for you. On Jan 6, 1:35 pm, pete wrote: > Hi- > > I've done some searching, but since there are many options, I'd like > to get some feedback from the group at large. > > I have a couple of Rails apps that will likely not see too much > traffic and I would like to find a public home for them. Since these > sites are not generating any revenue for me, I'd like to find a less > expensive home. > > Anyone have a suggestion, or know of a good resource, for a good, less- > expensive hosting service to get up and running? > > 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] Styling rails elements
I'm having some trouble with styling my views. Here is a particular snippet that I think illustrates well: <%= @tour_request.booked_datetime ? "Confirmed For: #...@tour_request.booked_datetime_string} ":"Date and time requested: #...@tour_request.daterequested} | #...@tour_request.preferredtime_string} Alternative date and time requested: #...@tour_request.altdaterequested} #...@tour_request.preferredtime_string}" %> That will prevent the page from loading, showing a custom error screen. But this, will display fine: <%= @tour_request.booked_datetime ? "Confirmed For: #...@tour_request.booked_datetime_string} ":"Date and time requested: #...@tour_request.daterequested} | #...@tour_request.preferredtime_string} Alternative date and time requested: #...@tour_request.altdaterequested} #...@tour_request.preferredtime_string}" %> The only difference is on the first example I had #...@tour_request.booked_datetime_string} and the second I had #...@tour_request.booked_datetime_string} I know I could just do <%= @tour_request.booked_datetime_string %> but this field won't always be displaying, so I need to find a way to make whichever that particular tour has filled out showing, whether it's booked_datetime_string, tour_request.daterequested, preferredtime_string or altdaterequested Would appreciate any 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: Can we create FTP users within Rails?
Thank you all! (I was distracted by another project from my angry boss, but I am still alive and watching this forum). I am actually resuming my project of allowing a end-user (account) to able able to FTP-up images right from their security cameras. I don't mean web-cams from kids, but real security firms. Again, I am thinking, once the user opens his or her account, an FTP access will be automatically created as part of the account preparation. I concern about possible the security issues with FTP, but most security cameras (I know of) has FTP feature. Thanks, JB Patrick Sullivan wrote: > Agreed. Giving Rails any FTP privileges beyond read is a disaster > waiting to > happen. Go with something that will allow Rails to handle file transfer > on > it's own. > > JB, take a look at Boxroom. http://boxroom.rubyforge.org/ This is what I > use > for sharing files between clients and friends. I run it as it's own > application, but with a little tinkering you can integrate it into > whatever > you're doing. -- 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] items.destroy doesn't work
why doesn't this work items.destroy if items = find(:all, :conditions => ...) right now i have this that works, but it seems ugly and inefficient. if items = find(:all, :conditions => ...) items.each do |item| item.destroy end end there must be a better way --~--~-~--~~~---~--~~ You received 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: New cheat sheet: Jump Start Credit Card Processing in R
> Anybody else with ideas, suggestions, or questions... let 'er rip! > > Oh, and if it helped you, I wouldn't mind hearing that either ;) > > Cheers, > > Amy What did you use to type the mini-book? It looks fantastic and is much easier to read than a boring manual! Is it LateX? OpenOffice? M$ Word? Other. Where did you get all these cool little images? Do you crate them yourself or do you have a pool of images in which you can pick? Best regards, -- 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: Empty collection returned for model with has_many relationship
So is this a known bug? Is this fixed in 2.2.2? I'm currently running rails 2.1.1. On Jan 6, 12:32 pm, Frederick Cheung wrote: > On Jan 6, 2:21 pm, Mark Reginald James wrote: > > > Frederick Cheung wrote: > > > Even if it were setting it on the in memory object it wouldn't be in > > > memory object you think it is. Because a was reloaded, the objects in > > > a.steps are not the objects b & c (although they do correspond to the > > > same database rows). > > > The problem happens before a is reloaded. > > > I just did some experiments with puzzling results. > > Would you be able to help explain them Fred? > > > Loading development environment (Rails 2.2.2) > > >> a = Exercise.find(1) > > => # > > >> b = Step.new > > => # > > >> b.save > > => true > > >> c = Step.new > > => # > > >> c.save > > => true > > >> a.steps << b > > => [#] > > >> a.steps << c > > => [#, #] > > >> b.object_id > > => 70254505869500 > > >> a.steps.first.object_id > > => 70254505813160 > > >> c.object_id > > => 70254505838840 > > >> a.steps.last_object_id > > => 70254505838840 > > > Why does only the first object in the collection > > have a different object_id, and why does this > > difference go away if the empty a.steps is loaded > > before b is added? Is it a proxy thing? > > Because .first will hit the database and load a fresh copy (if the > collection is not already loaded). I waffled about this a bit a while > ago:http://www.spacevatican.org/2008/11/15/first-foremost-and-0 > > 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] Rails Hosting
Hi- I've done some searching, but since there are many options, I'd like to get some feedback from the group at large. I have a couple of Rails apps that will likely not see too much traffic and I would like to find a public home for them. Since these sites are not generating any revenue for me, I'd like to find a less expensive home. Anyone have a suggestion, or know of a good resource, for a good, less- expensive hosting service to get up and running? 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: Web framework for embedded appliance?
On Jan 6, 2009, at 8:11 PM, Florian Dejako wrote: > Sorry for the off-topic post, but I figured someone here might know: > I'm looking for a Ruby web framework that is suitable for developing a > web service on an embedded network appliance. RAM is an issue, but > probably not as much as hard drive space. Too many requirements likely > make Rails a less than ideal candidate for this. If anyone has ideas > for what would work, any input is appreciated. Take a look at Lua: http://www.lua.org/about.html Runs on pretty much everything. And fast: http://lua-users.org/lists/lua-l/2007-11/msg00248.html As far as "web framework" goes, take a look at Nanoki, which provides a set of HTTP libraries implemented in pure Lua: http://alt.textdrive.com/nanoki/ Here is an online demo of a wiki implemented in pure Lua: http://svr225.stepx.com:3388/search?q=ruby Or at Kepler: http://www.keplerproject.org/ You might find other Lua libraries at LuaForge: http://luaforge.net/softwaremap/trove_list.php?form_cat=92 The Lua user wiki maintain a list of libraries as well: http://lua-users.org/wiki/LibrariesAndBindings HTH. Cheers, -- PA. http://alt.textdrive.com/nanoki/ --~--~-~--~~~---~--~~ You received 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] Web framework for embedded appliance?
Sorry for the off-topic post, but I figured someone here might know: I'm looking for a Ruby web framework that is suitable for developing a web service on an embedded network appliance. RAM is an issue, but probably not as much as hard drive space. Too many requirements likely make Rails a less than ideal candidate for this. If anyone has ideas for what would work, any input is appreciated. Thanks, Florian --~--~-~--~~~---~--~~ You received 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: New cheat sheet: Jump Start Credit Card Processing in R
Patrick: > Did/can you address the issue of allowing the end user to put spaces in > credit card numbers? Oh, great idea. I hate that too! I didn't think of it when I was writing, but I will definitely add it, one way or another. Perhaps we can add it to the JavaScript as a way of encouraging good behavior. > Whew! Boy am I glad I got that off my chest! I know how that feels! Anybody else with ideas, suggestions, or questions... let 'er rip! Oh, and if it helped you, I wouldn't mind hearing that either ;) Cheers, Amy -- 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] AR deep clone
Hi all, I'm having problems with cloning an ActiveRecord Object. The object consists of multiple child objects, so when I use the normal clone method, it only clones the attributes of the parent object. Could someone help me out telling me how I can clone the child objects as wel? I have tried like: tmp.my_items.each do |item| @clone.my_items.build(item.clone) end but that didn't help. I know it must be something fairly easy, but I can't figure it out. Thank you in advance for the 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: Empty collection returned for model with has_many relationship
Mark Reginald James wrote: > Frederick Cheung wrote: > >> Even if it were setting it on the in memory object it wouldn't be in >> memory object you think it is. Because a was reloaded, the objects in >> a.steps are not the objects b & c (although they do correspond to the >> same database rows). > > The problem happens before a is reloaded. > > I just did some experiments with puzzling results. > Would you be able to help explain them Fred? > > Loading development environment (Rails 2.2.2) > >> a = Exercise.find(1) > => # > >> b = Step.new > => # > >> b.save > => true > >> c = Step.new > => # > >> c.save > => true > >> a.steps << b > => [#] > >> a.steps << c > => [#, #] > >> b.object_id > => 70254505869500 > >> a.steps.first.object_id > => 70254505813160 > >> c.object_id > => 70254505838840 > >> a.steps.last_object_id > => 70254505838840 > Just a WAG, but a.steps.first.object_id isn't the same reference method as a.steps.last_object_id Is the first.object_id creating a new reference to that object, whereas last_object_id is returning the reference present in a.steps? Try the experiment again with the same object referencing method used for both first and last. -- 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: Empty collection returned for model with has_many relationship
On Jan 6, 2:21 pm, Mark Reginald James wrote: > Frederick Cheung wrote: > > Even if it were setting it on the in memory object it wouldn't be in > > memory object you think it is. Because a was reloaded, the objects in > > a.steps are not the objects b & c (although they do correspond to the > > same database rows). > > The problem happens before a is reloaded. > > I just did some experiments with puzzling results. > Would you be able to help explain them Fred? > > Loading development environment (Rails 2.2.2) > >> a = Exercise.find(1) > => # > >> b = Step.new > => # > >> b.save > => true > >> c = Step.new > => # > >> c.save > => true > >> a.steps << b > => [#] > >> a.steps << c > => [#, #] > >> b.object_id > => 70254505869500 > >> a.steps.first.object_id > => 70254505813160 > >> c.object_id > => 70254505838840 > >> a.steps.last_object_id > => 70254505838840 > > Why does only the first object in the collection > have a different object_id, and why does this > difference go away if the empty a.steps is loaded > before b is added? Is it a proxy thing? > Because .first will hit the database and load a fresh copy (if the collection is not already loaded). I waffled about this a bit a while ago: http://www.spacevatican.org/2008/11/15/first-foremost-and-0 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] rcov not detecting existing and valid test cases
Hello,- got a question regarding strange behavior by rcov. I have a gyms_controller.rb with the usual group of CRUD methods. Each one of them is being tested in the gyms_controller_test.rb: $ ruby test/functional/gyms_controller_test.rb Loaded suite test/functional/gyms_controller_test Started . Finished in 5.985611 seconds. 9 tests, 20 assertions, 0 failures, 0 errors So far, so good. Then, I've installed rcov and the majority of the code that is being tested is marked as not covered by the test. In particular, the fairly trivial test for the index action: 5 # GET /gyms 6 # GET /gyms.xml 7 def index 8 @gyms = Gym.find(:all) 9 respond_to do |format| 10 format.html # index.html.erb 11 format.xml { render :xml => @gyms } 12 end 13 end And the test: def test_should_get_index get :index assert_response :success assert_not_nil assigns(:gyms) end This is a test that is being executed and does not fail. How come it's not detected by rcov?? Thanks! / Vahagn -- 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] [resolved] Strange error...
Well, sorry to make noise! The solution is here: http://www.railsformers.com/article/activerecord-timezone-settings-bug It seems to be a bug. I just added config.active_record.default_timezone = :utc in my env.rb... Jej --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: New cheat sheet: Jump Start Credit Card Processing in Ruby
Hi, Very clear and detailed document, great pdf :) Thanks, Jan > --~--~-~--~~~---~--~~ > You received 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 > -~--~~~~--~~--~--~--- -- jan=callcc{|jan|jan};jan.call(jan) pgpYPw5p76XIh.pgp Description: PGP signature
[Rails] Re: Calling System on winows batch file
Ryan Mckenzie wrote: > Hello everyone, > > I'm using InstantRails 2.0 on a Windows XP 32 bit system. > > I'm developing a Rails application where I would like to execute a .bat > file > > I've had a look around and this piece of code is suppose to do the trick > but it does not seem to work. > > system('path/to/file.bat') > Should not need anything special. How do you know it doesn't work? Also, are you using forward slashes in the path? That may not work. Are there spaces in the path to file.bat? That may not work. Cheers, Mohit. 1/7/2009 | 12:41 AM. --~--~-~--~~~---~--~~ You received 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] Strange error...
Hi all, I get a really strange error... I have 2 simple models: class Membre < ActiveRecord::Base has_one :adhesion end class Adhesion < ActiveRecord::Base belongs_to :membre end The relation works well in the console. I can find a Membre and get its Adhesion, or find an Adhesion and get the Member. Now in a controler/view... If I find like this: @adhesion = Adhesion.find_by_membre_id(id) I can use @adhesion in the view without any problem. But if I do: @adhesion = Membre.find(id).adhesion (what is more clean and logical) I get an error in the view, as soon as I try to read any field/method of @adhesion. What confuses me is that in both cases, the content of @adhesion is the same in the view: # # The failing view: <%= @adhesion.inspect %> <%= if @adhesion.date_adhesion.nil? # line 9 is here # "You don't have adhesion." %> The error: You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.include? /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/ attribute_methods.rb:142:in `create_time_zone_conversion_attribute?' /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/ attribute_methods.rb:75:in `define_attribute_methods' /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/ attribute_methods.rb:71:in `each' /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/ attribute_methods.rb:71:in `define_attribute_methods' /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/ attribute_methods.rb:350:in `respond_to?' /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/ associations/association_proxy.rb:209:in `method_missing' app/views/membre/adhesion.erb:9 Any idea welcome! Read you, Jej --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Calling System on winows batch file
On Tue, Jan 6, 2009 at 11:07 AM, Ryan Mckenzie < rails-mailing-l...@andreas-s.net> wrote: > > Hello everyone, > > I'm using InstantRails 2.0 on a Windows XP 32 bit system. > > I'm developing a Rails application where I would like to execute a .bat > file > > I've had a look around and this piece of code is suppose to do the trick > but it does not seem to work. > > system('path/to/file.bat') > > Do I need to have some plugins/gems installed? > > Regards, > > McKenzie. > No, the #system method is built into Ruby. Can you execute your #system call from the Rails console? $ script/console >> system("/full/path/to/file.bat") ...works for me. --wpd --~--~-~--~~~---~--~~ You received 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: New cheat sheet: Jump Start Credit Card Processing in Ruby
Hi Amy, Without having looked at your cheat sheet yet, nor at any code that might be out there for validating credit card numbers, can I put in a request to eliminate one of my (many, I'm sure) pet peeves... Did/can you address the issue of allowing the end user to put spaces in credit card numbers? I find it much easier to enter 4 digits at a time, as they are printed on my credit card, separated by spaces and get annoyed at sites that require that I enter all 16 digits in one swell foop. Whew! Boy am I glad I got that off my chest! --wpd --~--~-~--~~~---~--~~ You received 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] Calling System on winows batch file
Hello everyone, I'm using InstantRails 2.0 on a Windows XP 32 bit system. I'm developing a Rails application where I would like to execute a .bat file I've had a look around and this piece of code is suppose to do the trick but it does not seem to work. system('path/to/file.bat') Do I need to have some plugins/gems installed? Regards, McKenzie. -- 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: New cheat sheet: Jump Start Credit Card Processing in Ruby
Thank you Amy - always a (brutal) and mysterious process. Jodi On 6-Jan-09, at 10:46 AM, Amy Hoy wrote: > > Hey guys... it's me ;) > > I've come out of a long cheat sheet-free period! > > I want to share with you my new, really massive "cheat sheet" on > credit > card processing: > > * the process, > * how it works, > * what you need to get the right accounts, and of course, > * how to get started with ActiveMerchant. > > Download it here: http://jumpstartcc.com/ > > Aaaand... Thomas Fuchs contributed a spiffy JavaScript for detecting > CC > types and validating against the Luhn10 algorithm. > > This little guide is based on what we learned developing our new time > tracking service, freckle: http://letsfreckle.com. Even with the > help of > some excellent existing libraries, the whole process was brutal! > > I hate being brutalized! And there is crap all for resouces out > there on > this topic, so I figured I'd share the knowledge. :) > > Let me know what you think! > > Amy > -- > 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] New cheat sheet: Jump Start Credit Card Processing in Ruby
Hey guys... it's me ;) I've come out of a long cheat sheet-free period! I want to share with you my new, really massive "cheat sheet" on credit card processing: * the process, * how it works, * what you need to get the right accounts, and of course, * how to get started with ActiveMerchant. Download it here: http://jumpstartcc.com/ Aaaand... Thomas Fuchs contributed a spiffy JavaScript for detecting CC types and validating against the Luhn10 algorithm. This little guide is based on what we learned developing our new time tracking service, freckle: http://letsfreckle.com. Even with the help of some excellent existing libraries, the whole process was brutal! I hate being brutalized! And there is crap all for resouces out there on this topic, so I figured I'd share the knowledge. :) Let me know what you think! Amy -- 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] mysql error on server
I just updated to Rails 2.2.2 from 1.2.6 yesterday. Today I reinstalled the mysql gem. Now when I try to run script/server the server starts, but when I try to access my database in a browser window get the following error: dyld: lazy symbol binding failed: Symbol not found: _mysql_init Referenced from: /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/ mysql.bundle Expected in: dynamic lookup dyld: Symbol not found: _mysql_init Referenced from: /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/ mysql.bundle Expected in: dynamic lookup Trace/BPT trap Any suggestions would be most appreciated. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Quick one! -- Project Messages!!
Ryan Bigg wrote: > Woah. > > Firstly, why are you calling .collect on project.messages and > everything? This is unnecessary. > > Secondly, if messages is an association for a project it would be > better if you used nested routes, as explained here: > http://guides.rails.info/routing_outside_in.html > . Your controller would be called messages_controller and the action > would be called index, not messages. > - > Ryan Bigg > Freelancer > http://frozenplague.net Thanks for your help. Ive created a nested route, and now have my messages for the project which is fine. The next problem comes from getting the comments for each message in this index page. I am not quite sure how I can retrieve the comments per message in the index in my controller -- 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: Why render doesn't work
On 6 Jan 2009, at 14:53, Zhao Yi wrote: > > Frederick Cheung wrote: >> >> I don't believe it's legal HTML to have a div there. >> >> Fred > > Why? Could you tell me what wrong with my code? > That's just the way it is, divs aren't allowed there (just as you can't do either). Try putting your html through the w3c validator 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] Re: Why render doesn't work
Frederick Cheung wrote: > > I don't believe it's legal HTML to have a div there. > > Fred Why? Could you tell me what wrong with my code? -- 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 reference parent object when using sub-resources
Nevermind -- I've found the answer. The link_to should be coded as: <%= link_to 'Add a payment', new_deposit_payment_path(@deposit) %> For me, magic is often hard to follow. On Jan 6, 9:18 am, POOCH wrote: > Hi, > > I'm building my first Rails application and have hit a problem using > sub-resources. > > My model includes a Deposit that has_many Payments. So routes.rb has > a line: > > map.resources :deposits, :has_many => :payments > > I've generated the scaffolding for Payments and I am able to go from a > particular Deposit to a page where I want to show its list of > Payments. The index.html.erb for Payments begins with these 2 lines: > > Payments for deposit <%= @deposit.deposit_date %> : <%= > @deposit.name %> > > <%= link_to 'Add a payment', new_payment_path(@deposit) %> > > The references to @deposit in the first line are resolved correctly, > but not so on the second line. When trying to render the index, the > error messages I get are: > > NoMethodError in Payments#index > You have a nil object when you didn't expect it! > The error occurred while evaluating nil.to_sym > > This at first made me think that @deposit was nil when the second line > was parsed, but now I think that the first error line is more to the > point -- there isn't a new_payment_path method that takes a Deposit as > a parameter. But I need to pass in the parent Deposit on the page > where I will be creating a child Payment, so how can I do that? > > When I remove the @deposit parameter from new_payment_path, the page > renders fine, but when I click the Add a Payment link, the page it > goes to ishttp://localhost:3000/payments/new, with no reference to > the parent Deposit. > > So how do I pass in the parent when creating the child? > > 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: store parameters variable into database
http://significantbits.wordpress.com/2008/01/29/yaml-vs-marshal-performance/ --~--~-~--~~~---~--~~ You received 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: javascript momentarily displayed on screen?...
On 6 Jan 2009, at 14:22, Shilo Ayalon wrote: > > what could be a reason for my js to be displayed on the screen for a > second before it catches and does what it's supposed to? I've had this > happen when I call page.reload inside render :update block... > Don't pass :update to link_to_remote if you're using render :update Fred > <%= link_to_remote 'reload', > :update => 'my_div', > :url => {:action => 'reload_page'} %> > > def reload_page > > respond_to do |format| >format.js do > render(:update) do |page| >page.reload > end >end > end > > end > > > yup, rails newb. > -- > 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: Why render doesn't work
On 6 Jan 2009, at 14:07, Zhao Yi wrote: > > I use render in a view page like this: > > <% form_for :project do |form| %> > > > > <%= > select_tag:project_selection,options_for_select(@project_names) > %> > <%= > observe_field :project_selection, >:frequency => 0.5, >:update => 'project_version_ajax', >:url => {:action => 'update_project_selection'} %> > > > > <%= render :partial=>'project_version' %> > > I don't believe it's legal HTML to have a div there. 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] Prawn: text at horizontal middle of the page
How to achieve this, like a horiz. align to center? I`m trying Prawn to generate PDFs, but having a problem to place a short text (3 words) at the horiz. middle of the page. This code places the text 2 or 3 centimeters right from the middle. Prawn::Document.generate('public/' + dir + "certificado.pdf", :page_size => "A4", :page_layout => :landscape) do bounding_box([0,430], :width => 800, :height => 600) do text nome, :size => 28, :align => :center end end As I change ":width => 800" value, the distance from the middle changes. I tried to remove width and heigth options, hoping the bounding_box to fit all the page, but I got a error. PS: I tried to subscribe to http://groups.google.com/group/prawn-ruby but it appears it is not accepting subscriptions. --~--~-~--~~~---~--~~ You received 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] javascript momentarily displayed on screen?...
what could be a reason for my js to be displayed on the screen for a second before it catches and does what it's supposed to? I've had this happen when I call page.reload inside render :update block... <%= link_to_remote 'reload', :update => 'my_div', :url => {:action => 'reload_page'} %> def reload_page respond_to do |format| format.js do render(:update) do |page| page.reload end end end end yup, rails newb. -- 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: Empty collection returned for model with has_many relationship
Frederick Cheung wrote: > Even if it were setting it on the in memory object it wouldn't be in > memory object you think it is. Because a was reloaded, the objects in > a.steps are not the objects b & c (although they do correspond to the > same database rows). The problem happens before a is reloaded. I just did some experiments with puzzling results. Would you be able to help explain them Fred? Loading development environment (Rails 2.2.2) >> a = Exercise.find(1) => # >> b = Step.new => # >> b.save => true >> c = Step.new => # >> c.save => true >> a.steps << b => [#] >> a.steps << c => [#, #] >> b.object_id => 70254505869500 >> a.steps.first.object_id => 70254505813160 >> c.object_id => 70254505838840 >> a.steps.last_object_id => 70254505838840 Why does only the first object in the collection have a different object_id, and why does this difference go away if the empty a.steps is loaded before b is added? Is it a proxy thing? I added a few lines to the has_many code to set the foreign keys on the in-memory records to nil. But because of the above behaviour the fk doesn't change on the local variable that held the first element added to the collection, unless the collection had been pre-loaded. -- Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.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] How to reference parent object when using sub-resources
Hi, I'm building my first Rails application and have hit a problem using sub-resources. My model includes a Deposit that has_many Payments. So routes.rb has a line: map.resources :deposits, :has_many => :payments I've generated the scaffolding for Payments and I am able to go from a particular Deposit to a page where I want to show its list of Payments. The index.html.erb for Payments begins with these 2 lines: Payments for deposit <%= @deposit.deposit_date %> : <%= @deposit.name %> <%= link_to 'Add a payment', new_payment_path(@deposit) %> The references to @deposit in the first line are resolved correctly, but not so on the second line. When trying to render the index, the error messages I get are: NoMethodError in Payments#index You have a nil object when you didn't expect it! The error occurred while evaluating nil.to_sym This at first made me think that @deposit was nil when the second line was parsed, but now I think that the first error line is more to the point -- there isn't a new_payment_path method that takes a Deposit as a parameter. But I need to pass in the parent Deposit on the page where I will be creating a child Payment, so how can I do that? When I remove the @deposit parameter from new_payment_path, the page renders fine, but when I click the Add a Payment link, the page it goes to is http://localhost:3000/payments/new , with no reference to the parent Deposit. So how do I pass in the parent when creating the child? 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: SSL plugin
>>> >>> ruby script/plugin install ssl_requirement >>> >>> Thank you In you application controller file add: include SslRequirement Best regards, -- Video training screencasts at http://www.digiprof.fr -- 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: Quick one! -- Project Messages!!
Ryan, If I understood correctly, he already has an index action that shows truncated messages. He asked for a 2nd page to show the whole content of all messages. He would probably be better off using a nested route for only 1 action (index) and retrieving the rest of the message asynchronously with AJAX on-demand, but that might be too much at once. Cheers, Sazima On Jan 5, 7:05 pm, Ryan Bigg wrote: > Woah. > > Firstly, why are you calling .collect on project.messages and > everything? This is unnecessary. > > Secondly, if messages is an association for a project it would be > better if you used nested routes, as explained > here:http://guides.rails.info/routing_outside_in.html > . Your controller would be called messages_controller and the action > would be called index, not messages. > - > Ryan Bigg > Freelancerhttp://frozenplague.net > > On 06/01/2009, at 6:02 AM, Dave Smith wrote: > > > > > Sazima wrote: > >> 1. Route (config/routes.rb): > > >> map.with_options(:controller => 'messages') do |m| > >> m.messages '/messages', :action => 'messages' > >> end > > >> 2. Action (app/controllers/messages_controller.rb): > > >> def messages > >> # Retrieve messages the same way you did in the index action > >> end > > >> 3. View (app/views/messages/messages.html.erb) => do the same as in > >> index, but showing the whole message... > > >> Cheers, Sazima > > >> On Jan 5, 3:20 pm, Dave Smith > > > im slightly confused. i was returning the messages in the projects > > controller by doing > > > @project_messages = @project.messages.collect > > > -- > > 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] Why render doesn't work
I use render in a view page like this: <% form_for :project do |form| %> <%= select_tag:project_selection,options_for_select(@project_names) %> <%= observe_field :project_selection, :frequency => 0.5, :update => 'project_version_ajax', :url => {:action => 'update_project_selection'} %> <%= render :partial=>'project_version' %> <% end %> In update_project_selection controller: def update_project_selection ... render :partial=>'project_version' end when the select box changed its value, the controller is invoked but the _project_version.html.erb doesn't update. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] :after_update_element and text_field_with_auto_complete
Hi! I'm on Rails 2.2.2 and using text_field_with_auto_complete which works fine. Now I want to use :after_update_element to send some data back to the server when my text field is updated. I have the following code in my view: <%= text_field_with_auto_complete :company, :name, {}, {:after_update_element => "function(element,value){" + remote_function( :url => { :action => :update_search_session }, :with =>"'selected_company_name='+element.value") + "}", :skip_style => false, :method => :get } %> I can see that my controller method (:update_search_session) gets called allright but I can't figure out how to access the returned data (element.value). Can anyone help? TIA, Peter -- 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] Generate random password in Rails
http://www.railsgeek.com/2009/1/6/generate-random-password-in-rails I am using Restful_authentication plugin for one of my projects. As part of my user creation workflow, system should to generate a random password for the new user. So, look at my password creation behaviour: * generate uncrypted password * send this with e-mail notification * crypt the password class CandidatesController < ApplicationController ... if @candidate.valid? candidate.save Notifier.deliver_inv(candidate.email, candidate.crypted_password) candidate.encrypt_password end end require 'digest/sha1' class User < ActiveRecord::Base ... def encrypt_password self.salt = Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{name}--") self.crypted_password = encrypt(self.crypted_password) save(false) end protected def save_password (self.crypted_password = password) unless self.crypted_password end ... end class Candidate < User # Callbacks: before_save :save_password before_validation_on_create Proc.new do |u| u.password = Array.new(12) { (rand(122-97) + 97).chr }.join u.password_confirmation = u.password end end -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Cloning ActiveRecord objects
Try your_active_record_instance.dup instead of .clone. On Jan 6, 6:43 am, Rob Lacey wrote: > Hi there, > > I've been working on a solution to try and fix a problem I am getting > with the Interlock plugin. However, my quick solution was to clone my > ActiveRecord object and store the clone. I now realise that cloning > ActiveRecord objects merely extracts the attributes and creates a new > object with the same attributes. What I want is to clone the whole > object, in this case assocations aren't necessary just the object with > the correct id. > > Is there any reason why this would be bad? I guess cloning the object is > generally used to duplicate records but here I want to take the object > and cache it without affecting the original object. > > RobL --~--~-~--~~~---~--~~ You received 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: Checking for Functional Site
Eric wrote: > cron wget to run every minute pulling HEAD requests and email you if > there's a 404 or 500 or whatever you get when it's busted. > > -eric You will quickly get your inbox overflooded in such case. Using a remote service like HopToad or GetExceptional is better. If anyone knows about an ever better option, please let use know. -- Video training screencasts at http://www.digiprof.fr -- 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] File upload time-out?
I have an app that uploads large mp3 files (teaching), of around 30 megs or so. I am running my app on a mongrel cluster behind nginx. The file uplaods seem to hang. Is there a max execution time setting in rails, mongrel or nginx that is causing this? Thanks Richard --~--~-~--~~~---~--~~ You received 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: Empty collection returned for model with has_many relationship
On 6 Jan 2009, at 12:52, Mark Reginald James wrote: >> >> -- >> >> What is going on here? This is so anti-intuitive - how could a bug >> like this exist and not have been detected hundreds of times before? > > Yes, I would regard this as a Rails bug. > The clear method is not setting the foreign key to > nil on the in-memory object. > Even if it were setting it on the in memory object it wouldn't be in memory object you think it is. Because a was reloaded, the objects in a.steps are not the objects b & c (although they do correspond to the same database rows). Fred > It's only being manifest though because of the > unnecessary saves you're doing, meaning that > the problem has probably been rarely seen. > > -- > Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.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: Slow rendering (column statistics) after migration
On Jan 6, 12:55 pm, Albert wrote: > After migrating to a new system, most parts work fine and perform as > before. But the xml template where I use column statistics performs > very bad: 8 seconds instead of 0.2 seconds on the old system. There I > use statements like: 'xml.min_resolution(satellite.sensors.minimum > (:min_resolution))'. Database performance is good, it is the rendering > which takes a long time. When I remove the column statistics commands > from the template, performance is like on the old system. > I suggest you get ruby-prof and see where the time is going. Fred > The new system is using newer versions of the system software (new/ > old): ruby 1.8.7/ruby 1.8.6, rails 2.2.2/rails 2.1.1, Linux > 2.6.18-92.el5 (both), MySQL 5.0.45 (both). > > Any idea what can cause such a problem? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Slow rendering (column statistics) after migration
After migrating to a new system, most parts work fine and perform as before. But the xml template where I use column statistics performs very bad: 8 seconds instead of 0.2 seconds on the old system. There I use statements like: 'xml.min_resolution(satellite.sensors.minimum (:min_resolution))'. Database performance is good, it is the rendering which takes a long time. When I remove the column statistics commands from the template, performance is like on the old system. The new system is using newer versions of the system software (new/ old): ruby 1.8.7/ruby 1.8.6, rails 2.2.2/rails 2.1.1, Linux 2.6.18-92.el5 (both), MySQL 5.0.45 (both). Any idea what can cause such a problem? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---