Monday July 23, 2007
jMaki on Rails - Updated for NetBeans 6 M10
Based upon a user request, this is a follow up entry to show how jMaki on Rails For Dummies work on NetBeans 6 Milestone 10. Some of the steps are simplified and more details are provided. The updates from the previous blog entry are highlighted in this color.
Tools', 'Plugins',
select 'Downloaded', click on 'Add
Plugins ...'.Tools', 'Plugins',
select 'Installed'. It should show 'jMaki
Ajax support' with today's installation date.jmaki_ror'.
Take everything else as default.Generate ...', select 'controller',
specify the Name as 'jmaki' and Views as 'yahoo'.http://jmaki-goodies.googlecode.com/svn/trunk/rails_plugins".
This adds the plug-in registry to the list of repositories used for
searching plug-ins. jmaki_core and
jmaki_yahoo and press "Install". Follow the instructions and the
two plug-ins will be installed. After the installation is complete,
you'll see the following:
Views', right-click on
'layouts', select 'New', select
'RHTML file ...'.
Enter the 'File Name' as 'standard'.
This will add 'standard.rhtml' in layouts
sub-tree. Enter the following fragment before <body>:<head>
<%= stylesheet_link_tag "jmaki-standard", :media
=> "all" -%>
<%= javascript_include_tag "jmaki" -%>
<%= jmaki_setup -%>
</head><%= @content_for_layout %>Controllers', 'jmaki_controller.rb',
add the following fragment before 'def yahoo'
line:layout "standard"mysqld-nt --user root'.mysqladmin -u root create
jmaki_ror_development'. You need to make sure that the database
name in this script is changed to match the project name.Generate',
select 'model', specify the arguments as 'grid',
click 'OK'. This will
generate, in NetBeans project, Database Migrations, migrate,
001_create_grids.rb.001_create_grids.rb,
change self.up
helper
method such that it looks like:def self.up
create_table :grids do |t|
t.column :company, :string
t.column :price, :float
t.column :change, :float
t.column :percent_change, :float
t.column :last_updated, :string
end
end Run
Rake
Target', 'db', 'migrate'.
This generates the database
table. mysql --user root'.
use
jmaki_ror_development' to see the following interaction:mysql> use jmaki_ror_development;
Database changedinsert into grids values (1, 'A Co', 71.72,
0.02, 0.03, 'Jan 1, 2007, 10:00am' );
insert into grids values (2, 'B Inc', 29.01, 0.42, 1.47, 'Feb 1, 2007,
10:00am' );
insert into grids values (3, 'C Group Inc', 83.81, 0.28, 0.34, 'Mar 1,
2007, 10:00am' );
insert into grids values (4, 'D Company', 52.55, 0.01, 0.02, 'Apr 1,
2007, 10:00am' );Views',
'jmaki', 'yahoo.rhtml',
drag-and-drop 'Data Table' widget from the 'Yahoo'
category of jMaki palette.
yahoo.rhtml' with the
following:<%= jmaki_widget 'yahoo.dataTable',
:args => {
:columns => [
{ :title => 'Company', :width => 200, :locked =>
false },
{ :title => 'Price', :width => 75, :renderer =>
'usMoney' },
{ :title => 'Change', :width => 75, :renderer =>
'change' },
{ :title => '% Change', :width => 75, :renderer =>
'pctChange' },
{ :title => 'Last Updated', :width => 85, :renderer
=> 'italic' }
]
},
:value => @table_data
-%>@table_data' is defined
in 'jmaki_controller' in 'def yahoo'
as:def yahoo
@table_data = []
Grid.find_all().each do |data|
@table_data
<< [ data.company, data.price, data.change,
data.percent_change, data.last_updated]
end
endhttp://localhost:3000/jmaki/yahoo'.
Now jMaki-wrapped Yahoo DataTable widget is picking data from the MySQL
database. And as a next step, you can WAR'up this RoR application and deploy it on GlassFish V2 using these instructions.
Technorati: jmaki rubyonrails ror netbeans mysql glassfish
Posted by Arun Gupta in web2.0 | Comments[12]
|
|
|
|
|
Today's Page Hits: 9437
Total # blog entries: 1002