I want to creat a GUI accessible via the web with ruby to interface some
matlab implementation … so I extended Ruby with C++ and then matlab
that works perfectly: I have finaly a Ruby class I can call whenever I
want to lunch my matlab algorithm
the point is now I have to make the GUI in HTML with Rubby on rails and
Damn! I don’t get how works the MVC architecture in Ruby (I already used
a PAC architecture with JAVA) but with rails … I don’t get when I can
call my function
I create a model (where my Ruby/matlab class is called) but how I am
supposed to call this functin from the view as far I don’t have any
controler object in the view (it’s just a html page) … so what I tryed
from the view to call a function in the controler which called the
function of the model !
but rails want to put a html page with the name of the function !!!
To summury… how I can call my Ruby/matlab function from the web page
to execute code ??
You should probably do a Ruby on Rails tutorial to learn the basics.
First of all controllers are required. You cant serve a page without a
controller. In short:
Handles the request and prep any variables the view may need. Alter the
database in anyway that is necesary by communicating with the model.
Represents units of data. the class “Product” represents the “products”
table, and “Product.new” creates a product object representing a single
row in that table.
Display the HTML output. Views access the variables passed to them from
the controller in order to format the output.
Modules and Classes that offer functionality but aren’t representative
of a data set like a model. You should probably stick your matlab class
here by adding it to the “lib” directory in your rails app.
class HomeController < ApplicationController
@matlab = MatLab.new(‘some’, ‘params’)
<%= @matlab.display %>
Now to call the “index” action, go to “http://domain.com/home/index” or
for short “http://domain.com/home/index”.