[Ironruby-core] Question about Ivan Porto carrero MVC Sample

Ivan Porto Carrero ivan at flanders.co.nz
Tue Jun 23 12:46:09 EDT 2009

Asp.net MVC has the ability to add view engines
Each view engine defines a bunch of search patterns, and you can configure
the location of the views but the convention is views so I'd stick with that
When you request the view "index" the controller will ask the view engines
collection if it can find a view with that name in a location
The first view that matches the file name like index.html.erb or index.aspx
also selects the view engine. From there on the view engine reads the file
and executes it, after setting a bunch of variables that can be used in the
view script like the view data dictionary.

Met vriendelijke groeten - Best regards - Salutations
Ivan Porto Carrero
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)

On Tue, Jun 23, 2009 at 5:49 PM, Mohammad Azam <lists at ruby-forum.com> wrote:

> Hi Ivan Porto carrero,
> Great work on the MVC IronRuby sample!
> I am curious to know how it works! I created an ASP.NET MVC application.
> I created the controller and view but how will the views get called.
> Here is my controller:
> require 'application_controller'
> class HomeController < ApplicationController
>  def index
>    @message = "Welcome from IronRuby!"
>    view('Index')
>  end
>  def about
>    view('Index')
>  end
> end
> And here is the view:
> <h2><%= html.encode(view_data.message) %></h2>
>    <p>
>        To learn more about ASP.NET MVC visit <a
> href="http://asp.net/mvc" title="ASP.NET MVC
> Website">http://asp.net/mvc</a>.
> </p>
> Thanks!
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090623/fb069f7f/attachment.html>

More information about the Ironruby-core mailing list