It’s so easy …

you just have to know.

After setting up your rails application, you have a default homepage. It is shown, when you call “http://localhost:3000/”. You can change the default homepage in the routes.rb file. Sounds easy. I changed the file and added the following line at the bottom:

map.connect ”, :controller => ‘window’, :action => ‘list’

Quite disappointing: the old start page was still there. After some googling around, I found out what to do. You also have to remove the static index.html in the /public folder.

… you just have to know …

HerrKaiser | Posted in ruby on rails | No Comments »

Bookmark on del.icio.us  Bookmark on del.icio.us     Bookmark on digg  Bookmark on digg

file upload using iframe plugin

We came to the point that we wanted a file upload without page refresh. With rails it is easy. We are using the “responds to parent” plugin.

You install the “responds_to_parent” plugin.

In your view add the following code :

<form name="upload" id="upload" action="/image/your_action"
enctype="multipart/form-data" method="post"
target="uploader">

don`t forget to add an iframe with the id=”uploader”

In your controller add the following code :

responds_to_parent do
   render :update do |page|
      page.replace_html 'your_id', 'it worked!'
   end
end

voila the upload process is now working and you can communicate with the parent with the responds_to_parent method…

it`s so easy - you just have to know :)

ajaxiator | Posted in ruby on rails | No Comments »

Bookmark on del.icio.us  Bookmark on del.icio.us     Bookmark on digg  Bookmark on digg