[Rails] Re: Re: Re: How can I improvement concurrence performance?

2010-06-28 Thread Zhao Yi
Tim Teng wrote: > script/server will invoke webrick by default, and webrick of course is a > single thread server. So test your app with other servers and check > whether > it still performs poor. > > 在 2010年6月28日 下午4:48,Zhao Yi 写道: What do you mean by "other servers"

[Rails] Re: Re: How can I improvement concurrence performance?

2010-06-28 Thread Zhao Yi
Tim Teng wrote: > 很多时候不是硬件不行,是代码写得有问题,5-10个人就挂了可以肯定是代码写得有问题,你不会是用webrick在跑吧? > > 2010/6/25 Zhao Yi 我没有用webrick,就是用ruby script/server跑的 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk&q

[Rails] Re: Re: How can I improvement concurrence performance?

2010-06-27 Thread Zhao Yi
Peter Hickman wrote: > On 25 June 2010 09:47, Zhao Yi wrote: > > That sounds really bad. At peak times our system handle 1000's of > concurrent > requests and we rarely hit more than 8 seconds per request. > > How can I set this number of concurrent? Is 1000 th

[Rails] Re: Re: How can I improvement concurrence performance?

2010-06-27 Thread Zhao Yi
The log file is waiting at this line: ^[[4;35;1mCGI::Session::ActiveRecordStore::Session Update (0.96)^[[0m ^[[0mUPDATE `sessions` SET `updated_at` = '2010-06-28 03:20:03', `data` = 'BAh7CjoMcm9vdF9pZDA6DHVzZXJfaWRpADoOdXNlcl9uYW1lIgxidWlsZGVy\nOhFvcmlnaW5hbF91cmkiIC9idWlsZC91cGRhdGVfbWFr

[Rails] Re: How can I improvement concurrence performance?

2010-06-25 Thread Zhao Yi
I just tried. If one user run a time-caused job on Rails server. Other users have to wait until it finished. -- 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

[Rails] Re: How can I improvement concurrence performance?

2010-06-25 Thread Zhao Yi
Peter Hickman wrote: > First, what is your set up? > > What is the hardware you are running Rails on? It is running on 2G memory hardware with Fedora system. > What else is running on the machine that might impact Rails? There isn't any processes running on this machine. > What database are you

[Rails] nfsnobody problem

2010-06-25 Thread Zhao Yi
My Rails application write files on server disk but the user name and group of the file is nfsnobody. I am using Fedora system and the rails application start up with root. How can I change its user name and group name? Thanks -- Posted via http://www.ruby-forum.com/. -- You received this messa

[Rails] How can I improvement concurrence performance?

2010-06-25 Thread Zhao Yi
I found that if many users access to Rails at the same time, users will wait for a long time. How can I set the concurrence user number in Rails? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. T

[Rails] Re: How can I configure rails server connection number?

2009-08-06 Thread Zhao Yi
Sijo Kg wrote: > Hi >You can set pool in database.yml > > Read this > http://ryandaigle.com/articles/2008/9/7/what-s-new-in-edge-rails-connection-pools > > > Sijo I have set this value to 10. But if a user load a web page which cause a long time, other users will not load pages until this

[Rails] How can I configure rails server connection number?

2009-08-05 Thread Zhao Yi
How can I configure rails server connection number? This indicates how many clients can connect to a server at one time. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby

[Rails] Re: How can I pass Ruby object to another action?

2009-08-05 Thread Zhao Yi
Max Williams wrote: > You can't pass ruby objects from the form to the controller because the > browser has no concept of ruby or rails or any of that stuff. However, > you can build a hash to put into params like this > > <%= hidden_field_tag "foo[bar]", "hello" %> > > which creates this sit

[Rails] How can I pass Ruby object to another action?

2009-08-05 Thread Zhao Yi
I use form_tag like below: <% form_tag (my_action) %> <%= submit_tag "Submit" %> <% end %> In this case, how can I pass a Ruby object to "my_action" action? I want to pass a Hash to the next action. thanks. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~-

[Rails] Re: How to remove ^M at the end of each line?

2009-07-15 Thread Zhao Yi
Thanks. I think split is what I want. Another thing is that how I can remove the ^M from a string. I found that there is a method "replace" in string class. But it will replace the whole string, right? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~--

[Rails] Can I pass parameter in redirect_to

2009-07-10 Thread Zhao Yi
I use redirect_to to another action. Can I pass parameters to this action? -- 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

[Rails] How to remove ^M at the end of each line?

2009-07-09 Thread Zhao Yi
I got a string from "text_area_tag". Because the browser working on windows while my rails server working on linux, there is ^M at the end of each line. What I want to do is to remove this character and separate the string to an array. How can I do this? thanks. -- Posted via http://www.ruby-for

[Rails] Re: How can I check form input before submit?

2009-07-01 Thread Zhao Yi
OK, I understand. Thanks all your help. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@go

[Rails] Re: How can I check form input before submit?

2009-06-30 Thread Zhao Yi
Älphä Blüë wrote: > So, the first question you have to answer is what type of form are you > using? If you are using a form_for then that's backed by a model and > you can use validation checks. If you are using form_tag then that > isn't backed by a model and there are other ways of checking

[Rails] Re: How can I check form input before submit?

2009-06-30 Thread Zhao Yi
Älphä Blüë wrote: > You will want to use validation checks. > > http://guides.rubyonrails.org/activerecord_validations_callbacks.html This is the Active Record validation. I am looking for something like Action Controller validation( I am not sure whether rails has this feature). I want to val

[Rails] How can I check form input before submit?

2009-06-30 Thread Zhao Yi
I want to check user input in a form before submit. Is there a standard way to do this in Rails? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.

[Rails] Re: A problem about routing request

2009-03-31 Thread Zhao Yi
Nanyang Zhan wrote: > Zhao Yi wrote: > >> >> You have a nil object when you didn't expect it! >> The error occurred while evaluating nil.to_sym > > 贴出错误信息全文好查一点. The error track is shown below. /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action

[Rails] A problem about routing request

2009-03-31 Thread Zhao Yi
I created a scaffold and generated index, new, show, update, destory actions and its related views. When I open the index view, I will got the error: You have a nil object when you didn't expect it! The error occurred while evaluating nil.to_sym Extracted source (around line #15): 12: <%=h

[Rails] Re: How can I let rails working on non-block mode?

2009-03-31 Thread Zhao Yi
Siddick Ebramsha wrote: > > Use the -d option with the `ruby script/server` program. Then WEBrick > server will run as a daemon. How can i stop the rails server if using -d option? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received th

[Rails] How can I change the rails default page?

2009-03-31 Thread Zhao Yi
I start rails server and the default(http://localhost:3000) page would be Ruby on Rails welcome page. Can I change this page or redirect to a controller? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subs

[Rails] How can I render a partial from other controller?

2009-03-30 Thread Zhao Yi
I use this code to render a partial: <%= render :partial=>'test' %> The test is not located in the current controller. How can I point it to other place? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are su

[Rails] Re: How can I let rails working on non-block mode?

2009-03-30 Thread Zhao Yi
> > Hi, you should be able to configure the log_path by adding it to the > initializer block in your environment.rb. For example, > > Rails::Initializer.run do |config| > > ... > > # Note: By default, the log_path is set to log/#{environment}.log > config.log_path = > > end > This

[Rails] Re: How can I let rails working on non-block mode?

2009-03-30 Thread Zhao Yi
If I use "-d" to start the rails server, how can I stop 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

[Rails] Re: How can I let rails working on non-block mode?

2009-03-30 Thread Zhao Yi
Siddick Ebramsha wrote: > The logs will be in the log/development.log file. Can I specify a log file? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"

[Rails] Re: How can I let rails working on non-block mode?

2009-03-30 Thread Zhao Yi
Siddick Ebramsha wrote: > Zhao Yi wrote: >> When I run "ruby script/server" to start rails server, the current shell >> will be blocked and all the output from rails will be written to the >> current console. Does rails support a non-block mode and let the output

[Rails] How can I let rails working on non-block mode?

2009-03-29 Thread Zhao Yi
When I run "ruby script/server" to start rails server, the current shell will be blocked and all the output from rails will be written to the current console. Does rails support a non-block mode and let the output to be written to a specified log file? -- Posted via http://www.ruby-forum.com/. -

[Rails] How can I forward to different pages for different account

2009-03-24 Thread Zhao Yi
My web site has a login feature. What I want to do is to design different page for different account. But in an action, I couldn't use redirect_to more than one time. I am looking for a way like this: if account == "admin" redirect_to ... else redirect_to ... ... -- Posted via http://www

[Rails] Rails cross platform problem

2009-03-09 Thread Zhao Yi
My Rails working on a Linux system and a client access this server from Windows. The client inputs something in a text area and click submit, in the server side, it put the input into a file. The problem is that at the end of each line in the file, there is a "^M". How can I avoid this? I use File

[Rails] How can I set Rails user name?

2009-03-02 Thread Zhao Yi
I use root to start the Rails server. So all the operations on this server will be root permission. For example, create a file in the server disk. How can I change a user? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message be

[Rails] Re: How to use Time type in rails

2009-01-23 Thread Zhao Yi
jasoo24 wrote: > Do created_at and updated_at (via t.timestamps) get set properly? I > think you could try using t.timestamp (not plural) instead of t.time. > > Or, instead of using "sexy migrations", you could try doing it the old > way: > t.column :my_time_column, :datetime > > Hope this helps

[Rails] Re: How to link_to a file out side rails application

2009-01-22 Thread Zhao Yi
MaD wrote: > try to put send_file in an action of your controller. > http://www.railsbrain.com/api/rails-2.2.2/doc/index.html?a=M000167&name=send_file I use link_to to an action and in this action I use send_file method. In this action, how can I get the value of the link_to tag? -- Posted via

[Rails] Re: How to link_to a file out side rails application

2009-01-21 Thread Zhao Yi
Manmay wrote: > hi Zhao, > > u can use send_file to relate the file in u'r file system but not in > public dir of u'r rails proj like, > > send_file(RAILS_ROOT+"/images_uploaded/"+params[:filename] , > :disposition => 'inline') > I have tried but got undefined method `send_file' for # error,

[Rails] Re: How to use Time type in rails

2009-01-21 Thread Zhao Yi
Bobnation wrote: > Can you post your schema.rb? This is schema file: class CreateHistories < ActiveRecord::Migration def self.up create_table :histories do |t| t.string :user_name,:null=>false t.string :project_name,:null=>false t.string :view t.string :task t

[Rails] Re: How to link_to a file out side rails application

2009-01-21 Thread Zhao Yi
Rob Zolkos wrote: > Hi, > > Try this : > > <%= link_to "file", "http://www.mysite.com/the_file.doc"; %> > > Regards, > Rob My problem is that the file is not in Rails application. There is on "http://"; start. I just want to point to a local file in the server hard disk. For example: <%= lin

[Rails] Re: How to use Time type in rails

2009-01-21 Thread Zhao Yi
Bobnation wrote: > Are you using Time.now to assign the time? Yes, I use Time.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 t

[Rails] How to use Time type in rails

2009-01-21 Thread Zhao Yi
I defines a table and one of its column type is Time. I use ruby Time class to assign the value to this column, but it always generate Sat Jan 01 2000 time. Is the format different with the database and ruby class? I use MySql database in Linux. -- Posted via http://www.ruby-forum.com/. --~--~--

[Rails] How to link_to a file out side rails application

2009-01-21 Thread Zhao Yi
I want to link to a file outside rails application. It is a text file stored in rails server disk. When user click this link, the file will be open. How can I do this? thanks. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this mess

[Rails] Re: How cna I pop-up a dialog in a controller

2009-01-21 Thread Zhao Yi
alexey.Creopolis wrote: > oh god... > > render :update do |page| > page.alert('hello world') > end I have tried but it shows this message in the page: try { alert("hello world"); } catch (e) { alert('RJS error:\n\n' + e.toString()); alert('alert(\"hello world\");'); throw e } -- Posted via

[Rails] Re: How can I specify layout when using redirect_to

2009-01-21 Thread Zhao Yi
Colin Law wrote: > > Are you saying that after the redirect_to it shows the view from > views/builder/index.html.erb but uses the layout from > views/layouts/admin.html.erb instead of views/layouts/builder.html.erb? yes, it is the case. -- Posted via http://www.ruby-forum.com/. --~--~-

[Rails] Re: How cna I pop-up a dialog in a controller

2009-01-21 Thread Zhao Yi
raj vuppala wrote: > def alert(msg) > call 'alert' , message > end > > check this link > http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper/JavaScriptGenerator/GeneratorMethods.html#M001452 > > try once.. > > On Wed, Jan 21, 200

[Rails] Re: How cna I pop-up a dialog in a controller

2009-01-20 Thread Zhao Yi
raj vuppala wrote: > hi, > Try with alert () > using java script... > > On Tue, Jan 20, 2009 at 11:50 PM, Zhao Yi I got undefined method `alert` error in my controller. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ Yo

[Rails] How cna I pop-up a dialog in a controller

2009-01-20 Thread Zhao Yi
I want to pop-up a warning dialog in a controller. How can I do 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, sen

[Rails] Error: Called id for nil, which would mistakenly be 4

2009-01-20 Thread Zhao Yi
I define a class: class BuildLogger @@build_logger=nil def self.get_build_logger(file_name=nil) if @@build_logger == nil ###this line will thrown an error @@build_logger=Logger.new("build_logger") @@build_logger.level = DEBUG end return @@build_logger end end

[Rails] Re: A question about backgroundrb

2009-01-20 Thread Zhao Yi
Can anyone help me on this? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups

[Rails] Re: How can I specify layout when using redirect_to

2009-01-20 Thread Zhao Yi
When I use "redirect_to ({:controller=>'builder', :action=>'index'}) ", I have specify the controller is builder, it should use builder layout, right? But it still in admin layout. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this

[Rails] How can I specify layout when using redirect_to

2009-01-19 Thread Zhao Yi
I use redirect_to in this way: class AdminController < ApplicationController def logout redirect_to ({:controller=>'builder', :action=>'index'}) end end this code is in the controller "admin". when this action is invoked, the page will be changed but still in admin layout. How c

[Rails] A question about backgroundrb

2009-01-15 Thread Zhao Yi
I use backgroundrb to run task in background. But when I invoke a worker defined in backgroundrb, I will get this error: can't dump TCPSocket vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_connection.rb:72:in `dump' vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_connection.rb:72:in `dump_

[Rails] Re: Backgroundrb problem uninitialized constant BackgrounDRb::Me

2009-01-15 Thread Zhao Yi
Hemant Kumar wrote: > On Thu, Jan 15, 2009 at 10:44 AM, Zhao Yi > wrote: >> >> vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb:72:in >> `run_method' >> vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb:25:in >> `meth

[Rails] Re: Backgroundrb problem uninitialized constant BackgrounDRb::Me

2009-01-14 Thread Zhao Yi
Hemant Kumar wrote: > On Thu, Jan 15, 2009 at 10:44 AM, Zhao Yi > wrote: >> >> vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb:72:in >> `run_method' >> vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb:25:in >> `meth

[Rails] Re: Backgroundrb problem uninitialized constant BackgrounDRb::Me

2009-01-14 Thread Zhao Yi
> examples are right there in the docs. For example to invoke the worker: > > MiddleMan.worker(:foo_worker,"my_secret_worker_key").async_do_foo() thanks it works. but when I call this method I will get this error. I have started backgroundrb server. can't dump TCPSocket vendor/plugins/backg

[Rails] Re: Backgroundrb problem uninitialized constant BackgrounDRb::Me

2009-01-14 Thread Zhao Yi
I know what wrong. I should use this code: used_job_key = MiddleMan.new_worker(:worker => :foo_worker,\ :worker_key => "my_secret_job_key") to get a worker. But after this, how can I invoke the worker with this key? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~--

[Rails] Re: Backgroundrb problem uninitialized constant BackgrounDRb::Me

2009-01-14 Thread Zhao Yi
I think this is because I didn't require the MetaWorker in my worker. Do you know how to require this worker? I have tried "require 'backgroundrb'" but "no such file to load" error will be thrown. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~

[Rails] Re: Backgroundrb problem uninitialized constant BackgrounDRb::Me

2009-01-14 Thread Zhao Yi
Hemant Kumar wrote: > There is something wrong with your setup. MetaWorker shouldn't be even > shown in controller/rails part of things. > > Can you post your worker code and how are you invoke BackgrounDRb > worker tasks from rails? This is my worker definition. I use ruby script/generate worke

[Rails] Re: Backgroundrb problem uninitialized constant BackgrounDRb::Me

2009-01-13 Thread Zhao Yi
Zhao Yi wrote: > I installed backgroundrb from http://svn.devjavu.com/backgroundrb/trunk > and there is no problem to start backgroundrb server. but when view the > page which controller requires the worker, I will get the error > "uninitialized constant BackgrounDRb::MetaWor

[Rails] Backgroundrb problem uninitialized constant BackgrounDRb::Me

2009-01-11 Thread Zhao Yi
I installed backgroundrb from http://svn.devjavu.com/backgroundrb/trunk and there is no problem to start backgroundrb server. but when view the page which controller requires the worker, I will get the error "uninitialized constant BackgrounDRb::MetaWorker". Is this the problem that I didn't requi

[Rails] Re: How can I install backgroundrb

2009-01-09 Thread Zhao Yi
yes I mean svn. thanks I installed it successfully. -- 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 rubyonr

[Rails] How can I get other field value?

2009-01-09 Thread Zhao Yi
I use this code to get other field value: <%= hidden_field_tag 'project_version_select', $('other_id').getValue()%> but I got compile error. How can I get the value? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message becaus

[Rails] Re: How can I install backgroundrb

2009-01-09 Thread Zhao Yi
Matt Harrison wrote: > Zhao Yi wrote: >> Author: Scott Chacon >> Installed at: d:/ruby/lib/ruby/gems/1.8 >> >> A package for using Git in Ruby code. > > That would appear to be the ruby interface to git. You need to have the > compiled git applica

[Rails] Re: How can I check whether an id existed?

2009-01-09 Thread Zhao Yi
Sijo Kg wrote: > if($('id')){ > val = $F('id') > } Can I put them in *.html.erb? I got a compile error. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Ta

[Rails] How can I check whether an id existed?

2009-01-09 Thread Zhao Yi
How can I check whether an ID existed in the current page? I want to use the $('id').getValue() to get the field value. But sometimes the ID may not exist. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are su

[Rails] Re: How can I install backgroundrb

2009-01-09 Thread Zhao Yi
John Yerhot wrote: > Is Git installed? yes, I have installed git: gem list -d git *** LOCAL GEMS *** git (1.0.5) Author: Scott Chacon Installed at: d:/ruby/lib/ruby/gems/1.8 A package for using Git in Ruby code. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~-

[Rails] How can I install backgroundrb

2009-01-09 Thread Zhao Yi
I followed the install instruction to install backgroundrb from http://backgroundrb.rubyforge.org/. But when running "git clone git://github.com/gnufied/backgroundrb.git" command, I got the error of no such command git. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~--

[Rails] How can I set selected value on select_tag

2009-01-09 Thread Zhao Yi
This is my select_tag code: <%=select_tag 'project_version_select', options_for_select(@project_versions)%> How can I set the selected value for this select box? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because yo

[Rails] How can I let plugin go through proxy

2009-01-08 Thread Zhao Yi
I use script/plugin to install plugins. but how to configure the proxy hostname it uses? -- 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

[Rails] Re: How to run a background task in rails

2009-01-08 Thread Zhao Yi
Vishwanath Nayak wrote: > Hi, > > What sort of tasks do you intend to do? > Database/ file system/ operating system oriented, appropriate approach > can > be decided depending on these > > - NAYAK The task is building source code with gcc. -- Posted via http://www.ruby-forum.com/. --~--~

[Rails] How to run a background task in rails

2009-01-07 Thread Zhao Yi
I need to run a background task which should last several hours. How can I do this in rails? -- 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

[Rails] Re: A problem of ignoring newline in textarea

2009-01-07 Thread Zhao Yi
Ryan Bigg wrote: > no, you don't have to write the \n. > > When people type new lines it automatically puts in the \n, or in some > cases a \r\n. > > This means simple_format will work. > - > Ryan Bigg > Freelancer > http://frozenplague.net thanks it works. -- Posted via http://www.ruby-fo

[Rails] Re: A problem of ignoring newline in textarea

2009-01-07 Thread Zhao Yi
Ryan Bigg wrote: > simple_format(your_text_here) > - > Ryan Bigg > Freelancer > http://frozenplague.net In this way, I have to write \n in the textarea which is not a good user interface. How can I do some background job to replace the textarea before it is submitted? -- Posted via http://

[Rails] Re: A problem of ignoring newline in textarea

2009-01-07 Thread Zhao Yi
srj wrote: > You should not try that because the text area is designed to wrap text > automatically - there really are not new line characters in the text > area, unless you manually inserted them. In that case, they should > remain. I have input "\n" at each line of the text, but it doesn't wor

[Rails] A problem of ignoring newline in textarea

2009-01-07 Thread Zhao Yi
I use text_area_tag in a view page and when its action get its value by params[:id], all the newline will be removed. How can I keep the format of textarea? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are s

[Rails] How does observe_field work recursively

2009-01-06 Thread Zhao Yi
I use observe_field in a view page to monitor a field (field1). Whenever field1 changed, a action will render a partial (partial1). In partial1, I use observe_field to monitor a field (field2). so the problem is: when a user changed the field1, its action will set some variables and render the pa

[Rails] Re: A question about render

2009-01-06 Thread Zhao Yi
Can anyone help me on this? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.c

[Rails] Re: Why render doesn't work

2009-01-06 Thread Zhao Yi
Frederick Cheung wrote: > That's just the way it is, divs aren't allowed there (just as you > can't do either). Try putting your html > through the w3c validator > > Fred A render must be in an element. If I can't use div in this case, how can I render it? -- Posted via http://www.ruby-forum.co

[Rails] Re: Why render doesn't work

2009-01-06 Thread Zhao Yi
Frederick Cheung wrote: > > I don't believe it's legal HTML to have a div there. > > Fred Why? Could you tell me what wrong with my code? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to th

[Rails] Why render doesn't work

2009-01-06 Thread Zhao Yi
I use render in a view page like this: <% form_for :project do |form| %> <%= select_tag:project_selection,options_for_select(@project_names) %> <%= observe_field :project_selection, :frequency => 0.5, :update => 'project_version_ajax', :url => {:action => 'update

[Rails] A question about render

2009-01-06 Thread Zhao Yi
I faced a problem about render. This is my view page: <%= render :partial=>'test1'%> In _test1.html.erb: <%=select_tag 'database_select', options_for_select(@databases)%> <%=text_field_tag 'table', @table_name,:size=>30%> You can see that in the partial page, I use and element

[Rails] Re: How to render more than one partial?

2009-01-04 Thread Zhao Yi
Hi, Thanks very much for your explaining. You are right. I can make it more simple. thanks again. Zhao Yi -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Rub

[Rails] Re: How to render more than one partial?

2009-01-04 Thread Zhao Yi
pepe wrote: > Another sample based on the original listed above. You cold leave in > your page: > > <%= :render :partial => 'your_A_and_B_partial' %> > > > <%= :render :partial => 'your_C_and_D_partial' %> > > > If 'your_A_and_B_partial' delivers: > Text A > Text B > > And 'your_C_an

[Rails] Re: How to render more than one partial?

2009-01-02 Thread Zhao Yi
pepe wrote: > Hello. > > I don't see anything wrong with this code. Do you want to do something > different than this? I guess I am not understanding the problem? > > On Dec 31 2008, 6:07�am, Zhao Yi I mean in this way, I have to split the tag. Take this

[Rails] An error of Missing template

2009-01-02 Thread Zhao Yi
I use observe_form to monitor a form, whenever a field changed in this form, an (Missing template builder/update_make_view_info.js.erb...) error will be thrown. I don't want to use js format. I want to use html.erb format. How can I avoid it and why it looks for update_make_view_info.js.erb? This

[Rails] How to get which field changed in observe_form helper

2009-01-02 Thread Zhao Yi
I use observe_form to monitor all the fields in a form. But how can I get which field changed? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. T

[Rails] what is the id of the form_for

2008-12-31 Thread Zhao Yi
I used form_for to generate a form, but what is the ID of this form, how can I specify a ID for it. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" gro

[Rails] Does observe_field work in a partial

2008-12-31 Thread Zhao Yi
I defined a partial and put an observe_field in this partial, but it doesn't invoke the action when the field changed, this is the code: <%=select_tag 'project_version', options_for_select(@project_versions)%> <%= observe_field :project_version, :update=>'view_name', :url=>{:action=>'up

[Rails] Re: How to render more than one partial?

2008-12-31 Thread Zhao Yi
Ramu wrote: > Your code will does this job. > > Is your problem some thing like: > you have a.rhtml file > int that you have to show _b.rhtml file contents as well as _c.rhtml > contents? > > Then write your code like this: > > == This is a.rhtml file > > <%= render :partial=>'b'%> > > <%

[Rails] Re: How to get select_tag value in controller?

2008-12-31 Thread Zhao Yi
zero0x wrote: > I suppose you're using prototype, so you just need to get the value of > the select box. > > $("id-of-the-element").getValue() > > > > On 28. Dec., 15:04 h., Zhao Yi How can I send more than one parameters? -

[Rails] Re: How to render more than one partial?

2008-12-31 Thread Zhao Yi
Ryan Bigg wrote: > Render the other partial inside that partial. > - > Ryan Bigg > Freelancer > http://frozenplague.net Sorry, I am confused. This piece of code is my case: Version: <%= render :partial=>'project_version'%> View Name: <%= re

[Rails] How to render more than one partial?

2008-12-30 Thread Zhao Yi
I want to render more than one partial in this code: render :partial => 'project_version' how can I do this? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails

[Rails] How to update table column?

2008-12-30 Thread Zhao Yi
There is a table existed in sqlite3 database. I want to change a column type in this table. I modified the file db/migrate/20081229_create_project.rb and run "rake db:migrate". But it doesn't update the table. How can I update the table with the new definition. -- Posted via http://www.ruby-f

[Rails] Re: A question about ajax

2008-12-30 Thread Zhao Yi
I know what the problem. I set up a wrong update value in observe_field element. -- 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 thi

[Rails] Re: A question about ajax

2008-12-30 Thread Zhao Yi
isplay the same. > But if you change the value of @project.version after the partial is > loaded, > it would not be reflected on the page until you reload the particular > div > which has the text field tag with the partial. > > -NAYAK > > On Tue, Dec 30,

[Rails] A question about ajax

2008-12-30 Thread Zhao Yi
I defines a partial see below: <%= puts @project.version text_field_tag "project_version", @project.version %> I want the project version update-to-date. The first line can print the correct version value but the text field doesn't refresh to the new version. -- Posted via http://www.ruby-fo

[Rails] Re: How to get select_tag value in controller?

2008-12-28 Thread Zhao Yi
Frederick Cheung wrote: > You have to tell remote function what to submit, it's not going to > guess for you. > This is what the :with option for remote_function is for. Check the > docs for link_to_remote for some examples, I've got some extra ones at > http://www.spacevatican.org/2008/5/17/with

[Rails] Re: How to get select_tag value in controller?

2008-12-28 Thread Zhao Yi
es with the values :) > > On 28. Dec., 14:08 h., Zhao Yi In this case: select_tag: project_selection,options_for_select(@project_names), :onchange =>remote_function(:update=>'posts',:loading=>'false', :url => { :action => :update_project_selection

[Rails] How to get select_tag value in controller?

2008-12-28 Thread Zhao Yi
I use select_tag to create a selection box in a view and how can I get the current selection value in its controller? For example: select_tag:project_selection,options_for_select(@project_names), :onchange =>remote_function(:update=>'posts',:loading=>'false', :url => { :action

[Rails] Re: How to set onclick function for select_tag?

2008-12-26 Thread Zhao Yi
Phlip wrote: > In HTML it's: > >onclick='Ajax.Request(...)' > > In Ruby that's :onclick => 'Ajax.Request(...)', natch. > > To get the ... part, write remote_function or link_to_remote into a web > page and > view its source. That will show you how to pack the Request arguments. > > -- >

[Rails] Re: How to get one columns as an array from database

2008-12-25 Thread Zhao Yi
Ryan wrote: > A more efficient way is to do this is: > > @project_names = Project.all(:select => 'name').map(&:name) Yes the map is what I am looking for. thanks. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because

[Rails] Re: How to get one columns as an array from database

2008-12-25 Thread Zhao Yi
Ryan wrote: > I think it's been around since Rails 2.1 > > Project.first > Project.last > Project.all > > all work. I think the first last and all refers to rows. I want to select columns. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You rece

  1   2   >