[Rails] Re: cookies are mandatory for Rails app?

2009-05-26 Thread SpringFlowers AutumnMoon
Robert Walker wrote: >> that's the concern... turning off cookie broke my Rails app. > > Generally speaking, yes it will. Just like it will break almost any web > application Rails or otherwise. :) or to put it this way, if to make the Rails app work even when user turns off cookie, is there

[Rails] Re: cookies are mandatory for Rails app?

2009-05-26 Thread SpringFlowers AutumnMoon
Roderick van Domburg wrote: > So theoretically: no, Rails apps don't require cookies. But what are the > practical reasons to be concerned about them? because i was trying a Rails app (from the book Simply Rails 2.0)... and at the "Flash" part, (not Adobe Flash), it talks about next action pa

[Rails] Re: a way that helper functions not produce XHTML but HTML?

2009-05-26 Thread SpringFlowers AutumnMoon
Marnen Laibow-Koser wrote: > The idea that it won't be understood is simply false. Leaving aside the > questionable accuracy of the 66% figure, http://en.wikipedia.org/wiki/Usage_share_of_web_browsers > it is a fact that all browsers > *do* understand XHTML served as I have outlined above

[Rails] Re: a way that helper functions not produce XHTML but HTML?

2009-05-25 Thread SpringFlowers AutumnMoon
Marnen Laibow-Koser wrote: > Yes it is. HTML is an obsolescent standard, basically simply a matter > of backwards compatibility at this point. XHTML is the way forward, for > reasons I've already explained. If you follow the procedure I have > recommended, XHTML does not even cause problems

[Rails] Re: a way that helper functions not produce XHTML but HTML?

2009-05-25 Thread SpringFlowers AutumnMoon
Marnen Laibow-Koser wrote: > SpringFlowers AutumnMoon wrote: > [...] >> hm... so the XHTML will just be used as html... > > Not really; the DOCTYPE still tells the browser that it's XHTML. except IE use it as HTML. > and we aim to output it >> as XHTML anyway.

[Rails] how does form_for and validate_presence_of work hand in hand

2009-05-25 Thread SpringFlowers AutumnMoon
when we have validate_presence_of :name in the model and then when we put in the create action that we re-render 'new', then the form_for will populate the fields, and error_messages_for 'story' will have the correct error message. this is really great, and and the same time, this looks like magi

[Rails] Re: a way that helper functions not produce XHTML but HTML?

2009-05-25 Thread SpringFlowers AutumnMoon
Marnen Laibow-Koser wrote: > The Wikipedia article seems to say that this is not really a problem if > the XHTML is served as text/html, which is what Rails does by default. hm... so the XHTML will just be used as html... and we aim to output it as XHTML anyway... pragmatically, it will work.

[Rails] cookies are mandatory for Rails app?

2009-05-25 Thread SpringFlowers AutumnMoon
is it true that Rails depend on cookies? It seems that flash is a part of session, and session uses cookies... so when i disable cookie in Firefox, what was working became ActionController::InvalidAuthenticityToken so is it true that for a RoR app to work, cookies are mandatory? -- Posted via

[Rails] Re: a way that helper functions not produce XHTML but HTML?

2009-05-25 Thread SpringFlowers AutumnMoon
Marnen Laibow-Koser wrote: > If I remember correctly, IE *does* support XHTML from version 6, if not > before, so long as you have the proper DOCTYPE declaration. I would > guess that quirksmpde.org would have more information. I think on SitePoint and StackOverflow.com, they usually say XHTM

[Rails] Re: a way that helper functions not produce XHTML but HTML?

2009-05-25 Thread SpringFlowers AutumnMoon
Marnen Laibow-Koser wrote: > SpringFlowers AutumnMoon wrote: >> >> >> I would like to use HTML 4.01 Strict, and used a DOCTYPE of it in my >> application template. > [...] > > Why? XHTML is definitely the way to go these days. coz IE doesn't supp

[Rails] a way that helper functions not produce XHTML but HTML?

2009-05-24 Thread SpringFlowers AutumnMoon
I would like to use HTML 4.01 Strict, and used a DOCTYPE of it in my application template. But look like when a style sheet is included by a helper function <%= stylesheet_link_tag 'style' %> the code produced is XHTML: is there a way to ask Rails to use HTML instead of XHTML? -- Poste

[Rails] is f.submit in a form_for newer than submit_tag?

