[Rails] Re: Two models with restful_authentication
Try to load up script/console, and check if user.category_ids= [1,3,6,...] works .. On 19. Mar., 07:38 h., Indu RS wrote: > Hai everyone, > I am using restful_authentication plugin in my project. The relation > between the category and user is has_and_belongs_to_many. So I created > another table category_users with category_id and user_id as fields. In > my view i specified like the following. > <% for category in Category.find(:all) %> > <%= category.name %> > <%= check_box_tag("user[category_ids][]","#{category.id}") > %> > <%end%> > But when I tried to save the user model the categories of the user is > not saving in the table category_users. Data to the table users is > saving. What I have to do for storing data to category_users? (more than > one category for a single user). > Please help. > Thanks in advance > -- > 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: Rails Version
On 19 Mar., 07:12, NARAYANAN CJ wrote: > hi there, > > Can i have two version of rails 2.2.2 and 1.2.3 on the same executable > location. Is that possible It is possible to have two version of the Rails gem installed but the "rails" executable will always be replaced when installing another version of Rails. So you probably can't have two versions of Rails in the same executable. -- Cheers, David Knorr http://twitter.com/rubyguy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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] Two models with restful_authentication
Hai everyone, I am using restful_authentication plugin in my project. The relation between the category and user is has_and_belongs_to_many. So I created another table category_users with category_id and user_id as fields. In my view i specified like the following. <% for category in Category.find(:all) %> <%= category.name %> <%= check_box_tag("user[category_ids][]","#{category.id}") %> <%end%> But when I tried to save the user model the categories of the user is not saving in the table category_users. Data to the table users is saving. What I have to do for storing data to category_users? (more than one category for a single user). Please help. 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] Re: Google Latitude in Ruby on Rails
saideep annadatha wrote: > How would you want to use the latitude? > > Previously, we have calculated the latitude and longitude with > Javascript > functions according to the place given and stored the values in a > database. > > So, what is it exactly are you trying to do? > > On Tue, Mar 17, 2009 at 4:11 PM, Angappan Ayyavoo < > rails-mailing-l...@andreas-s.net> wrote: > >> Thanks >> Angaps >> -- >> Posted via http://www.ruby-forum.com/. >> >> > >> > > > -- > Thank You, > Saideep Annadatha Hai Thanks for your reply. I want to use the google latitude in my rails application. www.google.com/ig It is one of the widget which has the map+twitter application to share our resources to others in our link and vice versa. kindly tell me any idea on this. thanks angaps -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Rails Version
hi there, Can i have two version of rails 2.2.2 and 1.2.3 on the same executable location. Is that possible regards, Narayanan.cj. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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] video upload
Hello friends Can anybody let me know what is easiest way of video uploading.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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] Release mapademexicali.com APP (source code, db, etc)
Hi community, i just want to share this app. is same of www.mapademexicali.com http://www.mediafire.com/file/jygvja...2008.part1.rar http://www.mediafire.com/file/jonmt2...2008.part2.rar http://www.mediafire.com/file/ydn1dm...2008.part3.rar http://www.mediafire.com/file/zhtzjy...2008.part4.rar http://www.mediafire.com/file/eieqhg...2008.part5.rar 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: Problem with restful_authentication
Freddy Andersen wrote: > What is the error that you get? Does it say you are not allowed to > mass assign this (country_id) variable? > > Have a look in your user model where you have the attr_accessible you > are going to have to add :country_id there. Thank you so much for the immediate replay and solved my issue -- 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] Workling and dependent gems
Hi there. I'm trying to get Workling running on my staging server, but an "undefined method `get'" error (http://pastie.org/420580). It's a very clean Hardy server without many gems installed, so it must be a missing gem since I don't get that error on my dev box. I was wondering - is there a list of things that Workling is dependent on? It barfed when I didn't have daemons, then it barfed when I didn't have eventmachine. I knew I had to install those because it was mentioned it in the log/workling.output file. However, with this latest error, it doesn't say anything useful to me. I guess a list of all gems it needs would be great! 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] Re: Rails 2.3.2 + Lighttpd
I dont think many people use lighty and fastcgi these days, you may be better off switching to NGINX/mongrel or passenger which most people are doing?? I don't know if lighty will continue being able to run newer versions of rails forever as it seems to be a die-ing web server, sure you could probably make it work, but I don't know whether you would want to. I don't particularly see why you would want to stay so current with your rails version whilst using what is considered aging/under performing deployment method.. Not criticizing just wondering? Best of luck... I was bummed Lighttpd died too but I moved on. Cheers Richard On Mar 18, 4:41 pm, Fresh Mix wrote: > Can't start empty Rails 2.3.2 project from Lighttpd: > > 2009-03-18 08:52:13: (mod_fastcgi.c.1047) the fastcgi-backend > /var/www/rails/public/dispatch.fcgi failed to start: > > ./script/server works fine. > > Also Rails 2.2.2 works fine on Lighttpd. > > Was there some changes in 2.3.2, do I need new configuration for 2.3.2? > > $HTTP["host"] =~ "^(mydomain.com)$" { > server.error-handler-404 = "/dispatch.fcgi" > server.indexfiles = ( "dispatch.fcgi", "index.php", "index.html" > ) > fastcgi.server += ( > ".fcgi" => ( > "localhost" => ( > "min-procs" => 1, > "max-procs" => 1, > "socket" => "/tmp/rails.socket", > "bin-path" => " > /var/www/rails/public/dispatch.fcgi" > ) > ) > )} > > -- > 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: Handling database table dependencies
Are you talking about a polymorphic association?? You can set that up simply enough in the models after doing a wee search on them, http://envycasts.com/products/advanced-activerecord May have some interesting insight into them, it would then be easy enough to create a method from a before_destroy callback to check if it is being used or not... Cheers Richard On Mar 18, 8:05 pm, ms wrote: > Hey, > > thanks for reading this post. How do you handle dependencies? A really > simple example: I've got a table called "entity" and another table, > let's say, "entity_type". The entity types can be changed, of course, > they also should be deletable, but only, if they are not used by some > entities! How can I ensure this in Rails or directly in the DBMS > (postgres)? Do I have to check it manually within a validate-method in > the model? > > Thanks for any suggestions! > > Cheers, ms --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: ERB templates in the database
I see what you are saying but question that by storing erb templates in the DB would eventually become less flexible at some point in the future?? I can see why it could and why it couldn't... Would not using partials separated into directories by namespace's not work? I guess this depends on how many templates you are looking at..., have you tried a protoype of a db driven one? What were your results? You could always have the DB output to files in the rails system on demand? Maybe you write a model that doesn't write to DB but instead outputs to create the ERB files in the rails application's view folder... Sorry maybe not so much help, but if it was me I would try the last option... I would also try and avoid the need for this as much as possible by good usage of layouts and css which I am currently using on a CMS system... On Mar 19, 2:24 am, fredd wrote: > Hi, I am currently developing a small cms in Rails. I decided recently > that I need to store both the content and the presentation template in > the database for flexibility. The system is based heavily on content > blocks and I need different templates for the same content block in > different contexts. Anyone has a good advice on how to solve that > technically? I now how to render a erb template inline, but how do I > solve things like protecting some methods on objects like "destroy" > and so on. I have looked into other template languages that offer some > degree of protection like Radius and Liquid, but I like the fact that > ERB is bundled with Ruby and Rails already uses it, why reinvent the > wheel. > > Cheers > Fredrik --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Help! RubyGems is broken!
remove the rubyopt thing from your profile. I have seen that cause this exact error on many systems. Of course, restart your terminal session after changing your profile. :) On Wed, Mar 18, 2009 at 11:58 PM, Richard wrote: > > Could you not try re-installing ruby gems?? > > Cheers > > Richard > > On Mar 19, 4:36 am, explainer wrote: >> I have a problem with RubyGems: >> >> ruby gt.rb >> ruby: no such file to load -- ubygems (LoadError) >> >> Here are my compiler and gem versions: >> >> ruby --version >> ruby 1.8.7p5000 (2009-03-03 revision 22728) [x86_64-linux] <> from stable source download>> >> >> gem --version >> 1.3.1 <> >> >> When I built rubygems, I saw a reference to 'ubygems', but it looked >> like a typo. >> >> The source program has a "require 'rubygems' " line, and my profile >> file has a "RUBYOPT=rubygems" environment variable set. >> >> I am at a loss to determine what is causing this. > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Help! RubyGems is broken!
Could you not try re-installing ruby gems?? Cheers Richard On Mar 19, 4:36 am, explainer wrote: > I have a problem with RubyGems: > > ruby gt.rb > ruby: no such file to load -- ubygems (LoadError) > > Here are my compiler and gem versions: > > ruby --version > ruby 1.8.7p5000 (2009-03-03 revision 22728) [x86_64-linux] < from stable source download>> > > gem --version > 1.3.1 <> > > When I built rubygems, I saw a reference to 'ubygems', but it looked > like a typo. > > The source program has a "require 'rubygems' " line, and my profile > file has a "RUBYOPT=rubygems" environment variable set. > > I am at a loss to determine what is causing this. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: attachmnet_fu can't keep original file image!
It may have nothing to do with your situation, but I once had a similar experince when I forgot to install image magick... but I think Ar's advice will probably work Cheers Richard, On Mar 19, 7:00 am, Ar Chron wrote: > Just out of curiousity, add a > > :resize_to => '5000x5000>', > > before the thumbnails option. It *should* leave any image smaller than > 5000x5000 alone. Obviously, this is an awfully ugly hack, but humor me, > and see if the presence of the resize_to option makes a difference. > > I use ImageMagick and a > > has_attachment :content_type => ['image/jpeg', 'image/png'], > :storage => :file_system, > :max_size => 500.kilobytes, > :resize_to => '1600x1200>', > :thumbnails => { :thumb => '100x100>'} > > to resize any larger image to something that fits full screen on my > monitor, and the file system has the original, and a thumbnail, both > properly sized, even when the original is a 1024x768 image. Larger > images get sized down to 1600x1200. > -- > 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: Lin_to_remote and update a text area
My suggestion was just a try.Just try everything you can think of with your code. its not going to affect anything else as far as i can see. It would help if you tell us more about what the error was. Take a look at prototype.js api docs. Wouldnt take more than a couple of hours to go through the whole thing and it really helps. www.prototypejs.org/api Also look out for RJS tutorials. Railscasts episodes 43-45 are good ones. www.railscasts.com/episodes/43 Here're a few RJS cheatsheets for quick reference http://thebitt.com/dropbox/rails/rjs_cheatsheet.pdf, http://slash7.com/assets/2006/10/8/RJS-Demistified_Amy-Hoy-slash7_1.pdf Search the net thoroughly. More often than not, you can find a solution or the question has already been asked on some forum. And when you get errors that you cant resolve, post as much about them as you can so that others can help you. On Mar 18, 11:38 am, Sudhi Kulkarni wrote: > Ram wrote: > > its inner HTML. So use > > > On Mar 18, 8:53 am, Sudhi Kulkarni > > Hi Ram, > > I tried but once I add br it says it is an RJS Error. Don't know > why ... the snippet I used is > > link_to_function name do |page| > page.insert_html :bottom,'text_area', "Hello world " > end > > Thanks, > Sudhindra > -- > 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: Using mysql's 'REPLACE' command in active record
Thanks for the reply Mark, This is as I thought... :( At least it is sort of do-able, I don't enjoy putting sql in activerecord but sometimes I guess it is needed... Cheers Richard On Mar 19, 1:29 pm, Mark Reginald James wrote: > Richard wrote: > > Is this possible ?? > > Yes, but only with custom SQL: > > Model.connection.insert "replace into #{Model.table_name} " > > -- > 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: Using mysql's 'REPLACE' command in active record
Richard wrote: > Is this possible ?? Yes, but only with custom SQL: Model.connection.insert "replace into #{Model.table_name} " -- 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: set_table_name woes, fragmented domain class
Michael J. I. Jackson wrote: > I'm running Rails on top of a Mongrel cluster. I have several model > classes that are going to have so many records it is not feasible to > keep them all in the same table. So I've split out the records into > many different tables, each with its own suffix which corresponds to > the id of the model to which all records in that particular table > belong. > > For example, if I have a Domain AR object with an id of 20, all > DomainURL objects that :belong_to that particular Domain object are > stored in table domain_urls_20. > > This necessitates a call to set_table_name before the DomainURL > objects are fetched, like so: > > DomainURL.set_table_name "domain_urls_" + domain.id > > However, when I go into production mode, I get mismatched table and > column names on my find's. I am assuming this is caused by > ActiveRecord caching the domain model so that set_table_name is > rendered ineffective when it goes to fetch a record. However, I'm not > quite sure if this is the case. Perhaps your problem is caching of table names by the urls association. You could clear the cache using something like class Domain has_many :urls, :class_name => 'DomainURL' def set_url_table self.class.reflect_on_association(:urls).instance_eval do @table_name = @quoted_table_name = nil end DomainURL.set_table_name "domain_urls_" + id end end domain = Domain.find(...) domain.set_url_table urls = domain.urls -- 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] Calling ActionMailer model from script/console
I am writing an app that receives emails and forwards them to different locations based on certain criteria. I can recieve emails, and i can send them, i'm just having a problem linking the two together. The mailer model i am using is entitled My_Mailer and under that model i have defined a receive method, and a welcome method. The recieve gets the email, and the welcome sends another email. Right now i have something like this class MyMailer < ActionMailer::Base def receive(email) # parse and do ruby magic MyMailer.deliver_welcome(user_name, email_address ) end def welcome(name, email) # sends a welcome message end end Why when i call MyMailer.deliver_welcome(user_name, email_address ) from my script/console i can send an email just fine but when i call it within the recieve method, it doesn't work. Do you have any clue why a line of code would work from script/console but not in a model? Also if i try to debug or call "puts 'something'" within the MyMailer model nothing shows up in the console output. -- 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: gem list and . ~/.profile
On Mar 19, 1:33 pm, elle wrote: > On Mar 19, 10:14 am, Jeff Schwab wrote: > > > > > > > Jeff Schwab wrote: > > > elle wrote: > > > >> On Mar 19, 9:45 am, Jeff Schwab wrote: > > >>> elle wrote: > > > On Mar 19, 9:27 am, Jeff Schwab wrote: > > > elle wrote: > > >> My ~/.profile has: > > > ... > > >> And my ~/.bash_profile has the following: > > > ... > > >> What rules should I add to it? and where do I add them? > > > You want either a .profile or a .bash_profile, not both. Once bash > > > sees > > > the .bash_profile, it won't look for the .profile; that's why you're > > > having to source it manually. From bash(1): > > > When bash is invoked as an interactive login shell, or as a > > > non-inter- active shell with the --login option, it first > > > reads and executes com- mands from the file /etc/profile, > > > if that file exists. After reading that file, it looks for > > > ~/.bash_profile, ~/.bash_login, and ~/.profile, in that > > > order, and reads and executes commands from the first one > > > that exists and is readable. > > > I actually prefer just to have a .profile, but if you have to support > > > other sh-derivatives, .bash_profile lets you play it safe. > > Thank you for explaining. Just to verify that my path will be set > > correctly, I should change: > > PATH="/opt/subversion/bin:${PATH}" > > export PATH > > to > > PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/opt/ > > subversion/bin:${PATH}" > > export PATH > > is that correct? > > >>> No; there was no problem with what you had, just that you split it > > >>> across two or three files. You only should have exactly one of > > >>> .profile, .bash_profile, and .bash_login. > > > >> Sorry to be difficult but I actually have all 3 files. > > >> Which should I delete? > > >> And then, what happens to the information within? > > > > Concatenate them. For example, something like: > > > > cp /dev/null profile > > > for f in ~/.profile ~/.bash_login ~/.bash_profile > > > do > > > mv $f orig$f > > > cat $f >> profile > > > Whoops, you'd have to swap those lines. Warning: I haven't actually run > > this code. > > > > done > > > mv profile ~/.profile > > Did not work well. > I changed it to the following: > > cp -p ~/.profile ~/.profile.orig > cp -p ~/.bash_login ~/.bash_login.orig > cp -p ~/.bash_profile ~/.bash_profile.orig > cp /dev/null profile > for f in ~/.profile ~/.bash_login ~/.bash_profile; do > cat $f >> profile > mv profile ~/.profile > done > > What it did is, it placed .bash_profile content into .profile insetad > of adding it. Solved. Both the ~/.profile and ~/.bash_login had the same path defined but did not load in login. Adding the path to ~/.bash_profile fixed the problem. Checked: which mysql which svn which git gem list and all is good. Half way through, I realised it wasn't really a rails problem -- so, apologies for that. Hopefully, this will help someone else. Thanks, Elle --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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] Soft Ball? Validating either-or fields...
I have a situation where the user will either put text into a text- area or upload a file (ala attachment_fu). I need to check if either field has data (both is okay, too). Any suggestions? thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: gem list and . ~/.profile
On Mar 19, 10:14 am, Jeff Schwab wrote: > Jeff Schwab wrote: > > elle wrote: > > >> On Mar 19, 9:45 am, Jeff Schwab wrote: > >>> elle wrote: > > On Mar 19, 9:27 am, Jeff Schwab wrote: > > elle wrote: > >> My ~/.profile has: > > ... > >> And my ~/.bash_profile has the following: > > ... > >> What rules should I add to it? and where do I add them? > > You want either a .profile or a .bash_profile, not both. Once bash sees > > the .bash_profile, it won't look for the .profile; that's why you're > > having to source it manually. From bash(1): > > When bash is invoked as an interactive login shell, or as a > > non-inter- active shell with the --login option, it first > > reads and executes com- mands from the file /etc/profile, > > if that file exists. After reading that file, it looks for > > ~/.bash_profile, ~/.bash_login, and ~/.profile, in that > > order, and reads and executes commands from the first one > > that exists and is readable. > > I actually prefer just to have a .profile, but if you have to support > > other sh-derivatives, .bash_profile lets you play it safe. > Thank you for explaining. Just to verify that my path will be set > correctly, I should change: > PATH="/opt/subversion/bin:${PATH}" > export PATH > to > PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/opt/ > subversion/bin:${PATH}" > export PATH > is that correct? > >>> No; there was no problem with what you had, just that you split it > >>> across two or three files. You only should have exactly one of > >>> .profile, .bash_profile, and .bash_login. > > >> Sorry to be difficult but I actually have all 3 files. > >> Which should I delete? > >> And then, what happens to the information within? > > > Concatenate them. For example, something like: > > > cp /dev/null profile > > for f in ~/.profile ~/.bash_login ~/.bash_profile > > do > > mv $f orig$f > > cat $f >> profile > > Whoops, you'd have to swap those lines. Warning: I haven't actually run > this code. > > > > > done > > mv profile ~/.profile Did not work well. I changed it to the following: cp -p ~/.profile ~/.profile.orig cp -p ~/.bash_login ~/.bash_login.orig cp -p ~/.bash_profile ~/.bash_profile.orig cp /dev/null profile for f in ~/.profile ~/.bash_login ~/.bash_profile; do cat $f >> profile mv profile ~/.profile done What it did is, it placed .bash_profile content into .profile insetad of adding it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: Missing readline
Hi, you'll need to install the readline library and you should send a note to the Ruby package maintainer for your platform to add this dependency. Good luck, -Conrad Sent from my iPhone On Mar 18, 2009, at 3:32 PM, Lee wrote: > > I have installed Rails 2.2.2 on a Debian Lenny VPS and I am getting > the following error when trying to script/console. > > *** > > Loading development environment (Rails 2.2.2) > /usr/local/lib/ruby/1.8/irb/completion.rb:10:in `require': no such > file to load -- readline (LoadError) > > *** > > I have seen this error referred to in other posts but I am still > unsure how to install 'readline' on my system. > > fyi, I have compiled Ruby 1.8.7 from source and installed the Rails > 2.2.2 gem. > > 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: Search Results into new table
> > Hi all now i am doing with advanced search by using checkboxs and redio > button for each items > for example : <% form_for *:tblpss_description_record*, *...@tblpss_description_record*, * :url*=>{ *:action*=>'view_detail_job_setup' }, *:html*=>{ *:id*=> 'frm_view_setup', *:name*=>'frm_view_setup', *:method* => *:get*} *do*|f|%> ALL PHNOM PENH BANTEAY MEANCHEY BATTAMBANG KAMPONG CHAM KAMPONG CHHNANG KAMPONG SPEU KAMPONG THOM KAMPOT KANDAL KEP VILLE KOH KONG KRATIE MONDOL KIRI ODORMEANCHEY PAILIN PREAH VIHEAR PREY VENG PURSAT RATTANAKIRI SIEM REAP SIHANOUK VILLE STUNG TRENG SVAY RIENG TAKEO <% *end* %> In this case i can search by each item or all item in form. I hope that all member in rubyonrails-talk will help me to solve this problem for me. thank in advance! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Routing to different pages with Ajax login
When I try to add the form element in a partial: <%= f.hidden_field :profile_id, :value => profile_id %> I get an error that f is unknown. Is there a way to add form elements with a partial? On Mar 18, 4:10 pm, Frederick Cheung wrote: > On Mar 18, 10:29 pm, Dave L wrote:> Okay, thats what I was > going to do in the beginning, but the problem > > is how to define the variable for that if else statement. This is for > > a login, so for a certain page I was thinking about inserting a > > partial into the login popup form that would contain a hidden field of > > that id of the user that is being viewed. Then, in my authenticate > > action, I would check if there was a value in this field and if so, > > route to the users profiles whose id was in the hidden field and if > > there is no value, then just route to their profile. Does this work? > > Or is there a better way? > > Don't see why it wouldn't work. > > Fred > > > I also thought about using sessions to store the user id of the user > > who is being viewed, but i would have to clear this session if the > > popup was closed and not submitted, and im just not sure how to do > > that. > > > Thanks for your help. > > > On Mar 18, 3:07 pm, Frederick Cheung > > wrote: > > > > On Mar 18, 8:51 pm, Dave L wrote: > > > > > Yes, that is exactly what I was looking for. I am having some trouble > > > > calling this custom method within an ajax call though. I am able to > > > > call page.redirect_to user_path(user) but when I try the following: > > > > > respond_to do |format| > > > > format.js do > > > > render :update do |page| > > > > page.redirect_back_or_default(user_path > > > > (logged_in_user)) #redirect_to user_path(logged_in_user) works > > > > end > > > > end > > > > end > > > > > I get an error saying redirect_back_or_default is not defined. I have > > > > defined this within my LoginSystem module and have included this in > > > > the application file so it should be able to find it. Is there > > > > anything special I need to do to use it with RJS? > > > > You'd have to define it on the javascript generator object that gets > > > yielded to you. You're better off doing > > > > if ... > > > page.redirect_to ... > > > else > > > page.redirect_to ... > > > end > > > > > On Mar 16, 11:04 pm, saideep annadatha > > > > wrote: > > > > > > Hi, > > > > > > I think you are looking for something like this: > > > > > > By using the filters to check if the user is logged in or not and > > > > > showing > > > > > him the login partial. Now in the controller, if the user is > > > > > successfully > > > > > logged in try calling a method similar to the following: > > > > > > redirect_back_or_default('/') > > > > > > def redirect_back_or_default(default) > > > > > session[:return_to] ? redirect_to_url(session[:return_to]) : > > > > > redirect_to(default) > > > > > session[:return_to] = nil > > > > > end > > > > > > The above is extracted from the restful_authentication plugin. > > > > > There the url is getting stored in the session[:return_to] where the > > > > > user is > > > > > redirected once authenticated. > > > > > > Please correct me if wrong. > > > > > > -- > > > > > Thank You, > > > > > Saideep Annadatha > > > > > > On Mon, Mar 16, 2009 at 4:37 AM, David wrote: > > > > > > > I have a situation where I need my ajaxed login popup to route to a > > > > > > different page than the default route. Specifically this situation > > > > > > is > > > > > > if they are trying to message a user and are not signed in, I want > > > > > > to > > > > > > show the login, and then route them to the profile that they were > > > > > > viewing and not make them have to find it again. The way I was > > > > > > thinking about doing it is to use a partial to add a hidden field > > > > > > that > > > > > > would contain the id of the user that is being viewed and use this > > > > > > id > > > > > > to render that profile instead of routing to the logged in users > > > > > > profile. > > > > > > > The thing is that the partial is going to look the same as the > > > > > > regular > > > > > > which is not good DRY policy, but I dont know how else to get the > > > > > > user > > > > > > id for the hidden field into the login popup. Something like: > > > > > > > page.replace_html "login", :partial => 'layouts/ > > > > > > login_for_diff_route', :locals => {:profile_id => @profile_id} > > > > > > > I cant really think of any other way to do it. Looking for any > > > > > > suggestions/advice/insights. 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
[Rails] Re: newbie confused by div_for
Philip Hallstrom wrote: > On Mar 18, 2009, at 3:52 PM, Alex Chekholko wrote: > >> >> That doesn't work with error "undefined local variable or method >> `item'" >> >> How do I iterate over the items? > > > <% @player.items.each do |item| %> ><% div_for item do %> > <%= h item.name %> ><% end %> > <% end %> > Thanks, I get it now! -- 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: gem list and . ~/.profile
Jeff Schwab wrote: > elle wrote: >> >> On Mar 19, 9:45 am, Jeff Schwab wrote: >>> elle wrote: >>> On Mar 19, 9:27 am, Jeff Schwab wrote: > elle wrote: >> My ~/.profile has: > ... >> And my ~/.bash_profile has the following: > ... >> What rules should I add to it? and where do I add them? > You want either a .profile or a .bash_profile, not both. Once bash sees > the .bash_profile, it won't look for the .profile; that's why you're > having to source it manually. From bash(1): > When bash is invoked as an interactive login shell, or as a > non-inter- active shell with the --login option, it first > reads and executes com- mands from the file /etc/profile, > if that file exists. After reading that file, it looks for > ~/.bash_profile, ~/.bash_login, and ~/.profile, in that > order, and reads and executes commands from the first one > that exists and is readable. > I actually prefer just to have a .profile, but if you have to support > other sh-derivatives, .bash_profile lets you play it safe. Thank you for explaining. Just to verify that my path will be set correctly, I should change: PATH="/opt/subversion/bin:${PATH}" export PATH to PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/opt/ subversion/bin:${PATH}" export PATH is that correct? >>> No; there was no problem with what you had, just that you split it >>> across two or three files. You only should have exactly one of >>> .profile, .bash_profile, and .bash_login. >> >> Sorry to be difficult but I actually have all 3 files. >> Which should I delete? >> And then, what happens to the information within? > > Concatenate them. For example, something like: > > cp /dev/null profile > for f in ~/.profile ~/.bash_login ~/.bash_profile > do > mv $f orig$f > cat $f >> profile Whoops, you'd have to swap those lines. Warning: I haven't actually run this code. > done > mv profile ~/.profile --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: Missing readline
On Mar 18, 10:32 pm, Lee wrote: > I have installed Rails 2.2.2 on a Debian Lenny VPS and I am getting > the following error when trying to script/console. > > *** > > Loading development environment (Rails 2.2.2) > /usr/local/lib/ruby/1.8/irb/completion.rb:10:in `require': no such > file to load -- readline (LoadError) It's probably because you didn't have the development headers for readline. These are probably in a separate debian package (eg libreadline-dev or something like that). Once you've got that try building the readline extension again (cd to ruby source /ext/ readline, run ruby extconf.rb then the usual make && make install dance) Fred > > *** > > I have seen this error referred to in other posts but I am still > unsure how to install 'readline' on my system. > > fyi, I have compiled Ruby 1.8.7 from source and installed the Rails > 2.2.2 gem. > > 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: Routing to different pages with Ajax login
On Mar 18, 10:29 pm, Dave L wrote: > Okay, thats what I was going to do in the beginning, but the problem > is how to define the variable for that if else statement. This is for > a login, so for a certain page I was thinking about inserting a > partial into the login popup form that would contain a hidden field of > that id of the user that is being viewed. Then, in my authenticate > action, I would check if there was a value in this field and if so, > route to the users profiles whose id was in the hidden field and if > there is no value, then just route to their profile. Does this work? > Or is there a better way? > Don't see why it wouldn't work. Fred > I also thought about using sessions to store the user id of the user > who is being viewed, but i would have to clear this session if the > popup was closed and not submitted, and im just not sure how to do > that. > > Thanks for your help. > > On Mar 18, 3:07 pm, Frederick Cheung > wrote: > > > On Mar 18, 8:51 pm, Dave L wrote: > > > > Yes, that is exactly what I was looking for. I am having some trouble > > > calling this custom method within an ajax call though. I am able to > > > call page.redirect_to user_path(user) but when I try the following: > > > > respond_to do |format| > > > format.js do > > > render :update do |page| > > > page.redirect_back_or_default(user_path > > > (logged_in_user)) #redirect_to user_path(logged_in_user) works > > > end > > > end > > > end > > > > I get an error saying redirect_back_or_default is not defined. I have > > > defined this within my LoginSystem module and have included this in > > > the application file so it should be able to find it. Is there > > > anything special I need to do to use it with RJS? > > > You'd have to define it on the javascript generator object that gets > > yielded to you. You're better off doing > > > if ... > > page.redirect_to ... > > else > > page.redirect_to ... > > end > > > > On Mar 16, 11:04 pm, saideep annadatha > > > wrote: > > > > > Hi, > > > > > I think you are looking for something like this: > > > > > By using the filters to check if the user is logged in or not and > > > > showing > > > > him the login partial. Now in the controller, if the user is > > > > successfully > > > > logged in try calling a method similar to the following: > > > > > redirect_back_or_default('/') > > > > > def redirect_back_or_default(default) > > > > session[:return_to] ? redirect_to_url(session[:return_to]) : > > > > redirect_to(default) > > > > session[:return_to] = nil > > > > end > > > > > The above is extracted from the restful_authentication plugin. > > > > There the url is getting stored in the session[:return_to] where the > > > > user is > > > > redirected once authenticated. > > > > > Please correct me if wrong. > > > > > -- > > > > Thank You, > > > > Saideep Annadatha > > > > > On Mon, Mar 16, 2009 at 4:37 AM, David wrote: > > > > > > I have a situation where I need my ajaxed login popup to route to a > > > > > different page than the default route. Specifically this situation is > > > > > if they are trying to message a user and are not signed in, I want to > > > > > show the login, and then route them to the profile that they were > > > > > viewing and not make them have to find it again. The way I was > > > > > thinking about doing it is to use a partial to add a hidden field that > > > > > would contain the id of the user that is being viewed and use this id > > > > > to render that profile instead of routing to the logged in users > > > > > profile. > > > > > > The thing is that the partial is going to look the same as the regular > > > > > which is not good DRY policy, but I dont know how else to get the user > > > > > id for the hidden field into the login popup. Something like: > > > > > > page.replace_html "login", :partial => 'layouts/ > > > > > login_for_diff_route', :locals => {:profile_id => @profile_id} > > > > > > I cant really think of any other way to do it. Looking for any > > > > > suggestions/advice/insights. 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: gem list and . ~/.profile
elle wrote: > > > On Mar 19, 9:45 am, Jeff Schwab wrote: >> elle wrote: >> >>> On Mar 19, 9:27 am, Jeff Schwab wrote: elle wrote: > My ~/.profile has: ... > And my ~/.bash_profile has the following: ... > What rules should I add to it? and where do I add them? You want either a .profile or a .bash_profile, not both. Once bash sees the .bash_profile, it won't look for the .profile; that's why you're having to source it manually. From bash(1): When bash is invoked as an interactive login shell, or as a non-inter- active shell with the --login option, it first reads and executes com- mands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. I actually prefer just to have a .profile, but if you have to support other sh-derivatives, .bash_profile lets you play it safe. >>> Thank you for explaining. Just to verify that my path will be set >>> correctly, I should change: >>> PATH="/opt/subversion/bin:${PATH}" >>> export PATH >>> to >>> PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/opt/ >>> subversion/bin:${PATH}" >>> export PATH >>> is that correct? >> No; there was no problem with what you had, just that you split it >> across two or three files. You only should have exactly one of >> .profile, .bash_profile, and .bash_login. > > > Sorry to be difficult but I actually have all 3 files. > Which should I delete? > And then, what happens to the information within? Concatenate them. For example, something like: cp /dev/null profile for f in ~/.profile ~/.bash_login ~/.bash_profile do mv $f orig$f cat $f >> profile done mv profile ~/.profile --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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 confused by div_for
On Mar 18, 2009, at 3:52 PM, Alex Chekholko wrote: > > Hi, > > Absolute Rails beginner here. > > in app/views/players/show.html.rb: > > <%= render :partial => @player.items %> > > in app/views/items/_item.html.erb > > > <% div_for item do %> > > <%= h(item.name) %> > > <% end %> > > > > That works fine. I'm trying to get rid of the partial, so I do > something like: > > in app/views/players/show.html.rb > > > <% div_for @player.items do %> > > <%= h(item.name) %> > > <% end %> > > > That doesn't work with error "undefined local variable or method > `item'" > > How do I iterate over the items? <% @player.items.each do |item| %> <% div_for item do %> <%= h item.name %> <% end %> <% end %> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: gem list and . ~/.profile
On Mar 19, 9:45 am, Jeff Schwab wrote: > elle wrote: > > > On Mar 19, 9:27 am, Jeff Schwab wrote: > >> elle wrote: > >>> My ~/.profile has: > >> ... > > >>> And my ~/.bash_profile has the following: > >> ... > > >>> What rules should I add to it? and where do I add them? > >> You want either a .profile or a .bash_profile, not both. Once bash sees > >> the .bash_profile, it won't look for the .profile; that's why you're > >> having to source it manually. From bash(1): > > >> When bash is invoked as an interactive login shell, or as a > >> non-inter- active shell with the --login option, it first > >> reads and executes com- mands from the file /etc/profile, > >> if that file exists. After reading that file, it looks for > >> ~/.bash_profile, ~/.bash_login, and ~/.profile, in that > >> order, and reads and executes commands from the first one > >> that exists and is readable. > > >> I actually prefer just to have a .profile, but if you have to support > >> other sh-derivatives, .bash_profile lets you play it safe. > > > Thank you for explaining. Just to verify that my path will be set > > correctly, I should change: > > > PATH="/opt/subversion/bin:${PATH}" > > export PATH > > > to > > > PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/opt/ > > subversion/bin:${PATH}" > > export PATH > > > is that correct? > > No; there was no problem with what you had, just that you split it > across two or three files. You only should have exactly one of > .profile, .bash_profile, and .bash_login. Sorry, reread your post -- Just confused with an earlier sentence: >> You want either a .profile or a .bash_profile, not both. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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] newbie confused by div_for
Hi, Absolute Rails beginner here. in app/views/players/show.html.rb: <%= render :partial => @player.items %> in app/views/items/_item.html.erb <% div_for item do %> <%= h(item.name) %> <% end %> That works fine. I'm trying to get rid of the partial, so I do something like: in app/views/players/show.html.rb <% div_for @player.items do %> <%= h(item.name) %> <% end %> That doesn't work with error "undefined local variable or method `item'" How do I iterate over the items? >From script/console: >> player.items => [#, #] -- 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: gem list and . ~/.profile
On Mar 19, 9:45 am, Jeff Schwab wrote: > elle wrote: > > > On Mar 19, 9:27 am, Jeff Schwab wrote: > >> elle wrote: > >>> My ~/.profile has: > >> ... > > >>> And my ~/.bash_profile has the following: > >> ... > > >>> What rules should I add to it? and where do I add them? > >> You want either a .profile or a .bash_profile, not both. Once bash sees > >> the .bash_profile, it won't look for the .profile; that's why you're > >> having to source it manually. From bash(1): > > >> When bash is invoked as an interactive login shell, or as a > >> non-inter- active shell with the --login option, it first > >> reads and executes com- mands from the file /etc/profile, > >> if that file exists. After reading that file, it looks for > >> ~/.bash_profile, ~/.bash_login, and ~/.profile, in that > >> order, and reads and executes commands from the first one > >> that exists and is readable. > > >> I actually prefer just to have a .profile, but if you have to support > >> other sh-derivatives, .bash_profile lets you play it safe. > > > Thank you for explaining. Just to verify that my path will be set > > correctly, I should change: > > > PATH="/opt/subversion/bin:${PATH}" > > export PATH > > > to > > > PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/opt/ > > subversion/bin:${PATH}" > > export PATH > > > is that correct? > > No; there was no problem with what you had, just that you split it > across two or three files. You only should have exactly one of > .profile, .bash_profile, and .bash_login. Sorry to be difficult but I actually have all 3 files. Which should I delete? And then, what happens to the information within? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: undefined method `fixtures'
On Mar 18, 6:05 pm, Frederick Cheung wrote: > On Mar 18, 8:50 pm, Jeff Schwab wrote: > I've just installed restful_authentication, and generated: > > > script/generate authenticated user session > > > Now, if I try to run unit tests, I get the following error: > > > test/unit/user_test.rb:7:in `': undefined method > > `fixtures' for UserTest:Class (NoMethodError) > > what does that file look like ? It's the default test case generated by restful_authentication. Several other methods were missing, as well. The test class seems to use the wrong base class for some reason; I've just worked around it locally, and filed a ticket: http://rails_security.lighthouseapp.com/projects/15332/tickets/44-undefined-method-fixtures Thanks, though! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: gem list and . ~/.profile
elle wrote: > > > On Mar 19, 9:27 am, Jeff Schwab wrote: >> elle wrote: >>> My ~/.profile has: >> ... >> >>> And my ~/.bash_profile has the following: >> ... >> >>> What rules should I add to it? and where do I add them? >> You want either a .profile or a .bash_profile, not both. Once bash sees >> the .bash_profile, it won't look for the .profile; that's why you're >> having to source it manually. From bash(1): >> >> When bash is invoked as an interactive login shell, or as a >> non-inter- active shell with the --login option, it first >> reads and executes com- mands from the file /etc/profile, >> if that file exists. After reading that file, it looks for >> ~/.bash_profile, ~/.bash_login, and ~/.profile, in that >> order, and reads and executes commands from the first one >> that exists and is readable. >> >> I actually prefer just to have a .profile, but if you have to support >> other sh-derivatives, .bash_profile lets you play it safe. > > Thank you for explaining. Just to verify that my path will be set > correctly, I should change: > > PATH="/opt/subversion/bin:${PATH}" > export PATH > > to > > PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/opt/ > subversion/bin:${PATH}" > export PATH > > is that correct? No; there was no problem with what you had, just that you split it across two or three files. You only should have exactly one of .profile, .bash_profile, and .bash_login. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: gem list and . ~/.profile
On Mar 19, 9:29 am, Jeff Schwab wrote: > elle wrote: > >>> I am on OS 10.5.6 > > And my ~/.bash_profile has the following: > > for a in local $(ls /opt/ | grep -v local | grep -v gentoo); do > > You have an /opt/gentoo directory on Mac OS X? If you've got emerge > working, I'd love to know how. No /opt/gentoo directory. Only /opt/subversion and /opt/git Sorry --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: gem list and . ~/.profile
On Mar 19, 9:27 am, Jeff Schwab wrote: > elle wrote: > > My ~/.profile has: > > ... > > > And my ~/.bash_profile has the following: > > ... > > > What rules should I add to it? and where do I add them? > > You want either a .profile or a .bash_profile, not both. Once bash sees > the .bash_profile, it won't look for the .profile; that's why you're > having to source it manually. From bash(1): > > When bash is invoked as an interactive login shell, or as a > non-inter- active shell with the --login option, it first > reads and executes com- mands from the file /etc/profile, > if that file exists. After reading that file, it looks for > ~/.bash_profile, ~/.bash_login, and ~/.profile, in that > order, and reads and executes commands from the first one > that exists and is readable. > > I actually prefer just to have a .profile, but if you have to support > other sh-derivatives, .bash_profile lets you play it safe. Thank you for explaining. Just to verify that my path will be set correctly, I should change: PATH="/opt/subversion/bin:${PATH}" export PATH to PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/opt/ subversion/bin:${PATH}" export PATH is that correct? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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] Missing readline
I have installed Rails 2.2.2 on a Debian Lenny VPS and I am getting the following error when trying to script/console. *** Loading development environment (Rails 2.2.2) /usr/local/lib/ruby/1.8/irb/completion.rb:10:in `require': no such file to load -- readline (LoadError) *** I have seen this error referred to in other posts but I am still unsure how to install 'readline' on my system. fyi, I have compiled Ruby 1.8.7 from source and installed the Rails 2.2.2 gem. 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: Search Results into new table
> > Thanks for quick response > > How exactly do you do a checkbox with an id? > > <%= form.check_box :stock_id %>? ignore me ive sorted that, was looking at a wrong example -- 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: Routing to different pages with Ajax login
Okay, thats what I was going to do in the beginning, but the problem is how to define the variable for that if else statement. This is for a login, so for a certain page I was thinking about inserting a partial into the login popup form that would contain a hidden field of that id of the user that is being viewed. Then, in my authenticate action, I would check if there was a value in this field and if so, route to the users profiles whose id was in the hidden field and if there is no value, then just route to their profile. Does this work? Or is there a better way? I also thought about using sessions to store the user id of the user who is being viewed, but i would have to clear this session if the popup was closed and not submitted, and im just not sure how to do that. Thanks for your help. On Mar 18, 3:07 pm, Frederick Cheung wrote: > On Mar 18, 8:51 pm, Dave L wrote: > > > > > Yes, that is exactly what I was looking for. I am having some trouble > > calling this custom method within an ajax call though. I am able to > > call page.redirect_to user_path(user) but when I try the following: > > > respond_to do |format| > > format.js do > > render :update do |page| > > page.redirect_back_or_default(user_path > > (logged_in_user)) #redirect_to user_path(logged_in_user) works > > end > > end > > end > > > I get an error saying redirect_back_or_default is not defined. I have > > defined this within my LoginSystem module and have included this in > > the application file so it should be able to find it. Is there > > anything special I need to do to use it with RJS? > > You'd have to define it on the javascript generator object that gets > yielded to you. You're better off doing > > if ... > page.redirect_to ... > else > page.redirect_to ... > end > > > On Mar 16, 11:04 pm, saideep annadatha > > wrote: > > > > Hi, > > > > I think you are looking for something like this: > > > > By using the filters to check if the user is logged in or not and showing > > > him the login partial. Now in the controller, if the user is successfully > > > logged in try calling a method similar to the following: > > > > redirect_back_or_default('/') > > > > def redirect_back_or_default(default) > > > session[:return_to] ? redirect_to_url(session[:return_to]) : > > > redirect_to(default) > > > session[:return_to] = nil > > > end > > > > The above is extracted from the restful_authentication plugin. > > > There the url is getting stored in the session[:return_to] where the user > > > is > > > redirected once authenticated. > > > > Please correct me if wrong. > > > > -- > > > Thank You, > > > Saideep Annadatha > > > > On Mon, Mar 16, 2009 at 4:37 AM, David wrote: > > > > > I have a situation where I need my ajaxed login popup to route to a > > > > different page than the default route. Specifically this situation is > > > > if they are trying to message a user and are not signed in, I want to > > > > show the login, and then route them to the profile that they were > > > > viewing and not make them have to find it again. The way I was > > > > thinking about doing it is to use a partial to add a hidden field that > > > > would contain the id of the user that is being viewed and use this id > > > > to render that profile instead of routing to the logged in users > > > > profile. > > > > > The thing is that the partial is going to look the same as the regular > > > > which is not good DRY policy, but I dont know how else to get the user > > > > id for the hidden field into the login popup. Something like: > > > > > page.replace_html "login", :partial => 'layouts/ > > > > login_for_diff_route', :locals => {:profile_id => @profile_id} > > > > > I cant really think of any other way to do it. Looking for any > > > > suggestions/advice/insights. 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: gem list and . ~/.profile
elle wrote: >>> I am on OS 10.5.6 > And my ~/.bash_profile has the following: > for a in local $(ls /opt/ | grep -v local | grep -v gentoo); do You have an /opt/gentoo directory on Mac OS X? If you've got emerge working, I'd love to know how. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: gem list and . ~/.profile
elle wrote: > My ~/.profile has: ... > And my ~/.bash_profile has the following: ... > What rules should I add to it? and where do I add them? You want either a .profile or a .bash_profile, not both. Once bash sees the .bash_profile, it won't look for the .profile; that's why you're having to source it manually. From bash(1): When bash is invoked as an interactive login shell, or as a non-inter- active shell with the --login option, it first reads and executes com- mands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. I actually prefer just to have a .profile, but if you have to support other sh-derivatives, .bash_profile lets you play it safe. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: Search Results into new table
Nat wrote: > #Search stock view > <%form_tag(:action=>:search_stock) do%> > <%=submit_tag('Search")%> > <%end%> > > > #Search Stock Controller > def search_stock > @stocks = Stock.find_by_something() > render action=>:result_page > end > > > #Result Page > <%form_tag(:action=>:add_to_my_stocks) do %> > <%...@stocks.each do |stock|%> > #Create set of checkbox and use stock_id as id > <%end%> > <%end%> > > On Mar 18, 1:06�pm, Nick Hoyle Thanks for quick response How exactly do you do a checkbox with an id? <%= form.check_box :stock_id %>? -- 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: Who are the ROR guru's on this board ?
Frederick Cheung wrote: > On 17 Mar 2009, at 12:24, Phlip wrote: >> >> >> But seriously folks, the great thing about looking like a guru on >> this forum is >> you get to ignore questions you can't answer, and that makes you >> look good. When >> you sign up for a gig reviewing someone's server, you don't get that >> luxury... > > There's also a different knowledge set. THere's no guarantee that > people who know rails know the nitty gritty of load balancers, virtual > machines, SANs, etc. all of which are crucial ingredients in a good > hosting setup (I for one let the hosting people worry about that) > > Fred We would be looking for you to review rails from a performance standpoint in the viewpoint of a customer. We will worry about keeping the servers stable and running. -- 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] Version of SqlSessionStore for Rails 2.3
If you're using SqlSessionStore (originally from Stefan Kaes of railsexpress.de) and upgrade to Rails 2.3, it will break. I have a github version that I have updated for Rails 2.3, and also added a new "native columns" feature to. It is available here: http://github.com/nateware/sql_session_store/tree/master It is backwards-compatible with Rails 2.2 and earlier, so you should be able to update your application (probably worth backing up the old one just in case). Nate Wiger PlayStation --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: ActiveRecord and SOAP
I understand that ActiveRecord can't do this be default. But I need this to work, so I will have to modify default behaviour. Please suggest an appropriate route. Do I overwrite find method? do I use something else entirely? I need this to work dynamically. thanks On Mar 18, 3:10 pm, Frederick Cheung wrote: > On Mar 18, 8:42 pm, slava wrote: > > > I need to get some of the data for my models from SOAP based services > > and some from a rails db. I am relatively new to Rails and not sure > > how to do it right. > > > class Product < ActiveRecord::Base # products should be loaded > > through a soap service from a 3rd party system > > belongs_to :product_group # also loaded through a soap > > service > > belongs_to :product_location # this one is a local table > > end > > > Product.find(params[:id]) #should load data from both > > soap service and local db > > ActiveRecord can't do this. ActiveResource sort of does this for data > from appropriate RESTful apis, but it doesn't do associations. You'd > need to keep all of the data locally as far as I can tell. > > Fred > > > please suggest how this should be done. thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to 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 store account information separately and across multiple applications?
On Mar 18, 10:04 pm, ericindc wrote: > We are currently working on a solution to centralize our userbase. > The central userbase will contain primary account information that > will be extended on an application-specific basis. For instance, all > users of our applications will have the following: > > first_name > last_name > email > phone > ...etc... > > Application 'X', however, might extend this account information so > that it includes application_x_admin, application_x_group, etc. so > that these attributes are only available to Application 'X'. > Application 'Y' could similarly have added attributes or it could > simply utilize the defaults for our userbase. > > The questions follows -- How do we store account information separate > from application-specific user data and share that account information > across multiple applications? > > The solution needs to... > > --Store the account information in a separate database > --Avoid as much duplication as possible to avoid unnecessary > difficulty for modifications > --Easily allow a login, logout, authenticate ability from within an > application (registration, etc. will be in a separate application) > --Easy to retrieve/search the userbase from within applications, > including direct access to userbase attributes (first_name, etc.) and > find methods (find_by_first_name, etc.) When I've done this i've had a user class (whose attributes are login and any app specific attributes) and user_detail which contains shared info. The shared info is only changed in the user authentication app and it propagates that info to the other apps. Fred > > Any suggestions/guidance is 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: Who are the ROR guru's on this board ?
Phlip wrote: > "Wolas!" wrote: > >> my +1 goes to fred (cheung) > > He has a high volume on all the newb questions. > > Worse, I use GMane, so he reliably beats me to them! > > But seriously folks, the great thing about looking like a guru on this > forum is > you get to ignore questions you can't answer, and that makes you look > good. When > you sign up for a gig reviewing someone's server, you don't get that > luxury... This is a very good point, the word "guru" will vary greatly in the eyes of those titled as such. -- 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: ActiveRecord and SOAP
On Mar 18, 8:42 pm, slava wrote: > I need to get some of the data for my models from SOAP based services > and some from a rails db. I am relatively new to Rails and not sure > how to do it right. > > class Product < ActiveRecord::Base # products should be loaded > through a soap service from a 3rd party system > belongs_to :product_group # also loaded through a soap > service > belongs_to :product_location # this one is a local table > end > > Product.find(params[:id]) #should load data from both > soap service and local db > ActiveRecord can't do this. ActiveResource sort of does this for data from appropriate RESTful apis, but it doesn't do associations. You'd need to keep all of the data locally as far as I can tell. Fred > please suggest how this should be done. thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Simple auto-complete tutorial
I'm putting this here because it took too long to set up: == Things you'll need for auto_complete since everyone else was too lazy to write down: Example model is 'list' Example field is 'name' # Controller auto_complete_for :list, :name skip_before_filter :verify_authenticity_token, :only => [:auto_complete_for_list_name] # view (edit.html.erb) <%= javascript_include_tag :all, :cache => true %> <% form_for(@list) do |f| %> <%= f.error_messages %> New <%= f.label :name %>: <%= text_field_with_auto_complete :list, :name %> <%= f.submit "Update" %> <% end %> # layout <%= javascript_include_tag :defaults %> # routes.rb map.auto_complete ':controller/:action', :requirements => { :action => /auto_complete_for_\S+/ }, :conditions => { :method => :get } -- 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: Search Results into new table
#Search stock view <%form_tag(:action=>:search_stock) do%> <%=submit_tag('Search")%> <%end%> #Search Stock Controller def search_stock @stocks = Stock.find_by_something() render action=>:result_page end #Result Page <%form_tag(:action=>:add_to_my_stocks) do %> <%...@stocks.each do |stock|%> #Create set of checkbox and use stock_id as id <%end%> <%end%> On Mar 18, 1:06 pm, Nick Hoyle wrote: > I have a search form on my rails site. once the a user has entered a > query it displays the results in a table with an extra field button so > it can be added to there own portfolio called add to my stocks. > > How do i get the data for the stock they want to add and put this into a > new table called mystocks. > > Is using a form submit button the right choice? > > Any examples much appreciated > > Regards > > Nick > -- > 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: Routing to different pages with Ajax login
On Mar 18, 8:51 pm, Dave L wrote: > Yes, that is exactly what I was looking for. I am having some trouble > calling this custom method within an ajax call though. I am able to > call page.redirect_to user_path(user) but when I try the following: > > respond_to do |format| > format.js do > render :update do |page| > page.redirect_back_or_default(user_path > (logged_in_user)) #redirect_to user_path(logged_in_user) works > end > end > end > > I get an error saying redirect_back_or_default is not defined. I have > defined this within my LoginSystem module and have included this in > the application file so it should be able to find it. Is there > anything special I need to do to use it with RJS? > You'd have to define it on the javascript generator object that gets yielded to you. You're better off doing if ... page.redirect_to ... else page.redirect_to ... end > On Mar 16, 11:04 pm, saideep annadatha > wrote: > > > Hi, > > > I think you are looking for something like this: > > > By using the filters to check if the user is logged in or not and showing > > him the login partial. Now in the controller, if the user is successfully > > logged in try calling a method similar to the following: > > > redirect_back_or_default('/') > > > def redirect_back_or_default(default) > > session[:return_to] ? redirect_to_url(session[:return_to]) : > > redirect_to(default) > > session[:return_to] = nil > > end > > > The above is extracted from the restful_authentication plugin. > > There the url is getting stored in the session[:return_to] where the user is > > redirected once authenticated. > > > Please correct me if wrong. > > > -- > > Thank You, > > Saideep Annadatha > > > On Mon, Mar 16, 2009 at 4:37 AM, David wrote: > > > > I have a situation where I need my ajaxed login popup to route to a > > > different page than the default route. Specifically this situation is > > > if they are trying to message a user and are not signed in, I want to > > > show the login, and then route them to the profile that they were > > > viewing and not make them have to find it again. The way I was > > > thinking about doing it is to use a partial to add a hidden field that > > > would contain the id of the user that is being viewed and use this id > > > to render that profile instead of routing to the logged in users > > > profile. > > > > The thing is that the partial is going to look the same as the regular > > > which is not good DRY policy, but I dont know how else to get the user > > > id for the hidden field into the login popup. Something like: > > > > page.replace_html "login", :partial => 'layouts/ > > > login_for_diff_route', :locals => {:profile_id => @profile_id} > > > > I cant really think of any other way to do it. Looking for any > > > suggestions/advice/insights. 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: undefined method `fixtures'
On Mar 18, 8:50 pm, Jeff Schwab wrote: > I've just installed restful_authentication, and generated: > > script/generate authenticated user session > > Now, if I try to run unit tests, I get the following error: > > test/unit/user_test.rb:7:in `': undefined method > `fixtures' for UserTest:Class (NoMethodError) > what does that file look like ? Fred > Any help would be welcome. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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 store account information separately and across multiple applications?
We are currently working on a solution to centralize our userbase. The central userbase will contain primary account information that will be extended on an application-specific basis. For instance, all users of our applications will have the following: first_name last_name email phone ...etc... Application 'X', however, might extend this account information so that it includes application_x_admin, application_x_group, etc. so that these attributes are only available to Application 'X'. Application 'Y' could similarly have added attributes or it could simply utilize the defaults for our userbase. The questions follows -- How do we store account information separate from application-specific user data and share that account information across multiple applications? The solution needs to... --Store the account information in a separate database --Avoid as much duplication as possible to avoid unnecessary difficulty for modifications --Easily allow a login, logout, authenticate ability from within an application (registration, etc. will be in a separate application) --Easy to retrieve/search the userbase from within applications, including direct access to userbase attributes (first_name, etc.) and find methods (find_by_first_name, etc.) Any suggestions/guidance is 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: gem list and . ~/.profile
On Mar 19, 9:01 am, Jeff Schwab wrote: > elle wrote: > > Hello, > > > So, I have something happening that I don't understand. I am on OS > > 10.5.6 and followed Dan Benjamin's (Hivelogic) advice on how to > > install Ruby, MySQL As he suggests, I added . ~/.bash_login with > > the path for the MySQL installation. I also added . ~/.profile with > > the path for the Ruby installation. > > > Now, when I start Terminal and run: > > % ruby -v # -> version 1.8.6 > > % gem list # -> I get a list with various versions of active record, > > actionmailer, rake and... no mysql (2.7) gem > > > Then if I run: > > % . ~/.profile > > % ruby -v # -> version 1.8.7 > > % gem list # Get updated gem list including mysql gem > > > But if I close that terminal window and open a new one -- the above is > > reset. > > > Why does that happen? and how do I get the path to load automatically? > > Put the settings ~/.bash_profile My ~/.profile has: export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin: $PATH" And my ~/.bash_profile has the following: -- for a in local $(ls /opt/ | grep -v local | grep -v gentoo); do FULLPATH=/opt/$a if [ -x $FULLPATH ]; then if [ -x $FULLPATH/bin ]; then export PATH="$FULLPATH/bin:$PATH" fi if [ -x $FULLPATH/sbin ]; then export PATH="$FULLPATH/sbin:$PATH" fi if [ -x $FULLPATH/share/aclocal ]; then export ACLOCAL_FLAGS="-I $FULLPATH/share/aclocal $ACLOCAL_FLAGS" fi if [ -x $FULLPATH/man ]; then export MANPATH="$FULLPATH/man:$MANPATH" fi if [ -x $FULLPATH/share/man ]; then export MANPATH="$FULLPATH/share/man:$MANPATH" fi if [ -x $FULLPATH/lib/pkgconfig ]; then export PKG_CONFIG_PATH="$FULLPATH/lib/pkgconfig/: $PKG_CONFIG_PATH" fi fi done # Setting PATH for Subversion 1.5.1 binaries # The orginal version is saved in .bash_profile.svnsave PATH="/opt/subversion/bin:${PATH}" export PATH What rules should I add to it? and where do I add them? Elle --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Problem with paging and MS SQL
am trying to get the index page going on my table I am using a table on Micrsoft SQL Server, when showing a single row from the table it works OK. but when accessing the index I am gettingthe following error message ActiveRecord::ActiveRecordError: Incorrect syntax near '\.'.: SELECT * FROM (SELECT TOP 15 * FROM (SELECT TOP 15 sproclogs.* FROM sproclogs ORDER BY sproclogs.[id] ASC) AS tmp1 ORDER BY sproclogs\. \ [[id]\] DESC) AS tmp2 ORDER BY sproclogs\.\[[id]\] ASC The trace that I am getting is: :/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/connection_adapters/abstract_adapter.rb:188:in `log' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9/ lib/active_record/connection_adapters/jdbc_adapter.rb:581:in `execute' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9/ lib/active_record/connection_adapters/jdbc_adapter.rb:641:in `select' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9/ lib/active_record/connection_adapters/jdbc_adapter.rb:566:in `jdbc_select_all' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all_with_query_cache' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/connection_adapters/abstract/query_cache.rb:81:in `cache_sql' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all_with_query_cache' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/base.rb:635:in `find_by_sql' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/base.rb:1490:in `find_every' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/base.rb:589:in `find' vendor/plugins/active_scaffold/lib/active_scaffold/finder.rb:175:in `find_page' vendor/plugins/active_scaffold/lib/paginator.rb:66:in `call' vendor/plugins/active_scaffold/lib/paginator.rb:66:in `page' vendor/plugins/active_scaffold/lib/paginator.rb:93:in `call' vendor/plugins/active_scaffold/lib/paginator.rb:93:in `items' vendor/plugins/active_scaffold/lib/active_scaffold/actions/list.rb: 66:in `do_list' vendor/plugins/active_scaffold/lib/active_scaffold/actions/list.rb: 33:in `list' vendor/plugins/active_scaffold/lib/active_scaffold/actions/list.rb: 8:in `index' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/base.rb:1253:in `perform_action' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/filters.rb:617:in `call_filters' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/filters.rb:610:in `perform_action_with_filters' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/benchmarking.rb:68:in `perform_action_with_benchmark' C:/jruby-1.1.6/lib/ruby/1.8/benchmark.rb:293:in `measure' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/benchmarking.rb:68:in `perform_action_with_benchmark' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/rescue.rb:136:in `perform_action_with_rescue' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/caching/sql_cache.rb:13:in `perform_action_with_caching' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/connection_adapters/abstract/query_cache.rb:34:in `cache' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/query_cache.rb:8:in `cache' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/caching/sql_cache.rb:12:in `perform_action_with_caching' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/base.rb:524:in `process' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/filters.rb:606:in `process_with_filters' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/session_management.rb:134:in `process_with_session_management_support' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/base.rb:392:in `process' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/dispatcher.rb:183:in `handle_request' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/dispatcher.rb:110:in `dispatch_unlocked' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/dispatcher.rb:123:in `dispatch' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/dispatcher.rb:122:in `dispatch' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/dispatcher.rb:132:in `dispatch_cgi' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/dispatcher.rb:39:in `dispatch' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/ webrick_server.rb:103:in `handle_dispatch' C:/jruby-1.1.6/lib/ruby/gems/1.8/gems/rails-2.2.2/
[Rails] Re: gem list and . ~/.profile
elle wrote: > Hello, > > So, I have something happening that I don't understand. I am on OS > 10.5.6 and followed Dan Benjamin's (Hivelogic) advice on how to > install Ruby, MySQL As he suggests, I added . ~/.bash_login with > the path for the MySQL installation. I also added . ~/.profile with > the path for the Ruby installation. > > Now, when I start Terminal and run: > % ruby -v# -> version 1.8.6 > % gem list # -> I get a list with various versions of active record, > actionmailer, rake and... no mysql (2.7) gem > > Then if I run: > % . ~/.profile > % ruby -v # -> version 1.8.7 > % gem list# Get updated gem list including mysql gem > > But if I close that terminal window and open a new one -- the above is > reset. > > Why does that happen? and how do I get the path to load automatically? Put the settings ~/.bash_profile --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: attachmnet_fu can't keep original file image!
Just out of curiousity, add a :resize_to => '5000x5000>', before the thumbnails option. It *should* leave any image smaller than 5000x5000 alone. Obviously, this is an awfully ugly hack, but humor me, and see if the presence of the resize_to option makes a difference. I use ImageMagick and a has_attachment :content_type => ['image/jpeg', 'image/png'], :storage => :file_system, :max_size => 500.kilobytes, :resize_to => '1600x1200>', :thumbnails => { :thumb => '100x100>'} to resize any larger image to something that fits full screen on my monitor, and the file system has the original, and a thumbnail, both properly sized, even when the original is a 1024x768 image. Larger images get sized down to 1600x1200. -- 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] forcing delivery of plain text email when both plain text and html templates are present
I have a new user requirement that's causing a problem... I have a user notification for which I build both plaintext and html templates and rails takes care of assembling a multipart/alternative msg that contains both parts. All good. But, now some users with Blackberry's are complaining that they'd rather have just the text version. I thought their client would take care of displaying that, but perhaps they need to set something up and you can never really count on users to do so, so I'm looking at a new user pref to explicitly request plain text emails. The problem: Since I have both types of templates, I cant figure out how to only send the 'text/plain' one. I tried explicitly setting the content_type to this, but I still get the multipart/alternative result. Does anyone know how to force the content_type format sent in this situation? Note: I could set up a diff method in the mailer using a diff name where only the plain text template was present, but that would be kludgey and not very DRY. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: gem list and . ~/.profile
On Wed, Mar 18, 2009 at 4:47 PM, elle wrote: > > Hello, > > So, I have something happening that I don't understand. I am on OS > 10.5.6 and followed Dan Benjamin's (Hivelogic) advice on how to > install Ruby, MySQL As he suggests, I added . ~/.bash_login with > the path for the MySQL installation. I also added . ~/.profile with > the path for the Ruby installation. > > Now, when I start Terminal and run: > % ruby -v # -> version 1.8.6 > % gem list # -> I get a list with various versions of active record, > actionmailer, rake and... no mysql (2.7) gem > > Then if I run: > % . ~/.profile > % ruby -v # -> version 1.8.7 > % gem list # Get updated gem list including mysql gem > > But if I close that terminal window and open a new one -- the above is > reset. > > Why does that happen? and how do I get the path to load automatically? Try putting this stuff in a file called .bashrc. -- Greg Donald http://destiney.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] gem list and . ~/.profile
Hello, So, I have something happening that I don't understand. I am on OS 10.5.6 and followed Dan Benjamin's (Hivelogic) advice on how to install Ruby, MySQL As he suggests, I added . ~/.bash_login with the path for the MySQL installation. I also added . ~/.profile with the path for the Ruby installation. Now, when I start Terminal and run: % ruby -v# -> version 1.8.6 % gem list # -> I get a list with various versions of active record, actionmailer, rake and... no mysql (2.7) gem Then if I run: % . ~/.profile % ruby -v # -> version 1.8.7 % gem list# Get updated gem list including mysql gem But if I close that terminal window and open a new one -- the above is reset. Why does that happen? and how do I get the path to load automatically? Thanks, Elle --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: Whats the difference between "<%= abc %>" and "<%= abc -%>"
2009/3/18 Philip Hallstrom > > > snip.. > > Ah... the -%> is only "end of line". Didn't realize that. > > I just plugged this into 2.2.2: > > <%= "abc" %><%= "def" %> > <%= "ghi" %><%= "klm" %> > > > > <%= "abc" %><%= "def" -%> > <%= "ghi" %><%= "klm" %> > > And got back this: > > abcdef > ghiklm > > > > abcdefghiklm > > Which is what you should get, I tried exactly the same and got abcdef ghiklm abcdef ghiklm Which is not correct. Following a little head scratching I realised that that the erb file had windows line endings (\r\n) but I am now working on Ubuntu. I changed the line endings to Unix format and I got abcdefghiklm in the second case as expected. Is this a reportable bug? should the -%> not remove \r\n if present? Colin > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: Whats the difference between "<%= abc %>" and "<%= abc -%>"
On Wed, Mar 18, 2009 at 4:00 PM, Colin Law wrote: > 2009/3/18 Philip Hallstrom >> >> > What difference does the "-" at the end make? >> >> -%> eats the newline. >> >> .<%= abc %><%= xyz %>. will turn into >> >> .abc >> xyz >> . >> >> .<%= abc -%><%= xyz -%>. will turn into >> >> .abcxyz. > > According to Agile Development with Rails this is not quite correct. The - > is supposed to remove the newline _after_ the -%> > So > <%= "abc" %><%= "def" %> > <%= "ghi" %><%= "klm" %> > > will provide > > abcdef > ghijkl > > but > <%= "abc" %><%= "def" -%> > <%= "ghi" %><%= "klm" %> > > will provide > > abcdefghijkl > > However on testing this in Rails 2.2.2 and viewing the source of the page, I > am not seeing this. The - seems to make no difference, I see the two line > output in both cases. > > Can anyone elucidate? > > Colin Chances are your web server supports some sort of output compression, so all this doesn't really matter much. Surely you don't depend on newlines to properly display a page, right? -- Greg Donald http://destiney.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Whats the difference between "<%= abc %>" and "<%= abc -%>"
> 2009/3/18 Philip Hallstrom > >> >>> What difference does the "-" at the end make? >> >> -%> eats the newline. >> >> .<%= abc %><%= xyz %>. will turn into >> >> .abc >> xyz >> . >> >> .<%= abc -%><%= xyz -%>. will turn into >> >> .abcxyz. >> > > According to Agile Development with Rails this is not quite > correct. The - > is supposed to remove the newline _after_ the -%> > So > <%= "abc" %><%= "def" %> > <%= "ghi" %><%= "klm" %> > > will provide > > abcdef > ghijkl > > but > <%= "abc" %><%= "def" -%> > <%= "ghi" %><%= "klm" %> > > will provide > > abcdefghijkl > > However on testing this in Rails 2.2.2 and viewing the source of the > page, I > am not seeing this. The - seems to make no difference, I see the two > line > output in both cases. > > Can anyone elucidate? Ah... the -%> is only "end of line". Didn't realize that. I just plugged this into 2.2.2: <%= "abc" %><%= "def" %> <%= "ghi" %><%= "klm" %> <%= "abc" %><%= "def" -%> <%= "ghi" %><%= "klm" %> And got back this: abcdef ghiklm abcdefghiklm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: DEV Laptop : Ubuntu or Centos , Netbeans or Eclipse ?
+1 for Ubuntu. A friend of mine said he had a lot of trouble getting git installed on CentOS 5...I think he even gave up on it. +1 for RubyMine. I migrated from Aptana Studio to RubyMine and I think I'm sold. Aptana is just too bloated for my liking. RubyMine has great code validations and helpers. I've also briefly used Netbeans...I'd go back to it before Aptana. Also, you can try RubyMine for 90 days after installation...fyi. http://www.jetbrains.com/ruby/index.html -- 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: Flex and Rails - NoMethodError
It means you have a filter called require_ssl in your application. This kind of filter will usuallly either redirect or stop the current request if it is not made over ssl (e.g https://example.com) find the one in your app to see more. Either make the web request over ssl, or skip the filter if you don't need to use ssl. I'd recommend to use ssl if this is a request that is being authenticated in some way. Cheers, Jeremy On Mar 19, 2:36 am, Enzo Rivello wrote: > Enzo Rivello wrote: > > Little update: > > > in local i use mongrel, in production phusion passenger. > > > can it be a problem? > > problem understood!! > > the server calls two times the method, because the first is halted by > ssl_required > > Filter chain halted as [:ssl_required] rendered_or_redirected. > > someone know what this means? > -- > 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] 4 Rails apps using the same table. How to streamline?
Hi, I have 4 apps using similar User tables(3 open source projects and one in-house app). I'm trying to merge into one shared database User table (external to all 4 apps). -- I'm using the following code in the User model to switch to the shared database: class User < ActiveRecord::Base # GSL, 03/18/09 - Add reference to external ua database. User.establish_connection ( :adapter => "mysql", :host => "example.corp.example.com", :username => "root", :password => "?", :database => "ua_production" ) -- Then, I have to switch the other models back: class Attachment < ActiveRecord::Base # GSL, 03/18/09 - Add reference to external ua database. Attachment.establish_connection ( :adapter => "mysql", :host => "example.corp.example.com", :username => "root", :password => "?", :database => "redmine" ) -- I added the above to all the other models in my Redmine app. So, now the views that are trying to do a SQL JOIN are bombing. Is there an easier way? Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: rake db:test:purge , nil.object detected
Problem solved , it was problem in my database.yml file On 18 Mar, 21:45, Pietia wrote: > Hii have problem running rake db:test:purge ( my test database is > empty ) : adter running with trace it shouts : > > matthew:rails code pietia$ rake db:test:purge --trace > (in /Users/pietia/Documents/praca/projekty/silk/rails code) > ** Invoke db:test:purge (first_time) > ** Invoke environment (first_time) > ** Execute environment > ** Execute db:test:purge > rake aborted! > You have a nil object when you didn't expect it! > You might have expected an instance of ActiveRecord::Base. > The error occurred while evaluating nil.[] > /Users/pietia/Documents/praca/projekty/silk/rails code/vendor/rails/ > railties/lib/tasks/databases.rake:347 > /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:617:in `call' > /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:617:in > `execute' > /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:612:in `each' > /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:612:in > `execute' > /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:578:in > `invoke_with_call_chain' > /opt/local/lib/ruby/1.8/monitor.rb:242:in `synchronize' > /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:571:in > `invoke_with_call_chain' > /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:564:in > `invoke' > /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:2027:in > `invoke_task' > /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in > `top_level' > /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in `each' > /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in > `top_level' > /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in > `standard_exception_handling' > /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:1999:in > `top_level' > /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:1977:in `run' > /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in > `standard_exception_handling' > /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:1974:in `run' > /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/bin/rake:31 > /opt/local/bin/rake:19:in `load' > /opt/local/bin/rake:19 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: Whats the difference between "<%= abc %>" and "<%= abc -%>"
2009/3/18 Philip Hallstrom > > > What difference does the "-" at the end make? > > -%> eats the newline. > > .<%= abc %><%= xyz %>. will turn into > > .abc > xyz > . > > .<%= abc -%><%= xyz -%>. will turn into > > .abcxyz. > According to Agile Development with Rails this is not quite correct. The - is supposed to remove the newline _after_ the -%> So <%= "abc" %><%= "def" %> <%= "ghi" %><%= "klm" %> will provide abcdef ghijkl but <%= "abc" %><%= "def" -%> <%= "ghi" %><%= "klm" %> will provide abcdefghijkl However on testing this in Rails 2.2.2 and viewing the source of the page, I am not seeing this. The - seems to make no difference, I see the two line output in both cases. Can anyone elucidate? Colin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: Routing to different pages with Ajax login
Yes, that is exactly what I was looking for. I am having some trouble calling this custom method within an ajax call though. I am able to call page.redirect_to user_path(user) but when I try the following: respond_to do |format| format.js do render :update do |page| page.redirect_back_or_default(user_path (logged_in_user)) #redirect_to user_path(logged_in_user) works end end end I get an error saying redirect_back_or_default is not defined. I have defined this within my LoginSystem module and have included this in the application file so it should be able to find it. Is there anything special I need to do to use it with RJS? On Mar 16, 11:04 pm, saideep annadatha wrote: > Hi, > > I think you are looking for something like this: > > By using the filters to check if the user is logged in or not and showing > him the login partial. Now in the controller, if the user is successfully > logged in try calling a method similar to the following: > > redirect_back_or_default('/') > > def redirect_back_or_default(default) > session[:return_to] ? redirect_to_url(session[:return_to]) : > redirect_to(default) > session[:return_to] = nil > end > > The above is extracted from the restful_authentication plugin. > There the url is getting stored in the session[:return_to] where the user is > redirected once authenticated. > > Please correct me if wrong. > > -- > Thank You, > Saideep Annadatha > > On Mon, Mar 16, 2009 at 4:37 AM, David wrote: > > > I have a situation where I need my ajaxed login popup to route to a > > different page than the default route. Specifically this situation is > > if they are trying to message a user and are not signed in, I want to > > show the login, and then route them to the profile that they were > > viewing and not make them have to find it again. The way I was > > thinking about doing it is to use a partial to add a hidden field that > > would contain the id of the user that is being viewed and use this id > > to render that profile instead of routing to the logged in users > > profile. > > > The thing is that the partial is going to look the same as the regular > > which is not good DRY policy, but I dont know how else to get the user > > id for the hidden field into the login popup. Something like: > > > page.replace_html "login", :partial => 'layouts/ > > login_for_diff_route', :locals => {:profile_id => @profile_id} > > > I cant really think of any other way to do it. Looking for any > > suggestions/advice/insights. 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] undefined method `fixtures'
I've just installed restful_authentication, and generated: script/generate authenticated user session Now, if I try to run unit tests, I get the following error: test/unit/user_test.rb:7:in `': undefined method `fixtures' for UserTest:Class (NoMethodError) Any help would be welcome. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: Disabel "pluralize_table_names" in Rails 2.3.2
On Mar 18, 5:53 pm, Matt Jones wrote: > It hasn't changed in 2.3 - what problem are you experiencing? > Here's my guess: it's being set at the bottom of environment.rb which worked < 2.2 but doesn't work in 2.2 and above in production because app are classes are loaded before that. Fred > --Matt Jones > > On Mar 18, 2:30 am, Fresh Mix > wrote: > > > Fresh Mix wrote: > > > What is it in Rails 2.3.2? > > > > ActiveRecord::Base.pluralize_table_names = false > > > 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] rake db:test:purge , nil.object detected
Hii have problem running rake db:test:purge ( my test database is empty ) : adter running with trace it shouts : matthew:rails code pietia$ rake db:test:purge --trace (in /Users/pietia/Documents/praca/projekty/silk/rails code) ** Invoke db:test:purge (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:test:purge rake aborted! You have a nil object when you didn't expect it! You might have expected an instance of ActiveRecord::Base. The error occurred while evaluating nil.[] /Users/pietia/Documents/praca/projekty/silk/rails code/vendor/rails/ railties/lib/tasks/databases.rake:347 /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:617:in `call' /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:617:in `execute' /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:612:in `each' /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:612:in `execute' /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:578:in `invoke_with_call_chain' /opt/local/lib/ruby/1.8/monitor.rb:242:in `synchronize' /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:571:in `invoke_with_call_chain' /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:564:in `invoke' /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:2027:in `invoke_task' /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in `top_level' /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in `each' /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in `top_level' /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in `standard_exception_handling' /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:1999:in `top_level' /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:1977:in `run' /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in `standard_exception_handling' /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake.rb:1974:in `run' /Users/pietia/.gem/ruby/1.8/gems/rake-0.8.4/bin/rake:31 /opt/local/bin/rake:19:in `load' /opt/local/bin/rake:19 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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] attachmnet_fu can't keep original file image!
I am currently trying to create an application on RoR and I am using attachmne_fu plugin in order to handle image uploads. I have also install ImageScience to create some thumbnails for the images I upload The problem is that I can upload images, but it resizes the original image to the thumbnail version. I don't know why. For example if I upload an image say IMG_2455.jpg, in the directory /0002 I have 2 files: a) IMG_2455.jpg b) IMG_2455_thumb.jpg but the original image is also resized! so i have two images of 125x83 dimensions. How can I keep the original image plus the thumbnail version ? Here is my code in my model class Photo < ActiveRecord::Base belongs_to :user has_attachment :content_type => :image, :storage => :file_system, :size => 1.byte..12.megabytes, :thumbnails => { :thumb => '125x83>' }, :path_prefix => "/public/photos/" validates_as_attachment end Any suggestions ?? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] ActiveRecord and SOAP
I need to get some of the data for my models from SOAP based services and some from a rails db. I am relatively new to Rails and not sure how to do it right. class Product < ActiveRecord::Base # products should be loaded through a soap service from a 3rd party system belongs_to :product_group # also loaded through a soap service belongs_to :product_location # this one is a local table end Product.find(params[:id]) #should load data from both soap service and local db please suggest how this should be done. thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: validates_presence_of
Hi Thank you, that worked On Mar 18, 1:20 pm, Andrew Timberlake wrote: > On Tue, Mar 17, 2009 at 11:09 PM, Shuaib85 wrote: > > > Hi all > > > I want to check the presence of either one of two fields for instance, > > phone number or mobile number, if either one presents, allow the > > submission of the form > > > validates_presence_of :phone, OR :mobile > > > any idea how to do it > > def validate > errors.add(:phone, "can't be blank") if phone.blank? && mobile.blank? > errors.add(:mobile, "can't be blank") if phone.blank? && mobile.blank? > end > > or some variation of the above > > Andrew > Timberlakehttp://ramblingsonrails.comhttp://www.linkedin.com/in/andrewtimberlake > > "I have never let my schooling interfere with my education" - Mark Twain --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: HABTM and radio_button
Just another question that may help me better understand habtm workings... Would it be true that in order to create a fully functional habtm record that both models using the habtm assoc. need to be updated and saved? Or is it possible to do having a fully working relationship by saving only one of the two? Thanks On Mar 18, 10:04 am, elliottg wrote: > Thanks for the input. That does prevent the error but it does not > actually update the roles_users join table that is a part of the habtm > association between User and Role. > > I just tried this code within Create and it seems to work:... > �...@user = User.new(params[:user]) > �...@user.roles.build(params[:role]) > > However, I have a question still. I was assuming that the Roles table > would not actually have a new record added when saving an habtm assoc. > model. I assumed only the join table and the Users table would be > updated. Otherwise it seems as though I would have a lot of redundant > data in my Roles table. Am I misunderstanding something here? > > Thanks heaps > > On Mar 18, 9:30 am, "ruby...@ymail.com" wrote: > > > On 18 Mar., 14:20,elliottg wrote: > > > > When I implement this line: > > > �...@user = User.new(params[:user], :role => [ Role.new(params[:role]) ]) > > > > I get this argument error. > > > ArgumentError in UsersController#create > > > wrong number of arguments (2 for 1) > > > > Any thoughts? > > > > Thanks > > > The #new method only accepts one argument. Do this instead: > > > @user = User.new(params[:user].merge(:role => Role.new(params > > [:role]))) > > > -- > > Cheers, > > David Knorrhttp://twitter.com/rubyguy > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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] Search Results into new table
I have a search form on my rails site. once the a user has entered a query it displays the results in a table with an extra field button so it can be added to there own portfolio called add to my stocks. How do i get the data for the stock they want to add and put this into a new table called mystocks. Is using a form submit button the right choice? Any examples much appreciated Regards Nick -- 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: Simple Question: How do I install Authlogic w/o git?
Why not install it as a gem? gem install authlogic -- 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] Help! RubyGems is broken!
I have a problem with RubyGems: ruby gt.rb ruby: no such file to load -- ubygems (LoadError) Here are my compiler and gem versions: ruby --version ruby 1.8.7p5000 (2009-03-03 revision 22728) [x86_64-linux] <> gem --version 1.3.1 <> When I built rubygems, I saw a reference to 'ubygems', but it looked like a typo. The source program has a "require 'rubygems' " line, and my profile file has a "RUBYOPT=rubygems" environment variable set. I am at a loss to determine what is causing this. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: changin var from partial
Fred, this milliseconds idea is just great! I think I can make it work this way. thank your very much! Luciano On Mar 18, 3:43 pm, Frederick Cheung wrote: > On Mar 18, 6:14 pm, Luciano wrote:> Hi Fred, > > > thanks for your advice! > > > Do you believe link_to_remote would be the solution here? > > link_to_remote is a possibility, although you'd have to pass some > parameter in to let it know what id it should generate. This sort of > thing can get quite messy - you might find the nicest way out would > involve writing client side code that would gsub the generated html to > stick in an appropriate id (since it's easy for the client side code > to test whether a dom element with a given id already exists) or to > just always generate a unique id (eg based on the current time in > milliseconds) > > Fred > > > Luciano > > > On Mar 18, 2:28 pm, Frederick Cheung > > wrote: > > > > On Mar 18, 5:14 pm, Luciano wrote:> Hello, > > > > > I have a simple link_to_function to add a group of form fiels, to use > > > > observe_field I must have unique names... > > > > > I created a var to store the itens count but the partial is not > > > > updating it's value. > > > > I think there's two things happening here. My understanding of the > > > matter is that when a template is rendered it will get a copy of the > > > controllers instance variables. Changes it makes to those instance > > > won't persist though (the next template rendered will get a fresh copy > > > of those instance variables). > > > > However I think you're actually falling down another whole: you're > > > expecting each click on the add product link to re-evaluate the > > > template. This cannot happen: link_to_function produces entirely > > > client side javascript: your _quote_product.html.erb is only rendered > > > once. If you look at the html source of your page you'll see than > > > rendered html as a literal inside a blob of javascript. > > > > 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] Where to put test/mocks/development?
According to the Rails 2.1 changeset, creating mock objects for use in test and development environments is 'antiquated'. If that's so, where should you put them? I'm upgrading an app from 2.0.5 to 2.1.0 and we have mocked some objects which make external calls. The mocks for those objects live in 'test/mocks/development' and 'test/mocks/test'. Where should they go, if not there? I find that those directories don't get loaded when I use gem dependencies with "config.gem" in my environment.rb. If I remove the config.gem statements, they DO get loaded. I'd love to use the dependencies, but how do I load my mocks? Thanks, Isaac --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: RESTful routing in 2.3 breaks
I am seeing this as well. Only causes problems with xml and xhr requests. Passing the _method=put on a http request works as expected. See this ticket for how you can verify the problem. I haven't come up with a solution yet. http://rails.lighthouseapp.com/projects/8994/tickets/2289-_methodput-ignored-for-xhr-and-xml-requests On 17 Mar, 07:02, "ruby.freeman" wrote: > no, sorry. it still doesn't work --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: Extracting just the text of an ActionMailer receive e-mail
> Unfortunately my Googling skills have failed me. I'm looking for > something that will help me quickly parse through the body of a > message received by my ActionMailer based code. Here's the issue: If > someone sends an e-mail to an address that I am reading the body of > the message will often contain two parts: a text version of the > message and/or an HTML version of the message. > > I know there are MIME parsing and multi-part issues here, I'm just > looking for a super simple routine that will grab a single text based > version of the message body so that I can store it in my DB. Any > hints, recommendations or links I should be following? I haven't done it in Ruby yet, but my advice would be to go find that MIME parsing library and use it. Then it becomes a simple matter of looping through the body parts until you find one that is plain 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: changin var from partial
On Mar 18, 6:14 pm, Luciano wrote: > Hi Fred, > > thanks for your advice! > > Do you believe link_to_remote would be the solution here? > link_to_remote is a possibility, although you'd have to pass some parameter in to let it know what id it should generate. This sort of thing can get quite messy - you might find the nicest way out would involve writing client side code that would gsub the generated html to stick in an appropriate id (since it's easy for the client side code to test whether a dom element with a given id already exists) or to just always generate a unique id (eg based on the current time in milliseconds) Fred > Luciano > > On Mar 18, 2:28 pm, Frederick Cheung > wrote: > > > On Mar 18, 5:14 pm, Luciano wrote:> Hello, > > > > I have a simple link_to_function to add a group of form fiels, to use > > > observe_field I must have unique names... > > > > I created a var to store the itens count but the partial is not > > > updating it's value. > > > I think there's two things happening here. My understanding of the > > matter is that when a template is rendered it will get a copy of the > > controllers instance variables. Changes it makes to those instance > > won't persist though (the next template rendered will get a fresh copy > > of those instance variables). > > > However I think you're actually falling down another whole: you're > > expecting each click on the add product link to re-evaluate the > > template. This cannot happen: link_to_function produces entirely > > client side javascript: your _quote_product.html.erb is only rendered > > once. If you look at the html source of your page you'll see than > > rendered html as a literal inside a blob of javascript. > > > 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] Extracting just the text of an ActionMailer receive e-mail
Unfortunately my Googling skills have failed me. I'm looking for something that will help me quickly parse through the body of a message received by my ActionMailer based code. Here's the issue: If someone sends an e-mail to an address that I am reading the body of the message will often contain two parts: a text version of the message and/or an HTML version of the message. I know there are MIME parsing and multi-part issues here, I'm just looking for a super simple routine that will grab a single text based version of the message body so that I can store it in my DB. Any hints, recommendations or links I should be following? Thanks in advance! --David --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-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] uninitialized constant AuthenticatedSystem
I've just had a little snafu installing restful_authentication in a new app, and thought I would list it here for archival purposes. Firstly, there are messages about files not existing. My fix was to manually create lib and test/fixtures directories. (Remember, this is a brand new application.) Secondly, There were "uninitialized constant" messages re. AuthenticatedSystem. My fix was to add "require 'authenticated_system'" to the file where AuthenticatedSystem was included. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: Issues with database/object caching and testing
On Mar 18, 3:48 am, Ricky Barnaby wrote: > Hi all, > > I just burned two hours of development time trying to debug this issue. > Can someone please tell me if there is a way to disable database caching > when running unit tests or another way to avoid running into this type > of problem?? > > This does not work: > assert periods(:period1).ongoing? # Asserts true > plays(:end_of_first_half).process # Ends the period > assert !periods(:period1).ongoing? # Asserts false > > This DOES work: > assert periods(:period1).ongoing? # Asserts true > plays(:end_of_first_half).process # Ends the period > assert !Period.find(periods(:period1).id).ongoing? # Asserts true > I don't know exactly what this code is doing, but activerecord does cache associations and so on (and fixtures are only loaded once per test when you do periods(:period1). There's no easy way to disable this, periods(:period1).reload.ongoing? is a little less ugly than other alternatives. Fred > I've only just now run into this issue after dozens of tests. Am I > missing something obvious about expected behavior? > -- > 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: ActionMailer works for gmail/yahoo, but not for other email addresses...HELP!
help! anyone? On Mar 17, 12:50 pm, tony wrote: > I have a rails app that can send emails to gmail, yahoo accounts. But > when it comes to more obscure accounts like em...@my-app.com or > em...@blah.edu, the mail never arrives even though the log shows that > the email was sent. Any ideas why this may be happening? > > I have sent an email directly through the same web server through the > command line using > > mail -s and that worked. Why doesn't it work through my rails app? > > here are my configuration settings (mostly default) > > # Disable delivery errors, bad email addresses will be ignored > config.action_mailer.delivery_method = :smtp > config.action_mailer.raise_delivery_errors = true > config.action_mailer.perform_deliveries = true > config.action_mailer.default_charset = "utf-8" > > config.action_mailer.smtp_settings = { > :address => "localhost", > :port => 25, > :domain => "my-app.com" > } > > help please! > > thanks > Tony --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Problem when trying to freeze gem (XP user)
I guess I am running 1.3.1. I thought I was running 2.2.2 On Mar 18, 12:16 pm, Matt Jones wrote: > On Mar 17, 10:35 am, sultan wrote: > > > > > I am on XP. This is the first time I am trying to freeze to a gem. > > This is what I get: > > > rake rails:freeze:gems --trace > > (in C:/Documents and Settings/Sultan/My Documents/Aptana Studio/ > > upload) > > ** Invoke rails:freeze:gems (first_time) > > ** Execute rails:freeze:gems > > Freezing to the gems for Rails 2.2.2 > > rm -rf vendor/rails > > mkdir -p vendor/rails > > cd vendor/rails > > Unpacked gem: 'C:/Documents and Settings/Sultan/My Documents/Aptana > > Studio/upload/vendor/rails/activesupport-2.2.2'mv activesupport-2.2.2 > > activesupport > > > rm -rf vendor/rails > > rake aborted! > > Permission denied - activesupport-2.2.2 or activesupport > > If you manually unpack the activesupport-2.2.2 gem, can you rename the > directory it creates? Try this at the command line: > > gem unpack activesupport --version '= 2.2.2' > mv activesupport-2.2.2 activesupport > > Also, for reference, what version of Rubygems are you running (do a > 'gem --version')? > > CC me directly for quicker replies. > > --Matt Jones --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: why does this happen...
RAFB apparently drops files after 24 hours - any chance you could put those examples up someplace (gist or pastie, for instance) with a little more persistence? Without seeing the code, it's hard to even guess what's going on. But I seem to recall seeing similar behavior when I had code saving an associated record in before_save, which then got picked up again by the association save callbacks. --Matt Jones On Mar 17, 10:18 am, ball wrote: > Thanks. I am sure it is something I am missing. I am trying to learn > about SQL and Rails. > Here is the script I am using. I am really just trying to create a > script that explores all of the database relationships and how to > implement them in Rails. > > The code:http://rafb.net/p/iUgqjX46.html > > The output and SQL:http://rafb.net/p/tpvlVc44.html > > On Mar 17, 2:48 am, "\"Wolas!\"" wrote: > > > I replicated 2 scenareos and neither of them do what you have > > described: > > > has and belongs to many scenario > > > == models > > > class Product > > has_and_belongs_to_many :categories > > end > > > class Category > > has_and_belongs_to_many :products > > end > > > == db > > > create_table "categories", :force => true do |t| > > t.string "name" > > end > > > create_table "categories_products", :id => false, :force => true do | > > t| > > t.integer "product_id" > > t.integer "category_id" > > end > > > create_table "products", :force => true do |t| > > t.string "name" > > t.integer "price" > > end > > > == test > > > >> p = Product.new :name => "cool bike", :price => 123 > > > => #>> p.categories << c > > > => [#]>> p.save > > => true > > >> p.categories > > > => [#] > > > Same thing with has_many :through. which leads me to believe you > > havent set your relationships right. Could you show us the mdoel and > > table code plz? > > > On Mar 17, 5:11 am, ball wrote: > > > > It didn't exist before hand. ActiveRecord is triggering two inserts. I > > > have included a full example and the SQL > > > > catBike = Category.new(:name => "Bikes") > > > catBike.save > > > > p = Product.new(:name => "Cannondale Bike", :price => 1000) > > > p.save > > > p.categories << catBike # This works great. > > > > p = Product.new(:name => "Trek Bike", :price => 900) > > > p.categories << catBike # this causes two entriens to be created > > > p.save > > > > Category Create (1.0ms) INSERT INTO `categories` (`name`) VALUES > > > ('Bikes') > > > Product Create (0.0ms) INSERT INTO `products` (`name`, `price`) > > > VALUES('Cannondale Bike', 1000) > > > SQL (0.0ms) COMMIT > > > SQL (0.0ms) BEGIN > > > categories_products Columns (10.0ms) SHOW FIELDS FROM > > > `categories_products` > > > SQL (1.0ms) INSERT INTO `categories_products` (`product_id`, > > > `category_id`) VALUES (1, 1) > > > SQL (0.0ms) COMMIT > > > SQL (0.0ms) BEGIN > > > SQL (0.0ms) COMMIT > > > SQL (0.0ms) BEGIN > > > Product Create (1.0ms) INSERT INTO `products` (`name`, `price`) > > > VALUES('Trek Bike', 900) > > > categories_products Columns (7.0ms) SHOW FIELDS FROM > > > `categories_products` > > > SQL (1.0ms) INSERT INTO `categories_products` (`product_id`, > > > `category_id`) VALUES (2, 1) > > > categories_products Columns (7.0ms) SHOW FIELDS FROM > > > `categories_products` > > > SQL (0.0ms) INSERT INTO `categories_products` (`product_id`, > > > `category_id`) VALUES (2, 1) > > > SQL (0.0ms) COMMIT > > > > On Mar 16, 4:50 pm, Phlip wrote: > > > > > > p.categories now has TWO catBike > > > > > Because << does not ask questions. It just adds a catBike. If you > > > > already had > > > > one, now you have two. > > > > > You might need some combination of these: > > > > > a :unique => true on the habtm (spelling?) > > > > a unique key (index) on the database --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Problem when trying to freeze gem (XP user)
On Mar 17, 10:35 am, sultan wrote: > I am on XP. This is the first time I am trying to freeze to a gem. > This is what I get: > > rake rails:freeze:gems --trace > (in C:/Documents and Settings/Sultan/My Documents/Aptana Studio/ > upload) > ** Invoke rails:freeze:gems (first_time) > ** Execute rails:freeze:gems > Freezing to the gems for Rails 2.2.2 > rm -rf vendor/rails > mkdir -p vendor/rails > cd vendor/rails > Unpacked gem: 'C:/Documents and Settings/Sultan/My Documents/Aptana > Studio/upload/vendor/rails/activesupport-2.2.2'mv activesupport-2.2.2 > activesupport > > rm -rf vendor/rails > rake aborted! > Permission denied - activesupport-2.2.2 or activesupport If you manually unpack the activesupport-2.2.2 gem, can you rename the directory it creates? Try this at the command line: gem unpack activesupport --version '= 2.2.2' mv activesupport-2.2.2 activesupport Also, for reference, what version of Rubygems are you running (do a 'gem --version')? CC me directly for quicker replies. --Matt Jones --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: changin var from partial
Hi Fred, thanks for your advice! Do you believe link_to_remote would be the solution here? Luciano On Mar 18, 2:28 pm, Frederick Cheung wrote: > On Mar 18, 5:14 pm, Luciano wrote:> Hello, > > > I have a simple link_to_function to add a group of form fiels, to use > > observe_field I must have unique names... > > > I created a var to store the itens count but the partial is not > > updating it's value. > > I think there's two things happening here. My understanding of the > matter is that when a template is rendered it will get a copy of the > controllers instance variables. Changes it makes to those instance > won't persist though (the next template rendered will get a fresh copy > of those instance variables). > > However I think you're actually falling down another whole: you're > expecting each click on the add product link to re-evaluate the > template. This cannot happen: link_to_function produces entirely > client side javascript: your _quote_product.html.erb is only rendered > once. If you look at the html source of your page you'll see than > rendered html as a literal inside a blob of javascript. > > Fred --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Issues with database/object caching and testing
Ricky Barnaby wrote: > Hi all, > > I just burned two hours of development time trying to debug this issue. > Can someone please tell me if there is a way to disable database caching > when running unit tests or another way to avoid running into this type > of problem?? > > This does not work: > assert periods(:period1).ongoing? # Asserts true > plays(:end_of_first_half).process # Ends the period > assert !periods(:period1).ongoing? # Asserts false > > This DOES work: > assert periods(:period1).ongoing? # Asserts true > plays(:end_of_first_half).process # Ends the period > assert !Period.find(periods(:period1).id).ongoing? # Asserts true > > I've only just now run into this issue after dozens of tests. Am I > missing something obvious about expected behavior? I have run into this same problem, but don't understand it either. To be safe, I always do a find on the object first, but wish I had a more reliable solution to this as well. I too have wasted lots of debugging time only to find it was just an issue with my test 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 -~--~~~~--~~--~--~---
OT Re: [Rails] Web Designer — The International
Have you thought about using something like http://www.crowdspring.com/ or its alternatives? dwh Alexandre R. Labrie wrote: > The International is a not-for-profit newspaper. Our activities focus > on the development and expansion of peace journalism. > > We are helping our readers to develop a better understanding of > cultural differences, of the different perspectives on current issues > and conflicts, and of how people are affected by them. We report on > the events in the same manner, no matter where they occur, and we > focus on proposals to conflict resolution. > > We are currently looking for a web designer. We want to rebuild our > website, and here are its requirements: > > ... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby 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: Has many association problem
You didn't say if it exists, but I'm guessing that there's an 'encounter group' table associated to that number (9). In which case, what you're looking at is a has_many :through relation. (code example simplified - fix up with modules, etc as your app needs) class Patient < ActiveRecord::Base # has field pat_encounter_group belongs_to :encounter_group, :foreign_key => 'pat_encounter_group' has_many :requests, :through => :encounter_group end class EncounterGroup < ActiveRecord::Base has_many :patients, :foreign_key => 'pat_encounter_group' has_many :requests, :foreign_key => 'req_encounter_group' end class Request < ActiveRecord::Base belongs_to :encounter_group, :foreign_key => 'req_encounter_group' has_many :patients, :through => :encounter_group end [Note: I haven't tried this code, but it should work according to the documentation] On the other hand, the code you've got below should, in principle, also work. How exactly did it "fail"? --Matt Jones On Mar 17, 6:07 am, Valentino Lun wrote: > Dear all > > I have the following 2 models, with 2 difference data sources. I would > like to create a has_many relation to SX1::Request > > pat = SX9::Patient.find("123456789") > > >> pat.pat_encounter_group > > => 9 > > By default, rails will use the PK(Primary Key) of SX9::Patient then pass > to SX1::Request. e.g. > > SELECT * FROM request WHERE (request.req_encounter_group = "123456789") > > What I am expected is to override the primary_key in SX9::Patient > has_many relation with :primary_key => "pat_encounter_group". i.e. > > SELECT * FROM request WHERE (request.req_encounter_group = 9) > > But I failed to do... > > Luckily, I can achieve this by defining a instance method. e.g. > def find_request_by_pat_encounter_group > SX1::Request.find_all_by_req_encounter_group(self.pat_encounter_group) > end > > My question, is it possible to do this in has_many relationship? Thank > you. > > module SX9 > class Patient < RemoteSX9Model > set_table_name "patient" > set_primary_key "pat_encounter" > > # I tried this but failed > has_many :requests, :class_name => "SX1::Request", :primary_key => > "pat_encounter_group", :foreign_key => "req_encounter_group" > end > end > > module SX1 > class Request < RemoteSX1Model > set_table_name "request" > set_primary_key "req_reqno" > end > end > > Thank you very much > Valentino > -- > 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: Rails Query within Query
Hi Fred, Thanks for your response -- Your second example is exactly what I needed. The final example, though -- why do you use :joins instead of :include? -- 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: Disabel "pluralize_table_names" in Rails 2.3.2
It hasn't changed in 2.3 - what problem are you experiencing? --Matt Jones On Mar 18, 2:30 am, Fresh Mix wrote: > Fresh Mix wrote: > > What is it in Rails 2.3.2? > > > ActiveRecord::Base.pluralize_table_names = false > > 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 -~--~~~~--~~--~--~---