[Rails] Re: How to fire Ajax call from Form_for

2011-12-18 Thread Stephan Wehner
On Dec 17, 12:06 pm, Jay Chaun wrote: > I am learning Rails 3 and need some help on Ajax part. > > I am trying to accomplish the following: > There is a textarea on the page which has a length of letters > constraint, say 100. Every time a symbol is typed there,a nearby label > tells you how man

[Rails] Re: Re: country state city drop down list rails

2010-08-19 Thread Stephan Wehner
rajeevsharma86 wrote: > Thanks Stephan Wehner , > but can you tell me a way to implement it I'm really sorry, have no time at the moment. What coverage are you looking for? You can see some of the database at http://clocklist.com "Add your friend or contact"-> City (no

[Rails] Re: country state city drop down list rails

2010-08-19 Thread Stephan Wehner
ashu wrote: > hi every one > please tell me the recommended way to get country > state city drop down list in rails > any gem - plug-in tutorial > > thanks in advance. I think it's fair to say the authority on such a list is http://www.geonames.org You can download the data fr

[Rails] Re: Plugin to update twitter status

2010-08-19 Thread Stephan Wehner
Stephan Wehner wrote: > http://github.com/stephan-buckmaster/simple_twitter_post > > Uses Basic Authentication at the moment. Twitter says this will be > discontinued in a few weeks (http://dev.twitter.com/pages/oauth_faq) > I updated a week ago to OAuth (using grackle) Stephan

[Rails] Re: Tags not being saved into the database

2010-07-30 Thread Stephan Wehner
> Apologies, using select_tag "article[tag_list]" sufficiently fixes this > problem. > > Thank you for your input. Yes, that looks like the "right way". Except that the helper should be able to generate that 'select_tag' with "f.select 'tag_list'" Are you not allowing several tags, as tags are

[Rails] Re: Tags not being saved into the database

2010-07-30 Thread Stephan Wehner
Pale Horse wrote: > Stephan Wehner wrote: >> Pale Horse wrote: > > Nothing short of what should be there, nothing more: > > def new > @article = Article.new > end > > def create > @article = Article.new(params[:article]) >

[Rails] Re: Tags not being saved into the database

2010-07-30 Thread Stephan Wehner
Pale Horse wrote: > Stephan Wehner wrote: >> >> Could it be that your template should say >> >> <%= f.select "tags", ... %> >> >> and not >> >> <%= select_tag "tags", ... %> >> >> >> Stepha

[Rails] Re: Tags not being saved into the database

2010-07-30 Thread Stephan Wehner
Could it be that your template should say <%= f.select "tags", ... %> and not <%= select_tag "tags", ... %> Stephan -- 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, se

[Rails] Plugin to update twitter status

2010-07-30 Thread Stephan Wehner
Just uploaded version 0.1 of a Ruby on Rails plugin "simple_twitter_post" to github: * http://github.com/stephan-buckmaster/simple_twitter_post Makes it easy to update the twitter status of a configurable account with this interface: p = SimpleTwitterPost::Base.new p.post("Welcome our new m

[Rails] Re: backup rails project

2010-05-10 Thread Stephan Wehner
On May 10, 2:58 pm, David Zhu wrote: > If I did copy and paste my project folder into a flash drive, and then > after the restore i paste it back on the harddrive, would it still > work though? can i just run a rake db:migrate and then everything will > get migrated? or no? What's your database

[Rails] Re: need help about gzip

2010-05-08 Thread Stephan Wehner
On May 8, 1:24 pm, nirosh wrote: > thanks for the reply. i have complete my rails app and hosted on > hostmonster. but i dono how to enable the gzip on my app.i checked my > hosted app  with yslow > That shows like this "Grade F on Compress components with gzip". any > idea about this. Looks li

[Rails] Re: Hpricot files

2010-04-27 Thread Stephan Wehner
On Apr 27, 10:17 am, kevid wrote: > hi all, > > I need to make use of "Hpricot gem" > files. I don't want to install it as a gem. I copied lib/hpricot/*{all > files}  and lib/hpricot.rb  to my application. > > below is lib/hpricot.rb > > begin >   require 'encoding/character/utf-8' > rescue Load

[Rails] Re: Continously running a script

2010-04-21 Thread Stephan Wehner
On Apr 21, 7:17 am, "tashfeen.ekram" wrote: > Actually, I am interested in the former. That is, scan table and once > it is done start form the top again and scan again without any delay. http://cr.yp.to/daemontools.html should help (on Unix). Your Ruby script has an endless loop. daemontools

[Rails] Re: Problem with model validation with ajax

2010-03-22 Thread Stephan Wehner
Piotr Mąsior wrote: > Model is passed by @model variable with nested attributes so it is > like: > > @model = model.new > @model.build_another > > at form it is looped through like > > - form_for @account, :url => { :action => @given_action , :controller > => 'admin'} do |f| > - f.fields_for :

[Rails] Re: Problem with model validation with ajax

2010-03-22 Thread Stephan Wehner
Piotr Mąsior wrote: > So painful, I was wondering is there any dry_save or something like > this ? How do you populate your @model? Stephan -- 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 po

[Rails] Rails Configuration: use Proc's or method overrides?

2010-03-22 Thread Stephan Wehner
I came across a ticket by Craig Webster at https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4247-customising-asset-paths#ticket-4247-5 and found it quite interesting. Quote: This patch allows you to set the way that asset paths are rewritten. My own use case was to accommodat