2009-05-24 Thread SpringFlowers AutumnMoon
some books or even the rails api uses form_for ... ... submit_tag ... end and i found that the Rails 2.3.2 Scaffold uses f.submit "Go" instead... and this is not in the rails api doc. Is this a new addition and is it suppose to replace submit_tag? -- Posted via http://www.ruby-forum.com

[Rails] Re: what is kENSURE and kEND in error message?

2009-05-24 Thread SpringFlowers AutumnMoon
Roderick van Domburg wrote: > SpringFlowers AutumnMoon wrote: >> how about the kENSURE ? and... why the "k" attached in front? thanks. > > K is for keyword; the keyword ensure. It seems like you have a > ensure..end block without the appropriate "begin&quo

[Rails] do you think we should make <%= # comment %> not cause error

2009-05-24 Thread SpringFlowers AutumnMoon
the code <% # some code %> will not cause any error, but the code <%= # some code %> will cause an error. the argument is that the second statement is like output << and so it is an error. But I think since puts "hello" and puts both can run and cause no error, why not make

[Rails] why does this comment create a compile error

2009-05-24 Thread SpringFlowers AutumnMoon
there is a line displayed within <%= h @stories.inspect %> and the output was too long, so i changed it to <%= #h @stories.inspect %> <% @stories.each do |s| %> <%= h s.inspect %> <% end %> (commenting out the first line). now the code will fail to compile... saying compile error /Users

[Rails] what is kENSURE and kEND in error message?

2009-05-24 Thread SpringFlowers AutumnMoon
I sometimes get an error on the page as: compile error /Users/jian/ror/shov2/app/views/stories/index.html.erb:13: syntax error, unexpected kENSURE, expecting ')' /Users/jian/ror/shov2/app/views/stories/index.html.erb:15: syntax error, unexpected kEND, expecting ')' the kEND, i can gu

[Rails] why does form_for @story has to have Story as RESTful

2009-05-24 Thread SpringFlowers AutumnMoon
it seems that when we use form_for @story do |f| then Story has to be a RESTful resource and it has to be map.resources :stories in the routes.rb? can Story be not RESTful? Can it be a form for non-RESTful data? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~

[Rails] does map.resources :stories immediately make Story RESTful?

2009-05-24 Thread SpringFlowers AutumnMoon
I was reading Simply Rails by Patrick Lenz... maybe I missed something, it seems that whenever we put map.resources :stories in routes.rb then immediately, the controller will have special conventions and now Story is a RESTful resource? Maybe the author used the word resource but didn't ment

[Rails] Re: why do we use form_for @story do |f| when there is no loop?

2009-05-24 Thread SpringFlowers AutumnMoon
Marnen Laibow-Koser wrote: >> so i think the block method will save the begin_form and end_form >> because it automatically add the begin and end before calling the block. >> is that the main benefit? > > Oh, now I see what you mean about the syntax. Yes, that's sort of it. > Read more about

[Rails] Re: why do we use form_for @story do |f| when there is no loop?

2009-05-24 Thread SpringFlowers AutumnMoon
Andrew Timberlake wrote: > On Sun, May 24, 2009 at 11:32 AM, SpringFlowers AutumnMoon > wrote: >> > I think it's important that you forget about the loop and focus on > blocks, once you've understood blocks, it will no longer look like a > loop and you'll unde

[Rails] why do we use form_for @story do |f| when there is no loop?

2009-05-24 Thread SpringFlowers AutumnMoon
we use (1..10).each do |i| p i end so that a value is "yield" to i in a block... but what about <% form_for @story do |f| %> <%= f.text_field %> <% end %> there is no loop at all... why do we need to make it look like a loop? Can't we do it without making it look like a loop? (write in a

[Rails] Re: why does number of hits per second go from 1800 to 20?

2009-04-23 Thread SpringFlowers AutumnMoon
Brendon Whateley wrote: > Sure it can test any web server. I just meant that since it is part > of the apache package not everybody would have it installed. > > On Apr 23, 12:33�pm, SpringFlowers AutumnMoon http://www.ruby-forum.com/. --~--~-~--~~~---~

[Rails] Re: why does number of hits per second go from 1800 to 20?

2009-04-23 Thread SpringFlowers AutumnMoon
SpringFlowers AutumnMoon wrote: > Brendon Whateley wrote: >> I didn't suggest ab or a bunch of other tools since he may not have >> apache installed... but if he does, then that is better! > > actually, isn't ab just to test how the server performed? i used it and

