Introduction
Welcome to talk.rubynow.com!! talk.rubynow.com is a place to talk about anything related to ruby and rails. You can ask questions, place code snippets, or list tips. Based on the posts you make, you will gain more points and have fun!! Sign up NOW!!
(replies: 2)
by jtoy on Thu Apr 13 09:40:37 -0500 2006

Hi, I am working on a the largest rails project I have worked on before. It’s large in terms of how many different directions the application can flow, so there will be many different views. How are people using rails to do the workflow on larger projects?
It is getting too tedious in the controller to have code like:
if @result ==1
render :action => ‘page1’
elsif @result ==2
render :action => ‘otherpage’
else
render :action => ‘returnpage’
How are rails developers managing these kinds of flows?
I would appreciate any suggestions.

show
(replies: 3)
by paulc on Tue Apr 11 23:09:15 -0500 2006

From reading about how rails works, it seems when you use page caching in a production environment, the rails stack is bypassed because apache/lighty will see the html file and serve that instead of dynamically generating the page. Is rails really totally bypassed? If so, how can the log files still record what pages where hit in the log directory if rails is totally bypassed?

show
(replies: 0)
by doug on Sat Apr 08 17:52:52 -0500 2006

This is a test!

show
(replies: 0)
by jtoy on Wed May 03 14:10:00 -0500 2006

Sometimes when you are testing functions, you just want to run the code without irb printing out tons of data to the console.
Normally you type in irb:
1+1
and it will print out
=> 2
if you add a ”;0” or ”;nil”
the result will not be printed, only a 0 or nil. This is only useful when a function prints out to much data to the screen such as an array with 1,000,000 items.
so you would do:
my_function;nil

show
(replies: 1)
by jtoy on Mon Apr 17 11:29:03 -0500 2006

If you want to use page caching, but can’t because you will loose the ability to display error and succcess messages, there is a way around this.
You can put your error in javascript so your pages are always cached, only your javascript will change.
You will need to make sure javascript is loaded from the webserver and that the browser isn’t caching your javascript.
In your javascript template have some code like:

<% if flash[:js_notice]  %>

  var js_notice = "<%= flash[:js_notice]  %>"
<% else %>

  var js_notice = null
<% end %>


<% if flash[:js_error]  %>

  var js_error = "<%= flash[:js_error] %>"
<% else %>


function display_flash(){
  if (js_notice){
    var div = document.getElementById("js_notice")
    div.innerHTML =  js_notice
  }
  if (js_error){
    var div = document.getElementById("js_error")
    div.innerHTML = js_error

  }
}
window.onload = display_flash

Then in your layout have this html:
  <div id="js_error"></div>
  <div id="js_notice"></div>

On each new page request, the javascript code will load and check if there are notices or errrors, if there are, then it will place that error on your page in the appropiate div. show
(replies: 4)
by bd7lx on Thu Apr 13 19:54:01 -0500 2006

九点档的朋友们,来这折腾
希望没有人来干我们吧

show
(replies: 12)
by jtoy on Thu Apr 13 00:17:45 -0500 2006

John and I will be at the Canada on Rails conference. We will be posting information about the conference at this thread. If you have any questions, please ask here.
Thanks!!!

show
(replies: 0)
by jtoy on Wed Apr 05 22:54:11 -0500 2006

If you find any bugs or oddities in the site, please report them to this thread.
Thanks!!!

show