[Rails] Re: DRY model validation question

2009-10-05 Thread Stephan Wehner
On Oct 5, 4:42 pm, Dudebot wrote: > Here's a question: > > I have the exact same validation code in 2 different models. > > OK, you're thinking, combine the models.  Not in this case. > > So, in Rails, is there a way to reference the same validation for 2 > different models? Commonly you can fin

[Rails] Re: How to specify working directory in config/database.yml?

2009-09-03 Thread Stephan Wehner
Josef Wolf wrote: > On Thu, Sep 03, 2009 at 12:02:05AM +0200, Stephan Wehner wrote: >> Josef Wolf wrote: > Thanks for your help, Stephan! > >> > So I am looking for a possibility to specify the directory relatively. >> > host: `pwd`/db/pgdata >> >

[Rails] Re: How to specify working directory in config/database.yml?

2009-09-02 Thread Stephan Wehner
Josef Wolf wrote: > Hello folks, > > I'd like to use postgresql with unix domain sockets for > testinng/development > to avoid mismatches when tests from multiple working copies are run > concurrently. > > I can almost get what I want with the following entry in > config/database.yml: > > t

[Rails] Re: opening database prompt based on database.yml

2009-05-23 Thread Stephan Wehner
Stephan Wehner wrote: > Frederick Cheung wrote: >> On May 17, 3:13�pm, Stephan Wehner >> wrote: >>> Rails projects, each possibly having different migrations which are >>> applied to different (mysql) databases. >>> >>> Opening a (mys

[Rails] Re: Referencing 'constant' record in db

2009-05-21 Thread Stephan Wehner
Colin Law wrote: > 2009/5/21 Stephan Wehner > >> >> > I am trying to avoid a db query each time I reference the (constant) id > when > the application is running, that was the idea of looking it up when the > class is loaded and saving in a constant (which does

[Rails] Re: Referencing 'constant' record in db

2009-05-21 Thread Stephan Wehner
Colin Law wrote: > Any thoughts anyone? > > Colin > > 2009/5/20 Colin Law I guess here are two, but your question looks vague. Does item.id == Item.named_scope_for_constant_record.id not become "the item satisfies the condition of the named_scope_for_constant_record" ? If for the

[Rails] "HTTP Parameter Pollution" and Rails

2009-05-20 Thread Stephan Wehner
Today there was a posting by Stefano di Paola to the Web Security Mailing List, http://www.webappsec.org/lists/websecurity about "HTTP Parameter Pollution", with a reference to his and Luca Carettoni presentation at http://www.owasp.org/images/b/ba/AppsecEU09_CarettoniDiPaola_v0.8.pdf Th

[Rails] Re: opening database prompt based on database.yml

2009-05-17 Thread Stephan Wehner
Frederick Cheung wrote: > On May 17, 3:13�pm, Stephan Wehner > wrote: >> Rails projects, each possibly having different migrations which are >> applied to different (mysql) databases. >> >> Opening a (mysql) prompt would require looking up the name of the >>

[Rails] Re: Test Driven Design and Rails Helpers

2009-05-17 Thread Stephan Wehner
Colin Law wrote: > I have a bit of a problem trying to implement using TDD. As I > understand it > the idea is to decide what you want the code to do, write a test to > check > that it does, then write the code and get it to pass the test. > > I keep coming across a problem with this, here is

[Rails] Re: action mailer on my local computer

2009-05-17 Thread Stephan Wehner
firelinemx wrote: > hi guys > i am newbie in ror. i wanna test my simple ror application on windows > xp. i use Webrick as my web server. > i don't know how to configure my action mailer for sending email to > another addresses? > > config.action_mailer.delivery_method = :smtp > config.action_mai

[Rails] Re: Using standard validation methods in custom validation metho

2009-05-17 Thread Stephan Wehner
Jim Burgess wrote: > Thanks for your reply > >> Looks like a case for allow_nil: >> >> validates_numericality_of :children, :allow_nil => true > > I created the field 'children' as a string (can't remember why, perhaps > because someone might enter 'none'??), so that doesn't work. > > Is ther

[Rails] Re: Using standard validation methods in custom validation metho

2009-05-17 Thread Stephan Wehner
Jim Burgess wrote: > >> you can even shorten that to >> >> validates_numericality_of :children, :if => Proc.new { |applicant| >> applicant.children !="" } >> > Looks like a case for allow_nil: validates_numericality_of :children, :allow_nil => true The documentation at http://ar.rubyonrails

[Rails] Re: saving the selected item

2009-05-17 Thread Stephan Wehner
Ghazaleh Mir wrote: > hello > i made a select list like this > > Married > Single > Divorced > > > how can i save the selected item into a field "stat" of the table > "user"? See the documentation for select at http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html S

[Rails] Re: mysql to postgres rake task

2009-05-17 Thread Stephan Wehner
magic_hat wrote: > Hey all. I'm trying to export my app's data from mysql to postgres in > advance of a database switch. > > I've tried this: > > task(:export => :environment) do > @users=User.find(:all) > ActiveRecord::Base.establish_connection(:pg) > for user in @users > us

[Rails] opening database prompt based on database.yml

2009-05-17 Thread Stephan Wehner
Hello everybody, I wrote a script to open a database prompt based on the contents of database.yml See the rdb_prompt directory under http://github.com/stephanwehner/railsgoodies I find it very useful, since I work with several different branches of Rails projects, each possibly having differ