[Rails] Re: why does number of hits per second go from 1800 to 20?

2009-04-23 Thread SpringFlowers AutumnMoon
Brendon Whateley wrote: > I didn't suggest ab or a bunch of other tools since he may not have > apache installed... but if he does, then that is better! actually, isn't ab just to test how the server performed? i used it and it worked to test RoR on my macbook. thanks. -- Posted via http://w

[Rails] Re: why does number of hits per second go from 1800 to 20?

2009-04-23 Thread SpringFlowers AutumnMoon
pharrington wrote: > Well, the simpler way to do the above would be what Frederick > mentioned and use ab: > > ab -n 1000 -c 20 http://local:3000/page/to/benchmark > > You also get the bonus of getting a rough idea of how well your app > handles concurrent requests before choking. great. that

[Rails] Re: what escape or sanitize functions are out there?

2009-04-22 Thread SpringFlowers AutumnMoon
PP Junty wrote: > i have been using the xss_terminate plugin: > > http://github.com/look/xss_terminate/tree/master > > basically it sanitizes values before they are stored in the database: > > "Installing the plugin creates a +before_save+ hook that will strip HTML > tags > from all string and

[Rails] Re: why does number of hits per second go from 1800 to 20?

2009-04-22 Thread SpringFlowers AutumnMoon
Frederick Cheung wrote: > On 22 Apr 2009, at 21:39, SpringFlowers AutumnMoon wrote: > >> >> how is my test flawed? > > Exactly as I explained previously: you are benchmarking how long it > takes to render an erb template, but there's a lot of other bits of &

[Rails] Re: why does number of hits per second go from 1800 to 20?

2009-04-22 Thread SpringFlowers AutumnMoon
Ilan Berci wrote: > Change this: >> <% t = Time.now %> >> Hello#index >> Find me in app/views/hello/index.rhtml >> >> >> <% for i in 1..100 do %> >> <%= Time.now %> >> <%= h @ha %> >> <%= sanitize @ha %> >> <%= u @ha %> >> <%= @ha.to_json %> >> <%= strip_tags @ha %> >> >> <%= Time

[Rails] Re: why does number of hits per second go from 1800 to 20?

2009-04-22 Thread SpringFlowers AutumnMoon
Frederick Cheung wrote: > after the 1st iteration through the loop you have used (aparently) > 1/1800 of a second. > having done 100 iterations, you've used 1/20th of a second ie aprox > 1/1800 * 100. How is it a surprise that doing something 100 times > takes roughly 100 times as long as doing i

[Rails] why does number of hits per second go from 1800 to 20?

2009-04-22 Thread SpringFlowers AutumnMoon
i had the following code to ball-park the number of possible hits per second my macbook can support: <% t = Time.now %> Hello#index Find me in app/views/hello/index.rhtml <% for i in 1..100 do %> <%= Time.now %> <%= h @ha %> <%= sanitize @ha %> <%= u @ha %> <%= @ha.to_json %> <%= st

[Rails] Re: need to restart server every time a controller is generated?

2009-04-22 Thread SpringFlowers AutumnMoon
Philip Hallstrom wrote: >>> You need to restart the server when you add controllers. If you are >>> just changing them then you don't. >> >> oh i just tried Rails 1.2.6 on my macbook. seems like here, we don't >> need to restart server. maybe we only need to restart when it is >> Rails >> 2.0

[Rails] Re: how many hits per second can Rails support on dreamhost?

2009-04-22 Thread SpringFlowers AutumnMoon
SpringFlowers AutumnMoon wrote: > i wonder what is a ballpark number that Rails can support for number of > hits per second, if we are hosting RoR on > > 1) dreamhost or netfirms > 2) as a separate virtual server > 3) as a standalone machine > > maybe even 1 hit per

[Rails] Re: need to restart server every time a controller is generated?

2009-04-22 Thread SpringFlowers AutumnMoon
Philip Hallstrom wrote: > On Apr 22, 2009, at 7:14 AM, SpringFlowers AutumnMoon wrote: > >> >> but if i don't restart the server, it will say for localhost:3000/bar >> >> Routing Error >> >> No route matches "/bar" with {:method=>:ge

[Rails] how many hits per second can Rails support on dreamhost?

