[Rails] Re: shortcut to call js function
Mk 27 wrote: [...] > I think we are talking about slightly different things. I am not > talking about defining functions inline. I'm talking about calling > them: > > with no exceptions" and you are bound to failure because of that. What failure? Again, I've *already succeeded* in doing everything I'm talking about, so for you to claim that it is impossible suggests inadequate comprehension on your part. That's OK for now. Parts of this concept may be tough. But that doesn't mean they don't exist, or that you shouldn't be willing to educate yourself about them. > >> You said you were snobbish about JS as compared to "real languages". >> Well, guess what -- JS is a "real" language, and quite a powerful one >> too, > > This was a joke about snobbishness, and not really anything else. Sorry > I did not make that clear earlier... I understand. My point was that if you use JS in larger chunks, you can take better advantage of the higher-level constructs in the language, which will make it possible to produce better-designed code. [...] > > Inlining CSS is truly pointless, but when I look at a page source and > see a mix of html, javascript, and embedded "whatever", I honestly do > not, never have, never will, have some sort of absurd formatting related > freak-out (like: "See how much tidier your html is now!!" Grow up). Excuse me? "Grow up"?!? I'll just pretend you didn't say that -- let's keep this civil. It's not really about formatting, it's about organization, and as pharrington explained, it also benefits things like testability and code reuse. > You sound like someone who insists there is only one place to place an > opening {, when in fact there are a number of acceptable styles and that > is all they are: styles. Do not jump to conclusions, and do not try to drag an unrelated issue into this thread. Unlike brace placement, this is *not* a stylistic debate, but rather an architectural one. As long as you fail to grasp that, you will fail to grasp why this issue is important. > >>> You are not >>> talking about any improvement in functionality or performance, after >>> all. >> >> Wrong again. > > No, you are wrong again. No I'm not, and I'm not sure why you think I am. External JS undeniably brings an improvement in functionality, and performance is helped by the browser being able to cache the entire JS file. > If you want to tell me > >
[Rails] nested forms with select lists
I'd like to use a drop down select field to add multiple categories to my model (has_many relationship) using nested forms in Rails 2.3.2. I can get it to work fine with straight text fields, but no matter what I do with select elements I always end up with "undefined method `merge' for #" Does anyone have a working example of using nested forms with select? 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: Can't deploy using Git !!!!!
I've tried sshing into the instance and i successfully cloned the repo... If the problem is Capistrano... what's wrong in the code above... it seems perfect to me... thx again LP On May 30, 10:29 pm, Frederick Cheung wrote: > On May 31, 3:13 am, lpdahito wrote:> I've generated a > keypair from my instance and copied the public one to > > github... > > Like you've said, I've put it in the account... didnt work... > > I've tried as a deploy key also... without success either... > > And you've copied the keys to your ec2 instances (probably also > sensible to setup your ssh config there to tell it to use that key > when talking to github) ? > Have you tried sshing into one of your instances and doing a git clone > from the command line (ie see if it's just capistrano screwing > around) ? > > Fred > > > That's mainly the reason why i'm on this forum right now... > > > thx for your help > > Still need help though > > > LP > > > On May 30, 9:38 pm, Frederick Cheung > > wrote: > > > > On May 31, 2:10 am, lpdahito wrote: > > > > > * executing "if [ -d /mnt/app/shared/cached-copy ]; then cd /mnt/app/ > > > > shared/cached-copy && git fetch -q origin && git reset -q --hard > > > > d5b088e509dcc4b476836b5bab0203ce5d4618f9; else git clone -q > > > > g...@github.com:lpdahito/snaproof.git /mnt/app/shared/cached-copy && > > > > cd /mnt/app/shared/cached-copy && git checkout -q -b deploy > > > > d5b088e509dcc4b476836b5bab0203ce5d4618f9; fi" > > > > servers: ["ec2-75-101-235-89.compute-1.amazonaws.com"] > > > > [ec2-75-101-235-89.compute-1.amazonaws.com] executing command > > > > ** [ec2-75-101-235-89.compute-1.amazonaws.com :: out] Permission > > > > denied (publickey). > > > > This is saying that your ec2 instance didn't have the right > > > credentials to talk to your github account - either it is using a > > > public key that you haven't added to the account (either straight to > > > the account or as a deploy key for the repository in question) or it > > > doesn't have a key at all. > > > > 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: Routing inspection
rake routes ? On May 30, 8:40 pm, Saty Nos wrote: > Is there any way possible to get the child paths given a path? > > I mean given the following routes: > > map.resources :users do |user| > user.resources :articles > ... > end > > If I give path = "users/1", is there any way to get the routes > users/1/edit, users/1/articles, users/1/articles/new ? > > Thanks in advance. > -Satynos > -- > 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: 500,000 to 1million records a day. Can Rails scale to that?
Thanks for all the great advices and ideas from you all -- 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: 500,000 to 1million records a day. Can Rails scale to that?
I got 1 good advice from a Rails Guru. I think i'll just get it up and think about scaling later on. MOstly, Database is the biggest bottleneck. Yes, i read Enterprise Rails. And some good advice from Some Big sites that use Rails. i'll just keep Rails and move on... God Bless me Best Regards Chamreoun Courtney Wade wrote: > On May 28, 4:43�am, Chamroeun Sok > wrote: >> >> Best Regards >> Chamroeun >> -- >> Posted viahttp://www.ruby-forum.com/. > > I recommend checking out Enterprise Rails by one of my former > coworkers, Dan Chak: > http://www.amazon.com/Enterprise-Rails-Dan-Chak/dp/0596515200 > > He describes a lot of the work we did at CourseAdvisor to scale our > site to handle millions of users. I think Rails has evolved to a point > where some of the approaches he describes are not the best, but I > think it still contains some very helpful advice and strategies. (I'm > not involved with the book in any way so this is not self-promotion). > > Courtney -- 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] Routing inspection
Is there any way possible to get the child paths given a path? I mean given the following routes: map.resources :users do |user| user.resources :articles ... end If I give path = "users/1", is there any way to get the routes users/1/edit, users/1/articles, users/1/articles/new ? Thanks in advance. -Satynos -- 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 Custom Form Builder
Fre: That was a typo. In my actual implementation FormHelper is a module and it doesn't inherit the builtin FormHelper, but includes it. So there was no problem. The problem I was having is with the FormBuilder itself. I beleive there was other code files that were creating the problem. Once I create a new rails app from scratch, everything works fine. Thanks for all the feedback. -Satynos Frederick Cheung wrote: > On May 31, 1:59�am, Saty Nos wrote: >> I don't see where my class is being inherited from module. >> > You've written > > module FormHelper < ActionView::Helpers::FormHelper > end > > which doesn't make any sense - modules can't inherit from anything. > > Fre -- 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: Mi browser no muestra el formato para captura desplegado
Thanks Franco, the problem was solved, someone else from spanish list suggested the same as you and it worked fine. Thanks again ! Jose Franco Catena wrote: > Jose: > > You must use specify to the generator the fields like this: > > ruby script/generate scaffold Product name:string description:string > > and so on with all the fields in the database. If you want to add one > field in a previously created scaffold you can do it editing the files > in the app/views/products/ directory. > > Regards. > > Franco Catena. > > On May 30, 1:02�pm, Jose Galvan -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Rails collection_select syntax issue
Thank you Matt! This worked nicely. On May 29, 6:26 pm, Matt Jones wrote: > You're probably better off using select_tag, together with > options_for_select here. collection_select appears to be giving you a > bit more magic than you want... > > Example: > > <%= select_tag :county, options_for_select(["Please select a > county...", ""]+...@counties.map { |c| [c,c]}) %> > > (change the entries in the map call if @counties has objects rather > than strings - the first entry in the array is the label, and the > second is the value that will be sent) > > --Matt Jones > > On May 28, 3:23 pm, ReidO wrote: > > > I'm trying to display unique counties listed in my database in select > > box for a property database. I've figured out how to do this, but now > > I can't figure out how to access the selected value of the select. > > This mainly has do with the way the HTML select name is outputted. > > > My form code, county is an attribute for my property model: > > > <%= collection_select(:property, :county, > > @Counties, :county, :county, {:prompt => true}) %> > > > This outputs the HTML > > > > value="">Please select > > Pearl River > > Marion > > Stone > > Lamar > > Forrest > > Jones > > Washington > > > It is the []'s in the select name "property[county] that is giving me > > fits. The other items in the search form use select_tag so the output > > is simply "min_price" rather than "property[min_price]". This is > > causing a syntax error when I'm trying to put together my search > > results array in my Property model: > > > def self.find_by_lcc(params) > > where = [] > > unless params[:mls].blank? > > where << "mls = :mls" > > end > > unless params[:county].blank? > > where << "county = :county" > > end > > unless params[:min_acreage].blank? > > where << "acreage >= :min_acreage" > > end > > unless params[:max_acreage].blank? > > where << "acreage <= :max_acreage" > > end > > unless params[:min_price].blank? > > where << "price >= :min_price" > > end > > unless params[:max_price].blank? > > where << "price <= :max_price" > > end > > > if where.empty? > > [] > > else > > find(:all, > > :conditions => [where.join(" AND "), params], > > :order => "city, price desc") > > end > > > Due to the county problem all the records are being listed rather than > > just the properties within that county. The browser URL string I'm > > getting is: > > > public/land?mls=&property[county] > > =Stone&min_acreage=0&max_acreage=1600&min_price=0&max_price=160&com > > mit=Search > > > I have searched for answers on this for a couple of days and I'm sure > > it's a simple syntax method I need to use in compiling my search > > array. > > > Thanks for any help! > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: page object
On May 31, 1:41 am, Matt Smart wrote: > Hello, > > I'm new to the group, and still learning rails. I am a C++ programmer > by trade, so I'm finding some of the rails semantics confusing. When I > come accross a statement like this: > > <%= link_to_function "clickme" do |page| ... > > ... and then a few lines that I do understand, could someone explain > to me the following: the link_to_function function takes some object > for the rendered link, and then what? it's supposed to be *args, and > then &block. I assume that the code that comes afterward is the > reference to a block of text, but how does the args part work? Also, > in this instance, how does the do evaluate |page|? and last: where in > the rails API docs is the reference for the page object? *args means that you can pass it as many arguments as you want (and if you were writing such a function then args would be an array containing those options). That doesn't necessarily mean that the function will do something sensible if you pass it 23 arguments (to know that you need to read the docs for it) &block is basically just the block you give the function (and the fact that it's there in the docs is probably a bit of an artefact of rdoc - you can pass a block to any method (again, no guarantees on what that method will do with it). The 'do' doesn't evaluate page, that's just you giving a name to the object that link_to_function yields to you (which is an instance of JavaScriptGenerator or something similar). You might find it easier to get a solid grounding in ruby first before starting to fiddle around with rails. Fred > > I'm sure someone well versed in ruby can explain this to me. Thankyou > for any help. Even links to documentation that explains these ruby > operators would help. Thanks again, > > Matt --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] page object
Hello, I'm new to the group, and still learning rails. I am a C++ programmer by trade, so I'm finding some of the rails semantics confusing. When I come accross a statement like this: <%= link_to_function "clickme" do |page| ... ... and then a few lines that I do understand, could someone explain to me the following: the link_to_function function takes some object for the rendered link, and then what? it's supposed to be *args, and then &block. I assume that the code that comes afterward is the reference to a block of text, but how does the args part work? Also, in this instance, how does the do evaluate |page|? and last: where in the rails API docs is the reference for the page object? I'm sure someone well versed in ruby can explain this to me. Thankyou for any help. Even links to documentation that explains these ruby operators would help. Thanks again, Matt --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Can't deploy using Git !!!!!
On May 31, 3:13 am, lpdahito wrote: > I've generated a keypair from my instance and copied the public one to > github... > Like you've said, I've put it in the account... didnt work... > I've tried as a deploy key also... without success either... > And you've copied the keys to your ec2 instances (probably also sensible to setup your ssh config there to tell it to use that key when talking to github) ? Have you tried sshing into one of your instances and doing a git clone from the command line (ie see if it's just capistrano screwing around) ? Fred > That's mainly the reason why i'm on this forum right now... > > thx for your help > Still need help though > > LP > > On May 30, 9:38 pm, Frederick Cheung > wrote: > > > On May 31, 2:10 am, lpdahito wrote: > > > > * executing "if [ -d /mnt/app/shared/cached-copy ]; then cd /mnt/app/ > > > shared/cached-copy && git fetch -q origin && git reset -q --hard > > > d5b088e509dcc4b476836b5bab0203ce5d4618f9; else git clone -q > > > g...@github.com:lpdahito/snaproof.git /mnt/app/shared/cached-copy && > > > cd /mnt/app/shared/cached-copy && git checkout -q -b deploy > > > d5b088e509dcc4b476836b5bab0203ce5d4618f9; fi" > > > servers: ["ec2-75-101-235-89.compute-1.amazonaws.com"] > > > [ec2-75-101-235-89.compute-1.amazonaws.com] executing command > > > ** [ec2-75-101-235-89.compute-1.amazonaws.com :: out] Permission > > > denied (publickey). > > > This is saying that your ec2 instance didn't have the right > > credentials to talk to your github account - either it is using a > > public key that you haven't added to the account (either straight to > > the account or as a deploy key for the repository in question) or it > > doesn't have a key at all. > > > 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: Can't deploy using Git !!!!!
I've generated a keypair from my instance and copied the public one to github... Like you've said, I've put it in the account... didnt work... I've tried as a deploy key also... without success either... That's mainly the reason why i'm on this forum right now... thx for your help Still need help though LP On May 30, 9:38 pm, Frederick Cheung wrote: > On May 31, 2:10 am, lpdahito wrote: > > > * executing "if [ -d /mnt/app/shared/cached-copy ]; then cd /mnt/app/ > > shared/cached-copy && git fetch -q origin && git reset -q --hard > > d5b088e509dcc4b476836b5bab0203ce5d4618f9; else git clone -q > > g...@github.com:lpdahito/snaproof.git /mnt/app/shared/cached-copy && > > cd /mnt/app/shared/cached-copy && git checkout -q -b deploy > > d5b088e509dcc4b476836b5bab0203ce5d4618f9; fi" > > servers: ["ec2-75-101-235-89.compute-1.amazonaws.com"] > > [ec2-75-101-235-89.compute-1.amazonaws.com] executing command > > ** [ec2-75-101-235-89.compute-1.amazonaws.com :: out] Permission > > denied (publickey). > > This is saying that your ec2 instance didn't have the right > credentials to talk to your github account - either it is using a > public key that you haven't added to the account (either straight to > the account or as a deploy key for the repository in question) or it > doesn't have a key at all. > > 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: Problem with Custom Form Builder
On May 31, 1:59 am, Saty Nos wrote: > Mauricio: > > Thanks for the reponse. I didn't quite get what you mean by I am making > a module inherit from a class. > > MyAPP - is top level module > MyApp::FormBuilder - is class within my module MyApp and inherits from > builtin rails FormBuilder class > MyApp::FormHelper - is module within my module MyApp. > > I don't see where my class is being inherited from module. > You've written module FormHelper < ActionView::Helpers::FormHelper end which doesn't make any sense - modules can't inherit from anything. Fre > thanks in advance. > -Satynos > > Maurício Linhares wrote: > > You're making a module inherit from a class and this is wrong. > > > Here's an example of building a custom form builder -> > >http://onrails.org/articles/2008/06/13/advanced-rails-studio-custom-f... > > > - > > Maur cio Linhares > >http://alinhavado.wordpress.com/(pt-br) |http://blog.codevader.com/ > > (en) > > > On Sat, May 30, 2009 at 4:42 PM, Saty Nos > > -- > 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: Can't deploy using Git !!!!!
On May 31, 2:10 am, lpdahito wrote: > * executing "if [ -d /mnt/app/shared/cached-copy ]; then cd /mnt/app/ > shared/cached-copy && git fetch -q origin && git reset -q --hard > d5b088e509dcc4b476836b5bab0203ce5d4618f9; else git clone -q > g...@github.com:lpdahito/snaproof.git /mnt/app/shared/cached-copy && > cd /mnt/app/shared/cached-copy && git checkout -q -b deploy > d5b088e509dcc4b476836b5bab0203ce5d4618f9; fi" > servers: ["ec2-75-101-235-89.compute-1.amazonaws.com"] > [ec2-75-101-235-89.compute-1.amazonaws.com] executing command > ** [ec2-75-101-235-89.compute-1.amazonaws.com :: out] Permission > denied (publickey). This is saying that your ec2 instance didn't have the right credentials to talk to your github account - either it is using a public key that you haven't added to the account (either straight to the account or as a deploy key for the repository in question) or it doesn't have a key at all. 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] Can't deploy using Git !!!!!
Hey guys, So here's the deal... I'm trying to deploy an app on EC2 using the EC2onRails gem I'm using git as my SCM and capistrano to deploy obviously... Everytime I try to deploy with this command: cap deploy:cold, I get the following error output on my terminal window: bas1-stlambert20-1178037070:snaproof exponenth$ cap deploy:cold * executing `deploy:cold' * executing `deploy:update' ** transaction: start * executing `deploy:update_code' updating the cached checkout on all servers executing locally: "git ls-remote g...@github.com:lpdahito/ snaproof.git master" * executing "if [ -d /mnt/app/shared/cached-copy ]; then cd /mnt/app/ shared/cached-copy && git fetch -q origin && git reset -q --hard d5b088e509dcc4b476836b5bab0203ce5d4618f9; else git clone -q g...@github.com:lpdahito/snaproof.git /mnt/app/shared/cached-copy && cd /mnt/app/shared/cached-copy && git checkout -q -b deploy d5b088e509dcc4b476836b5bab0203ce5d4618f9; fi" servers: ["ec2-75-101-235-89.compute-1.amazonaws.com"] [ec2-75-101-235-89.compute-1.amazonaws.com] executing command ** [ec2-75-101-235-89.compute-1.amazonaws.com :: out] Permission denied (publickey). ** [ec2-75-101-235-89.compute-1.amazonaws.com :: out] fatal: The remote end hung up unexpectedly ** [ec2-75-101-235-89.compute-1.amazonaws.com :: out] fetch-pack from 'g...@github.com:lpdahito/snaproof.git' failed. command finished *** [deploy:update_code] rolling back * executing "rm -rf /mnt/app/releases/20090531003111; true" servers: ["ec2-75-101-235-89.compute-1.amazonaws.com"] [ec2-75-101-235-89.compute-1.amazonaws.com] executing command command finished failed: "sh -c \"if [ -d /mnt/app/shared/cached-copy ]; then cd /mnt/ app/shared/cached-copy && git fetch -q origin && git reset -q --hard d5b088e509dcc4b476836b5bab0203ce5d4618f9; else git clone -q g...@github.com:lpdahito/snaproof.git /mnt/app/shared/cached-copy && cd /mnt/app/shared/cached-copy && git checkout -q -b deploy d5b088e509dcc4b476836b5bab0203ce5d4618f9; fi\"" on ec2-75-101-235-89.compute-1.amazonaws.com If you're looking for my capistrano recipe, here it is: # This is a sample Capistrano config file for EC2 on Rails. # It should be edited and customized. set :application, "snaproof" set :scm, "git" set :repository, "g...@github.com:lpdahito/snaproof.git" set :scm_passphrase, "" set :user, "Louis-Pierre Dahito" ssh_options[:forward_agent] = true set :branch, "master" set :deploy_via, :remote_cache default_run_options[:pty] = true # NOTE: for some reason Capistrano requires you to have both the public and # the private key in the same folder, the public key should have the # extension ".pub". ssh_options[:keys] = ["#{ENV['HOME']}/.ec2/lpdahito.pem"] # Your EC2 instances. Use the ec2-xxxamazonaws.com hostname, not # any other name (in case you have your own DNS alias) or it won't # be able to resolve to the internal IP address. role :web, "ec2-75-101-235-89.compute-1.amazonaws.com" role :app, "ec2-75-101-235-89.compute-1.amazonaws.com" role :memcache, "ec2-75-101-235-89.compute-1.amazonaws.com" role :db, "ec2-75-101-235-89.compute-1.amazonaws.com", :primary => true # role :db, "ec2-56-xx-xx- xx.z-1.compute-1.amazonaws.com", :primary => true, :ebs_vol_id => 'vol-12345abc' # optinally, you can specify Amazon's EBS volume ID if the database is persisted # via Amazon's EBS. See the main README for more information. # Whatever you set here will be taken set as the default RAILS_ENV value # on the server. Your app and your hourly/daily/weekly/monthly scripts # will run with RAILS_ENV set to this value. set :rails_env, "production" # EC2 on Rails config. # NOTE: Some of these should be omitted if not needed. set :ec2onrails_config, { # S3 bucket and "subdir" used by the ec2onrails:db:restore task # NOTE: this only applies if you are not using EBS :restore_from_bucket => "your-bucket", :restore_from_bucket_subdir => "database", # S3 bucket and "subdir" used by the ec2onrails:db:archive task # This does not affect the automatic backup of your MySQL db to S3, it's # just for manually archiving a db snapshot to a different bucket if # desired. # NOTE: this only applies if you are not using EBS :archive_to_bucket => "your-other-bucket", :archive_to_bucket_subdir => "db-archive/#{Time.new.strftime('%Y-%m- %d--%H-%M-%S')}", # Set a root password for MySQL. Run "cap ec2onrails:db:set_root_password" # to enable this. This is optional, and after doing this the # ec2onrails:db:drop task won't work, but be aware that MySQL accepts # connections on the public network interface (you should block the MySQL # port with the firewall anyway). # If you don't care about setting the mysql root password then remove this. # Any extra Ubuntu packages to install if desired # If you don't want to install extra packages then remove this. :packages => ["logwatch", "imagemagick"], # Any extra RubyGems to install if desire
[Rails] Re: shortcut to call js function
Marnen Laibow-Koser wrote: > Mk 27 wrote: >> And >> please, do not hand me some basic case involving onload(), and claim "oh >> no, it could never be more coding, look...". Certainly, it could never, >> ever, logically be *less* coding. > > You are absolutely wrong. Since inline JS, by its very nature, is much > harder to refactor, in many, many types of cases, inline JS will lead to > significantly more code than unobtrusive external JS. I think we are talking about slightly different things. I am not talking about defining functions inline. I'm talking about calling them: You said you were snobbish about JS as compared to "real languages". > Well, guess what -- JS is a "real" language, and quite a powerful one > too, This was a joke about snobbishness, and not really anything else. Sorry I did not make that clear earlier... > "real" language. That means writing complete routines in one place, not > scattered bits of inline code. [...] The routines are in one place, a .js file. The calls are, often enough, made in an html file. > while keeping JS out of the HTML. I guarantee that both > your JS and your HTML will be the better for it. Inlining CSS is truly pointless, but when I look at a page source and see a mix of html, javascript, and embedded "whatever", I honestly do not, never have, never will, have some sort of absurd formatting related freak-out (like: "See how much tidier your html is now!!" Grow up). You sound like someone who insists there is only one place to place an opening {, when in fact there are a number of acceptable styles and that is all they are: styles. >> You are not >> talking about any improvement in functionality or performance, after >> all. > > Wrong again. No, you are wrong again. If you want to tell me
[Rails] Re: Problem with Custom Form Builder
Mauricio: Thanks for the reponse. I didn't quite get what you mean by I am making a module inherit from a class. MyAPP - is top level module MyApp::FormBuilder - is class within my module MyApp and inherits from builtin rails FormBuilder class MyApp::FormHelper - is module within my module MyApp. I don't see where my class is being inherited from module. thanks in advance. -Satynos Maurício Linhares wrote: > You're making a module inherit from a class and this is wrong. > > Here's an example of building a custom form builder -> > http://onrails.org/articles/2008/06/13/advanced-rails-studio-custom-form-builder > > - > Maur�cio Linhares > http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ > (en) > > > > On Sat, May 30, 2009 at 4:42 PM, Saty Nos -- 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] instance variable (conroller>view) and RESTful
I'm a bit flummoxed by something and hoping someone can offer an explanation. If I create a controller (test) with a RESTfully named method and a view (.../test/index), the value of the instance variable passes to the view. class TestController < ApplicationController def index @variable = 'Pass to a view' end end - If I rename the view to (.../test/foo) or some other non-RESTful name and appropriately alter the controller method, the value of the instance variable does not pass. class TestController < ApplicationController def foo @variable = 'Pass to a view' end end --- A half dozen inprint and online books seem to dispute my personla experience and suggest that the name of the method and view should be irrelevant. So does anybody have a suggestion as to what is going on? Is my routes.rb file where I need to be looking? Thanks much, Bill --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Need help : How to render HTML inside of a JSON request
Thanks, Jonathan. First off, I inherited this code base and I realize that there is a better solution... specifically to do a request with update. The request ask for json because they return both data elements which are used in the page and an html block as a replacement for a section. If there were only one call... I would just fix it by hand, but this approach has been used in multiple places in the code base. They make a call that constructs a json object, and one element in it is a string of html to replace a div. Unfortunately, when we call render_string -- now the render wont look for .html.erb objects. I've tried adding :content_type=:html to the render call, to no avail. I've also tried adding Mime::HTML and 'text/html' as :content_type parameters. I think I just need to temporarily override the request content type during rendering, but I can't figure out how. Russell On May 30, 11:16 am, Jonathan Rochkind wrote: > RFine wrote: > > > render :partial => 'comments/partial_name' > > > If I change it to : > > > render :partial => 'comments/partial_name.html.erb' > > > and it works. It appears as though the fact that the call is a JSON > > request from the client is causing the render engine not to search > > for .html and .html.erb in the path, thus they fail. > > You got it. Why are you returning .html from a ajax/json request from > the client, anyway? Generally, ajax requests from the client get back > javascript (or specifically json), not html! > > Rails is trying to help you with this general case, because you can have > the same action that will return partial.html.erb if it's an html > request, or partial.js.erb if it's an AJAX request. I forget exactly > how Rails determines when the format is js, but I know if you're using > any of the Rails helper methods for ajax callbacks, they definitely > include a query param to tell Rails what's what. > > So you can change the render call like you say. Or you COULD rename the > partial in the old way partial_name.erb, so Rails will use it for any > format request. But that's kind of weird (and now i'm not entirely sure > it'll work). Or you could reconsider why you want to return HTML > (rather than js/json) to a js request in the first place. Or you could > take a look at respond_to to see how you can return different views for > different request > types.http://api.rubyonrails.org/classes/ActionController/MimeResponds/Inst... > > -- > 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: autocomplete lookup speedup
2009/5/30 Maurício Linhares > > Have you tried to add a :limit clause to your select statement? > > Maybe show only the first 15 results and make sure there's an index at > the column being searched for. > > - > Maurício Linhares > http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) > > > > On Sat, May 30, 2009 at 3:08 PM, Me wrote: > > > > Is there anything I can do to speed up the query of a table that has > > 380,000 entries and will only get bigger? > > > > I tried the recipe in the rails recipe book but the page takes a long > > time just for the page to load due to the array being generated. > > > > > > Also, you may also try using the :select to limit what fields you fetch from your database. If you can provide a sample code, we can better assist you. Other than that, I would recommend using the #{RAILS_ROOT}/script/performance/benchmarker to profile your queries to make sure that your optimizations are truly working for the query in question. Good luck, -Conrad > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Mi browser no muestra el formato para captura desplegado
Jose: You must use specify to the generator the fields like this: ruby script/generate scaffold Product name:string description:string and so on with all the fields in the database. If you want to add one field in a previously created scaffold you can do it editing the files in the app/views/products/ directory. Regards. Franco Catena. On May 30, 1:02 pm, Jose Galvan wrote: > Cesar Diaz wrote: > > It must be a question for spanish list, what do you think? > > > Cesar > > > ___ > > Gnu/Linux count user #416024 > > > Skype: cesarstafe > > Yes,you are right Cesar, I am sorry, I already left the message in the > right place, anyway if you know something about what I am asking for > please help me, I will appreciate it. > > Jose. > -- > 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: autocomplete lookup speedup
On May 30, 7:08 pm, Me wrote: > Is there anything I can do to speed up the query of a table that has > 380,000 entries and will only get bigger? > > I tried the recipe in the rails recipe book but the page takes a long > time just for the page to load due to the array being generated. Have you got appropriate indexes on the table? 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: autocomplete lookup speedup
Have you tried to add a :limit clause to your select statement? Maybe show only the first 15 results and make sure there's an index at the column being searched for. - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Sat, May 30, 2009 at 3:08 PM, Me wrote: > > Is there anything I can do to speed up the query of a table that has > 380,000 entries and will only get bigger? > > I tried the recipe in the rails recipe book but the page takes a long > time just for the page to load due to the array being generated. > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send 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 Custom Form Builder
You're making a module inherit from a class and this is wrong. Here's an example of building a custom form builder -> http://onrails.org/articles/2008/06/13/advanced-rails-studio-custom-form-builder - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Sat, May 30, 2009 at 4:42 PM, Saty Nos wrote: > > Any help is much appreciated. This insight will help me not just for > subclassing built in form builder, but also to get a grasp of what is > allowe and what is not allowed in Rails parlance. > > -Satynos > > -- > 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 model password protection?
I'm sure there is a user created with the email that you give them. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send 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: Submit form without page refresh
On May 30, 9:21 pm, suki wrote: > I'm looking for an ajax script from submitting a form without page > refresh. The script should have these abilities: > > 1. Submit form without page refresh > 2. Display loading icon (or some text) while the script processing the > code > 3. Display different message if the form has submitted successfuly, > and different if it doesn't. > the form_remote_tag/remote_form_for helpers can do this. Fred > Can anyone help? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Submit form without page refresh
I'm looking for an ajax script from submitting a form without page refresh. The script should have these abilities: 1. Submit form without page refresh 2. Display loading icon (or some text) while the script processing the code 3. Display different message if the form has submitted successfuly, and different if it doesn't. Can anyone help? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] validates_associated is unnecessary?
Hi, I have a strange problem. Using accepts_nested_attributes_for, if I add on top of that the validates_associated declaration, AR makes 1 SQL query based on the parent_id (I use acts_as_list and acts_as_tree) for each associated child POSTed. When I remove the validates_associated declaration, the sql queries disappear and in fact if the associated models are not valid, then the parent model won't be valid either, as if the validates_associated was useless for me. Is there something that I am not getting here? I find it very strange. Thanks in advance to whoever can shed light on this. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Asking for help with operating on data
Marnen - I'd rather do it in Ruby instead of on the database side. In case my description was unclear, I'd like to iterate over an array, and for each iteration to be able to access a value determined in the previous iteration. Wisccal - that looks like it's close to what I'm looking to do. However, I don't understand the enumerable#each_with_object so I probably need to do more reading in my ruby book. On May 30, 2:47 am, Wisccal Wisccal wrote: > eggman2001 wrote: > > I have a few thousand rows of stock market data - one row for each > > day. I'm using ActiveRecord to perform database operations. > > > I'm interested in performing a calculation on each row while > > incorporating the result of the calculation on the previous row, and > > then once the calculation has been performed for all rows, perform a > > new calculation that uses the individual calculations of each row. > > > I figure that I'll start with an array of size 3,000. Then I would > > probably want to iterate over it, possibly saving the result of the > > operation of each row to a new array but this area is a little foggy. > > > Any suggestions? > > Assuming you want to calculate something like percent change for each > day, you could load the entire result set into an array, and then do > something like: > > changes = @stock_data.each_with_object([]) do |data, array| > last_value = array.last.value > change = (data.value - last_value) / last_value * 100 unless > last_value.zero? > array << [data.transaction_date, change] > end > > -- > 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: Problem with Custom Form Builder
Any help is much appreciated. This insight will help me not just for subclassing built in form builder, but also to get a grasp of what is allowe and what is not allowed in Rails parlance. -Satynos -- 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: shortcut to call js function
Mk 27 wrote: [...] > However, "getting the inline js" out will inevitably increase the actual > codebase of the project as whole, because you will have to add *more* > lines to your external scripts than you would have used in the page > source by inlining in *at least some* (if not quite a few) cases. And > please, do not hand me some basic case involving onload(), and claim "oh > no, it could never be more coding, look...". Certainly, it could never, > ever, logically be *less* coding. You are absolutely wrong. Since inline JS, by its very nature, is much harder to refactor, in many, many types of cases, inline JS will lead to significantly more code than unobtrusive external JS. Anyway, I'm not sure conciseness is as high a priority as ease of maintenance (although they do sometimes coincide), so your point is of dubious relevance. > > Going back to the example to which I have been referring, you would have > to throw that whole function out and use a combination of the simple css > classing mentioned by marlen with "cut paste and modify"ing the html > that would have been the majority of the output of the function. No. Just iterate over the affected DOM elements and apply an appropriate abstraction. You said you were snobbish about JS as compared to "real languages". Well, guess what -- JS is a "real" language, and quite a powerful one too, but you can't benefit from that fact unless you treat it as a "real" language. That means writing complete routines in one place, not scattered bits of inline code. [...] > However, if you are the sole author and maintainer, the extent to which > you do this (spend extra time coding to compartmentalize all the > javascript) should really be tempered by the feasibility of doing so. It is always feasible. It is (virtually) always worth doing. Stop complaining about it and try writing a sample page or two (with or without Rails) while keeping JS out of the HTML. I guarantee that both your JS and your HTML will be the better for it. > I'm down with Occam's Razor here in that introducing a complication is a > bad idea if the justification is purely about "universal" policies of > style that have little significance for the case at hand. They have significance for every nontrivial case. > You are not > talking about any improvement in functionality or performance, after > all. Wrong again. > > I would hate to consider a case where an author decided *not* to do > something because it required inline js. Read my lips: *NOTHING* REQUIRES INLINE JS! Anything doable with inline JS can also be done without it. > That would be ass backward > blind conformism. Perhaps it would be, but it's a straw man, since it will never happen. > > -MK Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] how to transform data to database (translation -> i18n)
Hi Everyone, I'm using I18n in my rails app and I'm very pleased about it. However, I'm now having problems posting Date objects to the database. The problem is that in my text field the date is represented in Dutch. So for example: I have a text field: <%= f.calender_date_select: date_attended %> Where I fill in a date like: 26 oktober 2009 Now the database won't recognize this, and that's probably because he's posting a foreign language to the database which he doesn't understand. I'm guessing I should translate each month somewhere (in the model??) like this: Januari => January Februari => Februari Maart => March etc.. etc.. Any suggestions?? Many 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: shortcut to call js function
Mk 27 wrote: > However, "getting the inline js" out will inevitably increase the actual > codebase of the project as whole, because you will have to add *more* > lines to your external scripts than you would have used in the page > source by inlining in *at least some* (if not quite a few) cases. All I can say is that in the (non-Rails) project where I'm consistently using unobtrusive JS, this has not been my experience. It hasn't led to any more lines of code. This does in part depend on your HTML DOM being fairly well structured with good classes and id's. In my experience, once you learn how to do it right, it's no more lines of code to maintain, and forces you to have better-structured HTML to boot, which is an added advantage. But there is a bit of a learning curve, sure. Now, if you had to give up all the Rails helper methods (that are essentially dynamic js-code-generators), then THAT would lead to more code. I wouldn't want to do that. So I'm going to check out the UJS Rails plugin that Fred helpfully alerts us to. But to each her own. I was gonna try to look at your example to show you a short concise unobtrusive JS version that would do the same thing, but I don't understand the case quite well enough and don't feel like spending the time trying to just to make a point. But my experience leads me to be confident it would be possible. -- 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] Simple model password protection?
Hey everybody, I would like to know how to do simple password protection in rails a la http://writeboard.com>writeboard. At writeboard, when a new writeboard object is created, the creator must assign a password, but not create a new user. Then, to access the newly-created writeboard, one must input only the password. I'm sure this is pretty simple, but I'm quite new to rails. 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] Problem with Custom Form Builder
I created my custom form builder (which inherits rails built-in form builder) name spaced under my app module. I also assigned this form builder to be the default action view form builder in the environment.rb. When I am starting the server, rails is throwing different errors some times saying unexpected kDEF expecting "<" or "\n" or ";" or some times saying unxpected $end expecting "<" or "\n" or ";" Following is the implementation of my code. lib/my_app.rb module MyApp VERSION = 1 end lib/my_app/form_builder.rb require 'my_app' module MyApp class FormBuilder < ActionView::Helpers::FormBuilder include MyApp::FormHelper end #end of class end #end of module lib/my_app/form_helper.rb require 'my_app' module MyApp module FormHelper < ActionView::Helpers::FormHelper end #end of module FormHelper end #end of module MyApp and at the end of environment.rb (after initializer) ActionView::Base.default_form_builder = MyApp::FormBuilder Why is Rails not accepting my FormBuilder when I nest it under MyApp module? Btw: If I declare the FormBuilder as a standalone class, its working. Thanks in advance. -Satynos -- 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: Combine if and do in a single line?
Frederick Cheung wrote: > {} binds more tightly than do..end - in some cases this can lead to > your block being passed to the 'wrong' method: Interesting, makes sense. Personally, that's one reason I don't like making method calls without parens, or doing anything else that relies on non-obvious order-of-evaluation-binding just to save a couple of parens. foo( bar {} ) or foo( bar do end ) will both do the same thing. Although the latter is kind of weird style, if I need a multi-line block for bar, I'd personally just use a temporary var instead. result = bar do end foo(result) But everyone's got their own style, I guess. Of course you COULD use {||} with multi-lines too, but it would also be stylistically weird in my opinion in that case. foo bar {|a| stuff more stuff } That's just weird. And if I DID it, I'd still want to put parens in around foo's argument, which would make it even weirder looking. Jonathan -- 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: Need help : How to render HTML inside of a JSON request
Bah, you know what, ignore me. I just realized you're asking about _partial_ specifically, and now I realize the solution isn't as clear. And I know why you might want an html partial in a js response, because I do that myself. :) And now I see that I'll have to deal with this when I upgrade to rails 3 too. I suspect you just have to change the partial like you say, but I don't know if that would be considered a bug or not. Okay, I'm done in my marathon of answering quesitons in the listserv, now that I've started giving bad answers. :) -- 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: query on Ruby array
On May 30, 6:38 pm, Jonathan Rochkind wrote: > Conrad Taylor wrote: > > An Array instance can respond to both count and size methods. If you > > use > > size the method with a counter > > cache column on the has_many side, you can cache the total. > > You can't possibly mean an Array, because an Array doesn't know anything > about going to databases or cacheing. An Array is just a list of stuff. > > You might mean an ActiveRecord Association collection object, which > behaves a lot like an array, but also has some 'magic' ActiveRecord > behavior on it. > > The fact that, as far as I know, there's no actual class name for this > AR association magic collection object, makes things rather confusing, I > agree. I think it's just some proxy methods singleton-added to an Array, > leaving us without a good name to call what it is, making things > confusing. Or if it really is a class, I don't know what it's called > cause it's not mentioned in the docs. This is a kind of a-bit-too-clever > ruby hacking that Rails, IMHO, uses sometimes when it doesn't really > have to, making things somewhat more confusing than they need to be. The classes in question are the various subclasses of ActiveRecord::AssociationCollection (eg HasManyAssociation) Fred > -- > Posted viahttp://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Need help : How to render HTML inside of a JSON request
RFine wrote: > > render :partial => 'comments/partial_name' > > If I change it to : > > render :partial => 'comments/partial_name.html.erb' > > and it works. It appears as though the fact that the call is a JSON > request from the client is causing the render engine not to search > for .html and .html.erb in the path, thus they fail. You got it. Why are you returning .html from a ajax/json request from the client, anyway? Generally, ajax requests from the client get back javascript (or specifically json), not html! Rails is trying to help you with this general case, because you can have the same action that will return partial.html.erb if it's an html request, or partial.js.erb if it's an AJAX request. I forget exactly how Rails determines when the format is js, but I know if you're using any of the Rails helper methods for ajax callbacks, they definitely include a query param to tell Rails what's what. So you can change the render call like you say. Or you COULD rename the partial in the old way partial_name.erb, so Rails will use it for any format request. But that's kind of weird (and now i'm not entirely sure it'll work). Or you could reconsider why you want to return HTML (rather than js/json) to a js request in the first place. Or you could take a look at respond_to to see how you can return different views for different request types. http://api.rubyonrails.org/classes/ActionController/MimeResponds/InstanceMethods.html#M000368 -- 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: Combine if and do in a single line?
On May 30, 7:03 pm, Marnen Laibow-Koser wrote: > Jonathan Rochkind wrote: > > [...] > > > The {| | } and the 'do' syntaxes are interchangeable in all ways. > > Almost. I've run across a couple of cases where one works and the other > doesn't -- one creates a Proc and the other doesn't, or something like > that. {} binds more tightly than do..end - in some cases this can lead to your block being passed to the 'wrong' method: def foo(x) puts "foo #{block_given?}" end def bar puts "bar #{block_given?}" end running foo bar {} outputs bar true foo false but running foo bar do end outputs boo false foo true Fred > But that's vanishingly rare, and 99 times out of 100, you will > not go wrong to treat them as interchangeable. > > > More > > of a Ruby question than a Rails one. > > Yup. > > Best, > -- > Marnen Laibow-Koserhttp://www.marnen.org > mar...@marnen.org > -- > 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: query on Ruby array
On Sat, May 30, 2009 at 10:38 AM, Jonathan Rochkind < rails-mailing-l...@andreas-s.net> wrote: > > Conrad Taylor wrote: > > An Array instance can respond to both count and size methods. If you > > use > > size the method with a counter > > cache column on the has_many side, you can cache the total. > > You can't possibly mean an Array, because an Array doesn't know anything > about going to databases or cacheing. An Array is just a list of stuff. > > You might mean an ActiveRecord Association collection object, which > behaves a lot like an array, but also has some 'magic' ActiveRecord > behavior on it. > > The fact that, as far as I know, there's no actual class name for this > AR association magic collection object, makes things rather confusing, I > agree. I think it's just some proxy methods singleton-added to an Array, > leaving us without a good name to call what it is, making things > confusing. Or if it really is a class, I don't know what it's called > cause it's not mentioned in the docs. This is a kind of a-bit-too-clever > ruby hacking that Rails, IMHO, uses sometimes when it doesn't really > have to, making things somewhat more confusing than they need to be. In regards to a counter cache column, I'm referring to an ActiveRecord::Base association as I indicated in my example. -Conrad > > -- > 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: default form name in form_for
JannaB wrote: > SO...how do you get teh form name for certain Dom / javascript > functionality? Give the form a name yourself: form_for [...], :html => { name="adsf", id="hjkl" } See the Rails API. -- 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: query on Ruby array
On Sat, May 30, 2009 at 11:05 AM, Conrad Taylor wrote: > On Wed, May 27, 2009 at 5:31 AM, Julian Leviston > wrote: > >> >> On 27/05/2009, at 9:16 PM, Conrad Taylor wrote: >> >> > An Array instance can respond to both count and size methods. If >> > you use size the method with a counter >> > cache column on the has_many side, you can cache the total. For >> > example, you can do something >> > like this >> > >> >> Hi. Not sure where you got that from. >> >> Loading development environment (Rails 2.3.2) >> >> [].count >> NoMethodError: undefined method `count' for []:Array >>from (irb):1 >> >> [].size >> => 0 >> >> >> > > This statements are only true in regards to Ruby 1.8.6. For example, in > Ruby 1.9.1, one can easily do the following: > > irb(main):001:0> [].count > => 0 > irb(main):002:0> [].size > => 0 > > -Conrad > > >> >> -- >> Learn: http://sensei.zenunit.com/ >> Last updated 20-May-09 (Rails, Basic Unix) >> Blog: http://random8.zenunit.com/ >> Twitter: http://twitter.com/random8r >> >> >> >> >> > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] autocomplete lookup speedup
Is there anything I can do to speed up the query of a table that has 380,000 entries and will only get bigger? I tried the recipe in the rails recipe book but the page takes a long time just for the page to load due to the array being generated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send 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: shortcut to call js function
>From what I've read this issue should really hinge on the scale of a project; if you have a whole team of developers whose membership is subject to change, things like compartmentalization and generic maintainability have to be top priorities. However, "getting the inline js" out will inevitably increase the actual codebase of the project as whole, because you will have to add *more* lines to your external scripts than you would have used in the page source by inlining in *at least some* (if not quite a few) cases. And please, do not hand me some basic case involving onload(), and claim "oh no, it could never be more coding, look...". Certainly, it could never, ever, logically be *less* coding. Going back to the example to which I have been referring, you would have to throw that whole function out and use a combination of the simple css classing mentioned by marlen with "cut paste and modify"ing the html that would have been the majority of the output of the function. This added effort will no doubt be justified and enabled by a large scale, team oriented project. However, if you are the sole author and maintainer, the extent to which you do this (spend extra time coding to compartmentalize all the javascript) should really be tempered by the feasibility of doing so. I'm down with Occam's Razor here in that introducing a complication is a bad idea if the justification is purely about "universal" policies of style that have little significance for the case at hand. You are not talking about any improvement in functionality or performance, after all. I would hate to consider a case where an author decided *not* to do something because it required inline js. That would be ass backward blind conformism. -MK -- 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: query on Ruby array
On Wed, May 27, 2009 at 5:31 AM, Julian Leviston wrote: > > On 27/05/2009, at 9:16 PM, Conrad Taylor wrote: > > > An Array instance can respond to both count and size methods. If > > you use size the method with a counter > > cache column on the has_many side, you can cache the total. For > > example, you can do something > > like this > > > > Hi. Not sure where you got that from. > > Loading development environment (Rails 2.3.2) > >> [].count > NoMethodError: undefined method `count' for []:Array >from (irb):1 > >> [].size > => 0 > >> > > This statements are only true in Ruby prior to Ruby 1.8.6. For example, in Ruby 1.9.1, one can easily do the following: irb(main):001:0> [].count => 0 irb(main):002:0> [].size => 0 -Conrad > > -- > Learn: http://sensei.zenunit.com/ > Last updated 20-May-09 (Rails, Basic Unix) > Blog: http://random8.zenunit.com/ > Twitter: http://twitter.com/random8r > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send 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: default form name in form_for
SO...how do you get teh form name for certain Dom / javascript functionality? On May 30, 1:39 pm, Conrad Taylor wrote: > On Sat, May 30, 2009 at 9:59 AM, JannaB wrote: > > > Does anyone know the default name given to a form created with > > form_for ? Thanks, JB > > There isn't a default name attribute generated when you use form_for helper. > > -Conrad > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to keep persistent socket connections?
Steve Hull wrote: > Yeah, that didn't work because caching the connection makes it > immutable, which means you can no longer write data to it. But you know > what I think *will* work? Storing the connection(s) as class vars. So > I'm trying that next. I will report back here afterward for anyone who > might be interested. I'd use a singleton object (ruby Singleton module lets you do this easily, or it's easy enough to do yourself) that encapsulates logic and state for your 'connection pool', rather than class variables. But you're on the right track. Note though that you've got to make sure all your logic (in this case in that hypothetical Singleton object), is concurrency-safe, if your rails app can possibly be deployed in any kind of a concurrent-request environment (or if you plan to create Threads yourself in your rails app, but hardly anyone ever does that). You could look at the newish Rails 2.2 ActiveRecord ConnectionPool for a model, since it's doing basically what you want, but specifically for db connections. The ConnectionPool code might just end up being too confusing and complicated though, since it has to deal with Rails backwards compatibility issues and stuff. I haven't actually looked at the ConnectionPool code myself much yet. -- 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: Combine if and do in a single line?
Jonathan Rochkind wrote: [...] > The {| | } and the 'do' syntaxes are interchangeable in all ways. Almost. I've run across a couple of cases where one works and the other doesn't -- one creates a Proc and the other doesn't, or something like that. But that's vanishingly rare, and 99 times out of 100, you will not go wrong to treat them as interchangeable. > More > of a Ruby question than a Rails one. Yup. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Can I update session variable in a new thread?
>> But it is do-able, although not easy, I don't think you can get away >> with just trying to access the session array itself in a thread that's >> out of the request loop. Sorry, this is a topic of interest to me that noone else is ever interested in talking about. PPS: REALLY, if you decide you want to set off a thread that will persist after the response is returned, despite the general pain in the neck of doing that cause neither ActiveRecord nor MRI 1.8 Ruby are entirely happy with it (but it's still possible if you take the right precautions)... AND... you need that thread to store state that later requests can access Consider just storing it in the db as an ActiveRecord rather than trying to put it in a session. All in all easier to deal with, at least if your thread already was using ActiveRecord anyway (which supplies it's own headaches). Worth considering, it's a trade-off as to what sort of headaches you want to deal with. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Can I update session variable in a new thread?
Jonathan Rochkind wrote: > > But it is do-able, although not easy, I don't think you can get away > with just trying to access the session array itself in a thread that's > out of the request loop. I'd add it's do-able ONLY if you are using a server-side session store. NOT if you are using the cookie store that's the new Rails default. With the cookie store there's simply no possible way to write to the session outside the request loop. So if you want to write to a session in a thread, you'd have to wait() on the thread before returning from your action, which might defeat the purpose you were trying to use the thread for in the first place. Also, if you are planning on using ActiveRecord in this thread, you've got to make sure to do a few other things to ensure your AR calls are thread-safe. Things which change slightly in different Rails versions, as Rails community has changed it's consensus on what sorts of threading are 'supported' in what ways. And ALSO, even aside from AR, I learned the hard way that (at least if you're using the standard 1.8 MRI ruby interpreter), if you want to send a thread off and let it keep going outside the request-loop, you'd really better set it's priority to -1, or it's going to end up interfering with your response being returned even though you don't think it should. Contrary to popular belief, it IS possible to do concurrent programming like this in Rails, in all versions. But it's a big pain in the neck. Don't do it unless you really have to (which I think I do in my situation), try to find another solution if possible. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Can I update session variable in a new thread?
Sudhi Kulkarni wrote: > Then in one of the periodic update methods if I access the > session[:executing] it is not updated to "done". Is there a problem if I > try to update session variable in a different thread? Actually, this is precisely what I was trying to do in another thread here where Fred graciously helped me too. I'd advise NOT trying to use the session array Rails gives to you, but instead just telling the thread the sessionID, and ten doing all the session access yourself manually. That's what I'm doing. It's not TOO hard, although it inconveniently changes for Rails 2.2 vs. pre-Rails 2.2. See this: http://www.ruby-forum.com/topic/184782 And see if it makes any sense to you, or still seems worth it to you when you see what you must do. :) But it does seem to be working for me, with some basic unit tests. There's sadly one more added wrinkle with regard to race conditions when you start to deal with sessions like this, that can result in the main action over-writing the session data the thread tries to write, or vice-versa. I have a hacky way to minimize (although not totally eliminate that), that is Session-store agnostic. You can totally eliminate it if you're willing to hack the particular session store, as I believe Fred has also done for the AR store, but I think this is quickly getting beyond what you hoped would be an easy answer. But it is do-able, although not easy, I don't think you can get away with just trying to access the session array itself in a thread that's out of the request loop. -- 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: default form name in form_for
On Sat, May 30, 2009 at 9:59 AM, JannaB wrote: > > Does anyone know the default name given to a form created with > form_for ? Thanks, JB There isn't a default name attribute generated when you use form_for helper. -Conrad > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: query on Ruby array
Conrad Taylor wrote: > An Array instance can respond to both count and size methods. If you > use > size the method with a counter > cache column on the has_many side, you can cache the total. You can't possibly mean an Array, because an Array doesn't know anything about going to databases or cacheing. An Array is just a list of stuff. You might mean an ActiveRecord Association collection object, which behaves a lot like an array, but also has some 'magic' ActiveRecord behavior on it. The fact that, as far as I know, there's no actual class name for this AR association magic collection object, makes things rather confusing, I agree. I think it's just some proxy methods singleton-added to an Array, leaving us without a good name to call what it is, making things confusing. Or if it really is a class, I don't know what it's called cause it's not mentioned in the docs. This is a kind of a-bit-too-clever ruby hacking that Rails, IMHO, uses sometimes when it doesn't really have to, making things somewhat more confusing than they need to be. -- 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: block pop-up for rails apps
That's possible but then you would probably be in violation of your ISP's T&C. Definitely go with real hosting. On May 29, 11:41 am, Shuaib85 wrote: > Someone told me about a javascript code that solves this problem. I am > not sure whether this true or not > > On May 29, 9:24 pm, Shuaib85 wrote: > > > > > On May 29, 8:51 pm, Rob Biedenharn > > wrote:> On May 29, 2009, at 1:00 PM, Shuaib85 wrote: > > > > > any idea how can i stop the pop ups because my google ads campaing is > > > > rejected due to this issue > > > > Pay for real hosting? > > > Yes, I am taking a real hosting plan. > > > > This is not a Rails question but an ISP question. > > > > > On May 28, 6:00 pm, Shuaib85 wrote: > > > >> Hi all > > > > >> Sometimes on some ISP, my application pop ups some ads for that > > > >> company. However, some other websites do not get the pop up when I > > > >> open the website using the same ISP. > > > > >> Is there a way that I can block those pop ups, 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: Combine if and do in a single line?
Mario Gr wrote: > Is there a way to combine if and do into a single line? > > items.each do |item| if current_user.admin? > #do stuff > end > > Thanks! Freddy Andersen wrote: > items.each { |item| item.stuff? } if current_user.admin? Which you actually COULD write like this too, but I'm not sure if it would be considered easily readable: items.each do |item| #do stuff end if current_user.admin? The {| | } and the 'do' syntaxes are interchangeable in all ways. More of a Ruby question than a Rails one. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Rails: concurrency question
Steve Hull wrote: > BUT Rails is essentially single-threaded (only a single request > processed at a time), so if I have only a single call to my singleton > instance method per http request, then it should be impossible to get > concurrency problems with it. Right? > It's actually possible to write various kinds of concurrent code in Rails -- it really ALWAYS was possible to have some concurrency, but not concurrent request handling, and whatever concurrency you added you'd add yourself. But in more recent versions of Rails, even some concurrent request handling is supported. allow_concurrency!. And perhaps Passenger in certain modes as Roderick says, I'm not familiar with Passenger. But you're basically right about the 'ordinary' mode of Rails execution, that only a single request will be processed at a time. This is increasingly not the only option for Rails though. But, yeah, you're also right that if you had Rails executing in a mode that allowed concurrent request handling, you'd need to take care of making sure your singleton object itself is concurrent-access safe -- the singleton pattern will take care of _instantiation_ of the Singleton object being concurrency-safe, but can't take care of it's own internal logic. So you can either do that -- or you can note in comments that this thing isn't concurrency-safe, and shouldn't be used in a concurrent-request environment. -- 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] Routing Error with Passenger for Images and stylesheets
Hi, I updated my server with the latest Rails (2.3.2) and Passenger (2.2.2). I also updated my Rails app to run under 2.3.2. It runs fine locally under Mongrel. The app is deployed into my own home directory under: (deployed via Capistrano) /users/me/public_html/myapp/current (which is a symlink to the actual app) and it's accessed by the url: http://myserver.com/myapp I was getting routing errors, where Passenger/Apache could not find the default route. But I found a post saying Passenger has an issue with routing, so I added the RailsBaseURI to the environment.rb file: config.action_controller.relative_url_root = "/myapp" I found another post that said my apache config should be: ServerName myserver.com DocumentRoot /home/me/public_html/myapp/current/public Options FollowSymLinks AllowOverride None Order allow,deny Allow from all RailsBaseURI / I have not .htaccess file in the public folder. I am now able to get to the app, but all references to stylesheets and images are giving routing errors in the production.log file: Processing ApplicationController#index (for 1.2.3.4 at 2009-05-30 13:11:46) [GET] ActionController::RoutingError (No route matches "/stylesheets/scaffold.css" with {:method=>:get}): passenger (2.2.2) lib/phusion_passenger/rack/request_handler.rb:81:in `process_request' passenger (2.2.2) lib/phusion_passenger/abstract_request_handler.rb:203:in `main_loop' passenger (2.2.2) lib/phusion_passenger/railz/application_spawner.rb:340:in `start_request_handler' passenger (2.2.2) lib/phusion_passenger/railz/application_spawner.rb:298:in `handle_spawn_application' passenger (2.2.2) lib/phusion_passenger/utils.rb:181:in `safe_fork' passenger (2.2.2) lib/phusion_passenger/railz/application_spawner.rb:296:in `handle_spawn_application' passenger (2.2.2) lib/phusion_passenger/abstract_server.rb:337:in `__send__' passenger (2.2.2) lib/phusion_passenger/abstract_server.rb:337:in `main_loop' passenger (2.2.2) lib/phusion_passenger/abstract_server.rb:187:in `start_synchronously' passenger (2.2.2) lib/phusion_passenger/abstract_server.rb:154:in `start' passenger (2.2.2) lib/phusion_passenger/railz/application_spawner.rb:192:in `start' passenger (2.2.2) lib/phusion_passenger/spawn_manager.rb:257:in `spawn_rails_application' passenger (2.2.2) lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add' passenger (2.2.2) lib/phusion_passenger/spawn_manager.rb:251:in `spawn_rails_application' passenger (2.2.2) lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize' passenger (2.2.2) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize' passenger (2.2.2) lib/phusion_passenger/spawn_manager.rb:250:in `spawn_rails_application' passenger (2.2.2) lib/phusion_passenger/spawn_manager.rb:153:in `spawn_application' passenger (2.2.2) lib/phusion_passenger/spawn_manager.rb:282:in `handle_spawn_application' passenger (2.2.2) lib/phusion_passenger/abstract_server.rb:337:in `__send__' passenger (2.2.2) lib/phusion_passenger/abstract_server.rb:337:in `main_loop' passenger (2.2.2) lib/phusion_passenger/abstract_server.rb:187:in `start_synchronously' I'm at a loss as to how to fix this. Anyone? 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] default form name in form_for
Does anyone know the default name given to a form created with form_for ? Thanks, JB --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send 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: shortcut to call js function
On May 30, 5:31 pm, Jonathan Rochkind wrote: > Curious if someone in the Rails community has figured out a good way to > accomplish what Rails helpers do (controller logic in the controller > instead of view, DRY for js idioms, etc) but in an "unobtrusive" idiom > where no JS (apart from
[Rails] Rails and YUI
I would like make use of YUI and Rails but I am not having much luck putting them together. Does anyone have a small application that combines some small aspect of YUI in a simple rails app as an example? I seem to be missing something REAL simple. There are examples (or more like snippets) out there. If I can get a copy of a complete (small and simple would be nice) app, that would be perfect. 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] Need help : How to render HTML inside of a JSON request
We have an app that is in production with Rails 2.1.2 and I'm about to upgrade to 2.3.2. However, I am having a problem with a number of AJAX calls and I could really use some help. The client will make an AJAX call to receive a json response, and the response includes an html string as one member of the json data object. We render the html to a string (render_to_string). and return the object. However, in the 2.3.2 version, we are receiving an erorr that some of the partials called inside of the render can't be found. I've isolated it to the partials that aren't fully qualified names. For example, this appears to fail: render :partial => 'comments/partial_name' If I change it to : render :partial => 'comments/partial_name.html.erb' and it works. It appears as though the fact that the call is a JSON request from the client is causing the render engine not to search for .html and .html.erb in the path, thus they fail. Any ideas? Russell --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send 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: shortcut to call js function
Mk 27 wrote: > You have hit a paradox by saying that you want to use prototype, etc. > but you do not want to see any js calls in your html files. I do > understand it is an explicit goal of rails to minimize the Look up "Unobtrusive javascript". Eg http://en.wikipedia.org/wiki/Unobtrusive_JavaScript You can keep almost all javascript out of HTML except for simply loading external script files which then attach the appropriate javascript behaviors where necessary. I have become quite enamored of this approach, I think it both facillitates more maintainable code with proper seperation of concerns, as well as facillitates better 'accessibility' (not just for non-js user-agents, but the possibility of swapping in _different_ js functionality for different contexts and/or user-agents). And as I become more enamored of this approach, I'm more and more unhappy with Rails js helpers, which definitely don't follow it. Curious if someone in the Rails community has figured out a good way to accomplish what Rails helpers do (controller logic in the controller instead of view, DRY for js idioms, etc) but in an "unobtrusive" idiom where no JS (apart from
[Rails] Re: Is there a rails equivalent of
On Sat, May 30, 2009 at 9:23 AM, Jim Burgess wrote: > >> Excellent! Now take the JS out of the HTML and put it in an external >> file. > > Cool, that works. > Thanks a lot. > -- You might want to have a look at Low Pro http://www.danwebb.net/2006/9/3/low-pro-unobtrusive-scripting-for-prototype It was built for prototype, but there's a version for use with jquery as well http://www.danwebb.net/2008/2/3/how-to-use-low-pro-for-jquery Although I haven't used that. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send 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: Ruby and RoR Setup Frustrations
Everything is working well. I did the 10-minute weblog project for rails and it worked nicely. I'm finally excited that everything appears to be installed and working correctly. Thanks again for the help! -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: can't use :update => in form_tag?
Mk 27 wrote: > The more I think about it the more sure I am this is the case, but I > thot I'd check here for confirmation... Then I find this "form_remote_tag" thing. Yay. -- 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] can't use :update => in form_tag?
Is this because a form submission REQUIRES the server to follow with a new page? Ie. it is impossible to submit a form, and have the view returned used in a div (as with "link_to :update"); that view MUST become a fresh page. The more I think about it the more sure I am this is the case, but I thot I'd check here for confirmation... Thanks in advance, MK -- 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: Mi browser no muestra el formato para captura desplegado
Cesar Diaz wrote: > It must be a question for spanish list, what do you think? > > Cesar > > ___ > Gnu/Linux count user #416024 > > Skype: cesarstafe Yes,you are right Cesar, I am sorry, I already left the message in the right place, anyway if you know something about what I am asking for please help me, I will appreciate it. Jose. -- 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: SubDomain Queries
On Sat, May 30, 2009 at 8:43 AM, sahil wrote: > so, when a user goes to blog.company.com, he should see contents of > the the rails_app, but the domain part of the url should not change. ? So, maybe I'm not understanding the issue. Create a virtual host for blog.company.com and install your blog app there. No redirection, no url change. Yes? -- Hassan Schroeder hassan.schroe...@gmail.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: Ruby and RoR Setup Frustrations
Try this - http://www.netbeans.org/kb/trails/ruby.html - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Sat, May 30, 2009 at 12:26 PM, J. D. wrote: > > Mauricio, > > Thanks for the input with netbeans. I actually installed netbeans and > tried to configure with jruby but had a lot of issues with trying to get > jruby to work well with a test project. > > However, when I used netbeans with my current 1.9.1 and created a test > project, rake created the DB, and then ran it through netbeans, it > worked 100%. I like the feel of netbeans so I must thank you for giving > me that heads up. > > I'll try to go back to jruby at a later date when I can understand it a > bit more but netbeans is working well with my current source and because > I installed it, I realized I needed warbler (so downloaded that gem). > > I'd like to know what gems I'm missing now that I should try to install. > > I have all of the ones listed above and including warbler now... > > Any other gems I'm missing? > > And, is there a good netbeans tutorial that anyone can point me to? > > -- > Posted via http://www.ruby-forum.com/. > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: SubDomain Queries
On May 29, 7:07 pm, Robin Fisher wrote: > Hi Sahil, > > If someone types in blog.company.com, you will need access to the > server on which that domain resides in order to redirect it to your > app, it has nothing to do with how you structure your application. > > If you setup a redirect, then the user will see yourapp.com/blog/:id > unless you reconfigure the routes in routes.rb. The alternative so > that the user sees blog.company.com is to frame your site on the > company.com website although this is considered slightly 2001 and not > really the done thing. No, actually i am not looking for the redirection thing. What i want is the CNAME Record change of blog.company.com. I have access to this and the other domain. so, when a user goes to blog.company.com, he should see contents of the the rails_app, but the domain part of the url should not change. Regards Sahil --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send 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: Ruby and RoR Setup Frustrations
Maurício Linhares wrote: > Try this - http://www.netbeans.org/kb/trails/ruby.html > > - > Maur�cio Linhares > http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ > (en) > > On Sat, May 30, 2009 at 12:26 PM, J. D. Thanks! Looks good - reading 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: Ruby and RoR Setup Frustrations
Mauricio, Thanks for the input with netbeans. I actually installed netbeans and tried to configure with jruby but had a lot of issues with trying to get jruby to work well with a test project. However, when I used netbeans with my current 1.9.1 and created a test project, rake created the DB, and then ran it through netbeans, it worked 100%. I like the feel of netbeans so I must thank you for giving me that heads up. I'll try to go back to jruby at a later date when I can understand it a bit more but netbeans is working well with my current source and because I installed it, I realized I needed warbler (so downloaded that gem). I'd like to know what gems I'm missing now that I should try to install. I have all of the ones listed above and including warbler now... Any other gems I'm missing? And, is there a good netbeans tutorial that anyone can point me to? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Converting Acts_As_Tree to Acts_As_Nested_Set
Mindtonic wrote: > SOLUTION: > > You're not going to believe this. > > 1. Install the plugin > 2. Write and run a migration to add `lft` and `rgt` integer columns to > your model > 3. Change `acts_as_tree` to `acts_as_nested_set` in your model > 4. Open the Console > 5. type: NameOfYourModel.rebuild! > > That's it! > > Woah, I've been looking for this for weeks. I hope it helps somebody > out there. Hi, Before migrating to awesome_nested_set, I'd like to know if moving things around happens easily. Let's say I have the following tree: Root |- Hardware |- GPS |- Screens |- Keyboards |- Geek stuff |- iPod Let's say I want to move GPS to Geek Stuff, how does it work? -- 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: Is there a rails equivalent of
> Excellent! Now take the JS out of the HTML and put it in an external > file. Cool, that works. Thanks a lot. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Is there a rails equivalent of
Jim Burgess wrote: > Sorry, I forgot the
[Rails] Re: Ruby and RoR Setup Frustrations
Maurício Linhares wrote: > Pre-packaged version? > > JRuby is just a pure ruby interpreter writen in Java that is faster > than the current 1.8 branch and is almost as fast as 1.9. And IDEs > shoudn't really care about which Ruby version you're using, at least > NetBeans and RubyMine don't, maybe it's time for you to change your > tools. > > JRuby also has a compatibility mode to run as if it was a Ruby 1.9 > interpreter, you should research and use it before making your mind. I will download and test Jruby to see how it functions firsthand. I'm not overly worried about deploying to a 1.9 environment right this minute. I just want to work with 1.9 locally, develop my apps locally, view them and test them locally. Once I feel comfortable with all of that (perhaps a few months down the road) I'll worry about the deployment phase then. Programming in the latest environment is critical to my way of thinking. I learn the latest and am not backtracking and having to adjust. Because I'm new to rails, in my opinion it is better to start with the latest version. When you say not supported you really mean not supported by some gem developers. 1.9.1 works fine on both windows and linux. Some gems though, do not. I've spoken with Luis about this and he's given me a lot of information as to why gems are not working properly, and I understand the frustrations firsthand. I'm really not here to argue or create issues at all. I'm generally a very helpful person, love assisting others, and am the type that will give to the community more than I take. However, I'm still learning the ropes so if you see any teeth in my comments (they are not meant for you). It is simply me dealing with the many frustrations of trying to get up and running. Again, I still need the other questions answered. If someone has answers to those questions, I would greatly appreciate it. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Ruby and RoR Setup Frustrations
Pre-packaged version? JRuby is just a pure ruby interpreter writen in Java that is faster than the current 1.8 branch and is almost as fast as 1.9. And IDEs shoudn't really care about which Ruby version you're using, at least NetBeans and RubyMine don't, maybe it's time for you to change your tools. JRuby also has a compatibility mode to run as if it was a Ruby 1.9 interpreter, you should research and use it before making your mind. - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Sat, May 30, 2009 at 9:40 AM, J. D. wrote: > > Jruby is not for me - it looks more like a pre-packaged version that is > not 1.9.1 and researching it (many say it's slow). I need an IDE that > is going to work with 1.9.1. > > -- > 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: Ruby and RoR Setup Frustrations
Jruby is not for me - it looks more like a pre-packaged version that is not 1.9.1 and researching it (many say it's slow). I need an IDE that is going to work with 1.9.1. -- 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: Ruby and RoR Setup Frustrations
You could start by avoiding Ruby 1.9 that is a development version and not really that supported. I also doubt that you're going to deploy to a Ruby 1.9 environment. - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Sat, May 30, 2009 at 9:33 AM, J. D. wrote: > > Maurício Linhares wrote: >> Have you tried to use JRuby? >> >> I'm sure you're not going to have any of these problems on Windows. >> >> - >> Maur�cio Linhares >> http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ >> (en) > > I'll look into jruby but I still need answers to the rest of my > questions, namely what gems I will need on windows with mysql for a full > rails environment to work. > > Developing is one thing but I will eventually have to port the app to my > hosting domain and so I need to make sure I have everything I need setup > properly. > > -- > 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: Ruby and RoR Setup Frustrations
Maurício Linhares wrote: > Have you tried to use JRuby? > > I'm sure you're not going to have any of these problems on Windows. > > - > Maur�cio Linhares > http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ > (en) I'll look into jruby but I still need answers to the rest of my questions, namely what gems I will need on windows with mysql for a full rails environment to work. Developing is one thing but I will eventually have to port the app to my hosting domain and so I need to make sure I have everything I need setup properly. -- 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: Would ROR be a good choice to build my site?
Jack Jackson wrote: > Would ROR be a good choice to build my site? > > Hi Gang, > > I'm in the process of developing a social media-ish site built around > WordPress and VBulletin forum. A site where a visitor has a username and > password and their own "page" on the site where various site > interactions take place. I need a CMS framework to tie them all together > along with other features like multimedia, video uploading/severing/, > news/articles/information as well as user/visitor created content ala/ > wiki's. I'll need a user-friendly backend to control the functionality. > (aside from Wordpress and VBulletin's existing backends) > Would ROR be suited for this sort of development? I'm going to be hiring > a developer very soon and would like to have some honest opinions from > those that know the platforms best. My current direction has me leaning > toward Joomla or Drupal but I've heard so much about ROR lately, I want > to find out more about it and if it's the best choice for my project. > > I hope to hear some good opinions. Thanks. I'm new here, especially with rails - but understanding the MVC concepts I would distinctly say "no". A CMS system tied around Vbulletin will not work with rails because vbulletin was never designed with MVC in mind. It would not mesh well with rails mainly because of the following: 1) It's PHP and not MVC driven. 2) It utilizes hooks and plugins to modify code areas to your site (which would not be rails compatible). You are better off going with a completely new rails project environment from scratch or if you must use vbulletin then go with a vbulletin based CMS like VBadvanced.. -- 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: Ruby and RoR Setup Frustrations
Have you tried to use JRuby? I'm sure you're not going to have any of these problems on Windows. - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Sat, May 30, 2009 at 9:21 AM, J. D. wrote: > > Okay, I'm starting to get a headache (mostly because I refuse to give > up) and continue to try to get ruby and ruby on rails configured. > > Let me explain my issues... > > I'm running Windows Vista with Ruby 1.9.1 and MySql 5.0.x > > It took me awhile to get this setup to work but I managed to do it. In > order to get Ruby 1.9.1 to work I had to use a ming compiled version. > In order to get mysql to work, I had to build the binary locally. > > The good news is I can create a new rails project, start it, and the > "about your rails environment" shows the following: > > Ruby version 1.9.1 (i386-mingw32) > RubyGems version 1.3.3 > Rack version 1.0 bundled > Rails version 2.3.2 > Active Record version 2.3.2 > Action Pack version 2.3.2 > Active Resource version 2.3.2 > Action Mailer version 2.3.2 > Active Support version 2.3.2 > Application root D:/ncaastatpages > Environment development > Database adapter mysql > Database schema version 0 > > So, it sees mysql, everything is golden and throws no errors. That's > the good part. > > Now the headache begins. > > Issue 1: Because of the way I had to compile mysql to work and using > ruby -e to require it, there's no gem listed. If I require 'mysql' > everything works just like a gem is installed. However if I do gem list > it does not show up. While this is just a trivial issue (for me), it's > a bigger issue with some IDEs like Aptana Studio which tried to install > a different mysql gem and screw up my entire setup. > > Issue 2: Here are the gems I have currently (that work 100%): > > All Rails Gems (2.3.2) > --action..etc.. > capistrano (2.5.5) > cgi_multipart_eof_fix (2.5.0) > gem_plugin (0.2.3) > highline (1.5.1) > net-scp (1.0.2) > net-sftp (2.0.2) > net-ssh (2.0.11) > net-ssh-gateway (1.0.1) > rails (2.3.2) > rake (0.8.7) > rspec (1.2.6) > rubygems-update (1.3.3) > test-unit (2.0.2) > > Notice that mysql does not show up under the list but it's there because > I used: > > ruby -e 'require "mysql"' > > With IDEs like Aptana Studio, they want to install mongrel, linefeed, > etc. but they keep installing the wrong versions that require > msvcrt-ruby18.dll instead of the msvcrt-ruby191.dll. > > So, my questions are in order: > > 1. What gems "must" I have working and operable to run a full rails > development project? > 2. Is there a way to tell Aptana Studio to not mess up my current rails > installation by attempting to install gems that are outdated or the > wrong kind? > 3. Is there another IDE I should consider? (I tried Jedit but it felt > clunky) - I previously used Scite which didn't give me any issues but > again, it lacked a lot of features that I might need. > 4. What am I missing here? > > My frustrations with Ruby and RoR isn't the programming! It's the > installation! The programming, MVC concepts are wonderful! I've never > experienced (working with any programming language) where the > installation would be a 9 out of a 10 difficulty rating and the > programming would be a 2 out of 10 difficulty rating for ease of use. > > I run a windows box and a virtual box with linux but I refuse to give up > on the windows end. I want to be able to program with both systems. > I'm not afraid to test the waters and go through hoops and hurdles to > get them both working 100%. My issues are that the hoops seem to be > surrounded by fire where windows is concerned. > > Any help would be appreciated. > -- > 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] Mechanize gem
Hi All, I am trying to use Mechanize gem for some url, I am submitting the form in that url but on the following submit command I got an error message. command: page = agent.submit(search_form) error: Iconv::InvalidEncoding invalid encoding ("ISO-8859-1;", "UTF-8") Please help me out, Thanks in advance, Saurabh -- 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] Ruby and RoR Setup Frustrations
Okay, I'm starting to get a headache (mostly because I refuse to give up) and continue to try to get ruby and ruby on rails configured. Let me explain my issues... I'm running Windows Vista with Ruby 1.9.1 and MySql 5.0.x It took me awhile to get this setup to work but I managed to do it. In order to get Ruby 1.9.1 to work I had to use a ming compiled version. In order to get mysql to work, I had to build the binary locally. The good news is I can create a new rails project, start it, and the "about your rails environment" shows the following: Ruby version 1.9.1 (i386-mingw32) RubyGems version 1.3.3 Rack version 1.0 bundled Rails version 2.3.2 Active Record version 2.3.2 Action Pack version 2.3.2 Active Resource version 2.3.2 Action Mailer version 2.3.2 Active Support version 2.3.2 Application root D:/ncaastatpages Environment development Database adapter mysql Database schema version 0 So, it sees mysql, everything is golden and throws no errors. That's the good part. Now the headache begins. Issue 1: Because of the way I had to compile mysql to work and using ruby -e to require it, there's no gem listed. If I require 'mysql' everything works just like a gem is installed. However if I do gem list it does not show up. While this is just a trivial issue (for me), it's a bigger issue with some IDEs like Aptana Studio which tried to install a different mysql gem and screw up my entire setup. Issue 2: Here are the gems I have currently (that work 100%): All Rails Gems (2.3.2) --action..etc.. capistrano (2.5.5) cgi_multipart_eof_fix (2.5.0) gem_plugin (0.2.3) highline (1.5.1) net-scp (1.0.2) net-sftp (2.0.2) net-ssh (2.0.11) net-ssh-gateway (1.0.1) rails (2.3.2) rake (0.8.7) rspec (1.2.6) rubygems-update (1.3.3) test-unit (2.0.2) Notice that mysql does not show up under the list but it's there because I used: ruby -e 'require "mysql"' With IDEs like Aptana Studio, they want to install mongrel, linefeed, etc. but they keep installing the wrong versions that require msvcrt-ruby18.dll instead of the msvcrt-ruby191.dll. So, my questions are in order: 1. What gems "must" I have working and operable to run a full rails development project? 2. Is there a way to tell Aptana Studio to not mess up my current rails installation by attempting to install gems that are outdated or the wrong kind? 3. Is there another IDE I should consider? (I tried Jedit but it felt clunky) - I previously used Scite which didn't give me any issues but again, it lacked a lot of features that I might need. 4. What am I missing here? My frustrations with Ruby and RoR isn't the programming! It's the installation! The programming, MVC concepts are wonderful! I've never experienced (working with any programming language) where the installation would be a 9 out of a 10 difficulty rating and the programming would be a 2 out of 10 difficulty rating for ease of use. I run a windows box and a virtual box with linux but I refuse to give up on the windows end. I want to be able to program with both systems. I'm not afraid to test the waters and go through hoops and hurdles to get them both working 100%. My issues are that the hoops seem to be surrounded by fire where windows is concerned. Any help would be appreciated. -- 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] ANNOUNCE: textmagic gem for easy SMS features integration
textmagic gem is a Ruby interface to the TextMagic’s Bulk SMS Gateway. It can be used to easily integrate SMS features into your application. It supports sending messages, receiving replies and more. Teaser: api = TextMagic::API.new('fred', 'my secret') api.send 'Hi Wilma!', '999314159265' api.receive # => ['999314159265: Hello Fred!'] Follow these links to learn more: - project homepage: http://tuzinsky.com/textmagic - documentation: http://tuzinsky.com/textmagic/rdoc/ - code: http://github.com/bobes/textmagic - TextMagic's home page: http://www.textmagic.com - TextMagic API Google group: http://groups.google.com/group/textmagic-api Feedback appreciated :) Enjoy, -- bobes --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send 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: Would ROR be a good choice to build my site?
Matt Jones wrote: > Are there really VCs out there with sufficiently severe craniorectal > inversion that they think they're really going to make "the next > Youtube+Facebook+Wikipedia+Twitter+Flickr"? I'd like to know, as I > missed out on the great deals on HK chairs during the last bust... Those openings are not about re-inventing those killer apps. That would be daft. Those openings are about figuring out new ways to spam them! -- Phlip --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Why won't my ActionMailer work inside the controller?
On May 28, 9:08 pm, Duane Morin wrote: > I've got a basic mailer setup and am simply trying to get a Hello > message through. If I go into script/console and execute > > Emailer.deliver_message("mys...@mydomain.com","My subject", "My > message") > > it works fine. > > However, if I fire up a controller with a test method that invokes the > same thing > > def test > Emailer.deliver_message("mys...@mydomain.com","My subject", "My > message") > end > > I never see the message. Something obvious I'm missing in the context > of running it in the controller? Shouldn't be. Stupid question : are you sure the code is actually getting run? (the action name may be relevant here) Is the instance of rails serving your web request running with a different RAILS_ENV (ie potentially different action mailer settings) ? Fred > -- > Posted viahttp://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Getting values from multiple select
On May 28, 7:46 pm, Pål Bergström wrote: > > > To debug these issues you should have a look at the compiled source > > with view source in the browser and see what you got. > > That helped. But I only get the first value. Even if I use "items[]". Where is it going wrong ? Does your controller only ever say the first value or do your logs show that the controller receives multiple values. Look at the html source: does the name of the select tag end with [] ? 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: Book Shelf app in 'Ruby on Rails Bible' book
On May 29, 4:38 pm, rails_n00b wrote: > I'm trying to follow through with the Book Shelf app that's in the > 'Ruby on Rails Bible' book and I'm at a point where I'm trying to > install Ruby/Amazon. I downloaded the Ruby/Amazon and extracted it as > instructed. Now I'm at the step where I need to drop into a Ruby > console to verify the Ruby/Amazon installation. > > In the console I typed : > > >> require 'amazon/aws/search' > RuntimeError: Unsupported digest algorithm (sha256). It looks like Ruby/Amazon is asking openssl whether it supports the sha256 algorithm and openssl is saying no. Before you go any further with this I found the following on the homepage for Ruby/Amazon: "Amazon is discontinuing v3 of the AWS API as of 2008-03-31. Ruby/ Amazon will cease to work at that time. Ruby/AWS is the successor to Ruby/Amazon and works with v4 of the AWS API. Please use that library instead of this one." Fred > from /Users/kevin/dev/Ruby/book_shelf/lib/amazon/aws/search.rb:34:in > `initialize' > from /Users/kevin/dev/Ruby/book_shelf/lib/amazon/aws/search.rb:34:in > `new' > from /Users/kevin/dev/Ruby/book_shelf/lib/amazon/aws/search.rb:34 > from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in > `gem_original_require' > from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in > `require' > from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/ > active_support/dependencies.rb:156:in `require' > from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/ > active_support/dependencies.rb:521:in `new_constants_in' > from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/ > active_support/dependencies.rb:156:in `require' > from (irb):1 > > > > I'm too much of Ruby n00b to know what that error means or how to > resolve it. Any suggestions? It probably has something to do with the > fact that I'm using different versions of Ruby, rails, gems, Ruby/ > Amazon since that book was written in '08 (likely '07). > > Ruby --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Generating and authenticating by API keys
I'm trying to get my head round offering up an API for a RESTful app; is it just a matter of; 1. adding an api_key column to the resource on which incoming requests will made (the app has a User model but I think the API authentication will need to be done on the Site model to which Users belong), 2. generating the API key using Digest::SHA1 or similar (the last dev used SHA1 for the passwords), 3. authenticating via API keys in a filter (perhaps something along the lines of option 2 here http://www.whatcodecraves.com/articles/2008/11/25/how_to_make_an_api_for_a_rails_app/). Unfortunately, the authentication lib is custom (I would much prefer to be working with one of the community adopted plugins such as Authlogic, which appears to have API key authentication anyway). Am I missing anything or does that sound like a reasonable starting point? -- 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 changes Logger formatting
On May 30, 9:45 am, RobR wrote: > Does anyone have any ideas here??? I no longer have useful Logger > messages. That's very frustrating. > probably because activerecord requires activesupport and activesupport does http://github.com/rails/rails/blob/669fd84910586d4c791b6f5bf4320f68ac7845aa/activesupport/lib/active_support/core_ext/logger.rb (note that it defaults you to Logger::SimpleFormatter) Fred > R > > On May 24, 7:18 am, RobR wrote: > > > Why does my Logger formatting change after I "require > > 'active_record'"? > > > irb(main):001:0> require 'logger' > > => true > > irb(main):002:0> $logger = Logger::new STDOUT > > => # > @default_formatter=# > @datetime_format=nil>, @level=0, @progname=nil, > > @logdev=# > @mutex=# > @mon_waiting_queue=[], @mon_entering_queue=[], @mon_count=0, > > @mon_owner=nil>, @dev=#, @shift_size=nil>> > > irb(main):003:0> > > irb(main):004:0* $logger.info{ "Expected log line style" } > > I, [2009-05-24T06:58:44.599720 #22050] INFO -- : Expected log line > > style > > => true > > irb(main):005:0> > > irb(main):006:0* require 'active_record' > > => true > > irb(main):007:0> $logger.info{ "Why did AR change my log line > > style?" } > > Why did AR change my log line style? > > => true > > irb(main):008:0> > > > Furthermore, how does one specify a user defined Logger format style? > > I need to provide my Log lines in a format consistent with our other > > applications. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send 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: Is there a rails equivalent of
Sorry, I forgot the
[Rails] Is there a rails equivalent of
Hi, I want to call a javascript function after my page has loaded. Currently I am using: Is there a neater / tidier way to do this using any rails specific commands? I found this: document.observe('dom:loaded', function() { $('state_field').hide(); $('person_country_id').observe('change', countrySelected); }); which is part of a tutorial for creating dynamic drop down menus, but when I, for example, try: document.observe('dom:loaded', function() { alert('hello'); }); this has no effect, rather it is output as html, as though I had witten document.observe('dom:loaded', function() {alert('hello');}); Grateful for any help. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] rake aborted! EMULTIHOP (Reserved)
Hi, I am using netbeans 6.5.1 IDE for development,(On fedora operating system) I have installed mysql and given proper sock file path in the database.yml file. But still I am getting this error when i am trying to migrate the database to current version. (in /home/a1tech/NetBeansProjects/RailsApplication1) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate rake aborted! EMULTIHOP (Reserved) Regards kiran -- 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 changes Logger formatting
Does anyone have any ideas here??? I no longer have useful Logger messages. That's very frustrating. R On May 24, 7:18 am, RobR wrote: > Why does my Logger formatting change after I "require > 'active_record'"? > > irb(main):001:0> require 'logger' > => true > irb(main):002:0> $logger = Logger::new STDOUT > => # @default_formatter=# @datetime_format=nil>, @level=0, @progname=nil, > @logdev=# @mutex=# @mon_waiting_queue=[], @mon_entering_queue=[], @mon_count=0, > @mon_owner=nil>, @dev=#, @shift_size=nil>> > irb(main):003:0> > irb(main):004:0* $logger.info{ "Expected log line style" } > I, [2009-05-24T06:58:44.599720 #22050] INFO -- : Expected log line > style > => true > irb(main):005:0> > irb(main):006:0* require 'active_record' > => true > irb(main):007:0> $logger.info{ "Why did AR change my log line > style?" } > Why did AR change my log line style? > => true > irb(main):008:0> > > Furthermore, how does one specify a user defined Logger format style? > I need to provide my Log lines in a format consistent with our other > applications. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send 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: Time.parse seems to fail
On May 30, 8:48 am, Colin Law wrote: > 2009/5/28 Claus-christian Ude > > > > > Hi, > > > it's seems to me the function Time.parse has an error: > > > ok - Time.parse("12/01/2008") => 2008-12-01 > > Error - Time.parse("01.12.2008") => 2008-01-12 > > My brain does not seem to be working well today, I cannot actually see what > you are getting at. What would you expect the second one to give and why? > These things are ofter locale dependant. My european brain expects day month year, but apparently in the US month ,day, year is more common. If you are expecting dates in a particular format strptime is useful, if not some sort of calendary widget is often a better idea. Fred > Colin > > > > > Or is there an option/timezone I have to chnage, so it will work > > correctly? > > > Greetings Claus-Christian Ude > > -- > > 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: Time.parse seems to fail
2009/5/28 Claus-christian Ude > > Hi, > > it's seems to me the function Time.parse has an error: > > ok- Time.parse("12/01/2008") => 2008-12-01 > Error - Time.parse("01.12.2008") => 2008-01-12 > My brain does not seem to be working well today, I cannot actually see what you are getting at. What would you expect the second one to give and why? Colin > > Or is there an option/timezone I have to chnage, so it will work > correctly? > > > Greetings Claus-Christian Ude > -- > 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 -~--~~~~--~~--~--~---