2009-04-22 Thread SpringFlowers AutumnMoon
i wonder what is a ballpark number that Rails can support for number of hits per second, if we are hosting RoR on 1) dreamhost or netfirms 2) as a separate virtual server 3) as a standalone machine maybe even 1 hit per second can be ok if that means 86400 page view can be served per day... if

[Rails] what escape or sanitize functions are out there?

2009-04-22 Thread SpringFlowers AutumnMoon
i found the following functions or method to escape HTML, URL params, or Javascript data: <%= h @ha %> <%= sanitize @ha %> <%= u @ha %> <%= @ha.to_json %> <%= strip_tags @ha %> are they more functions or methods to do these things? and are there alternative ways to do that? thanks. -- Posted

[Rails] need to restart server every time a controller is generated?

2009-04-22 Thread SpringFlowers AutumnMoon
i thought we don't need to restart the server by ruby script/server after we use ruby script/generate controller Bar index help ? but if i don't restart the server, it will say for localhost:3000/bar Routing Error No route matches "/bar" with {:method=>:get} is it true that we need to

[Rails] now it says sqlite.dll is missing... how to solve?

2009-04-22 Thread SpringFlowers AutumnMoon
i pretty much follow everything from http://agilo.us/2009/03/15/rails-on-windows/ except i used gem install -v1.2.3 sqlite3-ruby and now if i create a new project and use http://localhost:3000 and click on a javascript dialog pops up saying sqlite3.dll is missing. anyone knows how to solve

[Rails] how come "gem install sqlite3-ruby" will fails on PC?

2009-04-22 Thread SpringFlowers AutumnMoon
I wonder why gem install sqlite3-ruby will fail on a PC with Vista? when i do a search on google for sqlite3-ruby, I see that 1.2.4 was actually done in August 2008. So does that mean for 8 months (from 2008-08 to 2009-04), it was breaking all people using a PC? turns out that it needs to be

[Rails] Re: still cannot install rails on windows

2009-04-21 Thread SpringFlowers AutumnMoon
Marnen Laibow-Koser wrote: > SpringFlowers AutumnMoon wrote: > [...] >> >> when generating the app, i just use >> >> rails fourth >> >> so is it default to sqlite if i am using the most recent rails? thanks. > > Probably -- but don't wast

[Rails] Re: still cannot install rails on windows

2009-04-21 Thread SpringFlowers AutumnMoon
Frederick Cheung wrote: > On Apr 21, 9:34�pm, SpringFlowers AutumnMoon l...@andreas-s.net> wrote: >> changed? thanks. >> > The important thing is what you specified when you generated the > application, or what you have since set it to use. those settings live > in y

[Rails] Re: still cannot install rails on windows

2009-04-21 Thread SpringFlowers AutumnMoon
Frederick Cheung wrote: > On Apr 21, 7:24�pm, SpringFlowers AutumnMoon l...@andreas-s.net> wrote: >> >> great, thanks, this works... although the Javascript popup still says >> about libmysql.dll is missing. �how come it is looking for mysql stuff? >> i thought sq

[Rails] Re: still cannot install rails on windows

2009-04-21 Thread SpringFlowers AutumnMoon
Frederick Cheung wrote: > On Apr 21, 6:20�pm, SpringFlowers AutumnMoon l...@andreas-s.net> wrote: >> if i follow the instructions on: >> >> http://agilo.us/2009/03/15/rails-on-windows/ >> >> the command >> >> gem install sqlite3-ruby >> >

[Rails] can i update rails to the latest version using Instant Rails

2009-04-21 Thread SpringFlowers AutumnMoon
If using Instant Rails, is it possible to update everything to the latest version by bringing up a Ruby Console from Instant Rails and do a gem install rails ? also, Install Rails kept on complaining that an app is already running at the specified port... turns out I just need to turn off Vista

[Rails] Re: still cannot install rails on windows

2009-04-21 Thread SpringFlowers AutumnMoon
HeChian wrote: > About libmysql.dll, you can download MySQL Windows Version and copy > the libmysql.dll to C:\Windows\System32 > And, I think you can download InstantRails to learn how to develop > rails application on Windows if you are a newbie. > Good luck. > i thought Rails 2 use SQLite as t

[Rails] still cannot install rails on windows

2009-04-21 Thread SpringFlowers AutumnMoon
if i follow the instructions on: http://agilo.us/2009/03/15/rails-on-windows/ the command gem install sqlite3-ruby will give - Building native extensions. This could take a while... ERROR: Error installing sqlite3-ruby: ERROR: Failed to build gem nati

[Rails] Re: cannot install the current Rails on 3 machines

2009-04-19 Thread SpringFlowers AutumnMoon
Frederick Cheung wrote: > On Apr 18, 5:24�pm, SpringFlowers AutumnMoon l...@andreas-s.net> wrote: >> >> i get: � (is it sqlite3 needed? �is it mentioned in the set up page?) > > It is if you want to use a sqlite3 database (in which case you need > the sqlite3-

[Rails] cannot install the current Rails on 3 machines

2009-04-18 Thread SpringFlowers AutumnMoon
i follow the instructions on http://rubyonrails.org/download to install RoR, and on all 3 machines, they all cannot go past the front page: for example, when i click on About your application’s environment i get: (is it sqlite3 needed? is it mentioned in the set up page?) thanks. C:\proj\

[Rails] Re: How to pass data to Javascript variable from Ruby on Rai

2009-04-14 Thread SpringFlowers AutumnMoon
by the way, sanitize and strip_tags work as follows: var v = 1; var s = <%= sanitize(@s).to_json %>; var t = <%= strip_tags(@s).to_json %>; document.getElementById('divForS').innerHTML = s + v; document.getElementById('divForT').innerHTML = t + v; the HTML generated is: var s = "Bill

[Rails] Re: How to pass data to Javascript variable from Ruby on Rai

2009-04-14 Thread SpringFlowers AutumnMoon
Marnen Laibow-Koser wrote: > SpringFlowers AutumnMoon wrote: > [...] >> however, isn't it true that if we ever need to set the title into the >> div's innerHTML, then we also need to sanitize it? >> >> soto_json(h(title)) ? > > Actually, that

[Rails] Re: How to pass data to Javascript variable from Ruby on Rai

2009-04-13 Thread SpringFlowers AutumnMoon
SpringFlowers AutumnMoon wrote: > SpringFlowers AutumnMoon wrote: > >> i think to_json is more like a transition to the Javascript realm... >> however, isn't it true that if we ever need to set the title into the >> div's innerHTML, then we also need to s

[Rails] Re: How to pass data to Javascript variable from Ruby on Rai

2009-04-08 Thread SpringFlowers AutumnMoon
SpringFlowers AutumnMoon wrote: > i think to_json is more like a transition to the Javascript realm... > however, isn't it true that if we ever need to set the title into the > div's innerHTML, then we also need to sanitize it? > > soto_json(h(title)) ? an

[Rails] Re: How to pass data to Javascript variable from Ruby on Rai

2009-04-08 Thread SpringFlowers AutumnMoon
Frederick Cheung wrote: > On Apr 8, 6:00�pm, Robert Walker > wrote: >> SpringFlowers AutumnMoon wrote: >> me >> >> However, I think you're right about the format of the string object. >> HTML escape won't provide what you want so you probably need

[Rails] Re: How to pass data to Javascript variable from Ruby on Ra

2009-04-08 Thread SpringFlowers AutumnMoon
Chris Kottom wrote: > The most straightforward way of doing what you want is: <%= my_var %> > > On Wed, Apr 8, 2009 at 7:31 AM, SpringFlowers AutumnMoon < are you sure? if my_var contains a newline character, then the Javascript code becomes var title = hello world;

[Rails] How to pass data to Javascript variable from Ruby on Rails

2009-04-07 Thread SpringFlowers AutumnMoon
I wonder on RoR, will there be a need sometimes to pass some data from Ruby to Javascript? 1) var title = __ ; What is the proper way to do it (fill in the code for __ ) if title can have newline character, or single / double quote or any weird character. and what's m

[Rails] h() doesn't have any parameter for encoding being used?

2008-09-27 Thread SpringFlowers AutumnMoon
it seems that there is no parameter for the function h() (html_escape()) to indicate the character encoding being used? for PHP, its htmlspecialchars() function has a dozen encoding possible, such as UTF-8, Chinese Big5, Chinese GB, Russia, Japanese. i think thought, h() will work for UTF-8, sin

[Rails] Re: h() or html_escape() not escape the single quote... risk

2008-09-27 Thread SpringFlowers AutumnMoon
Andreas S. wrote: >> > > Just don't, it's not correct HTML. really -- i thought HTML 4.01 allows using either double or single quote? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the