Re: Ruby and MySQL with windows
Thanks Len.
I was able to edit it. However i have a rake trying to create some columns but when i create the scaffold i am not seeing the columns in the web interface? see rake code below
class CreateEmployees < ActiveRecord::Migration
def self.up
create_table :employees do |t|
# t.column :name, :string
t.column :name, :string
t.column :hiredate, :date
t.column :salary, :float
t.column :fulltime, :boolean
t.column :vacationdays, :integer
t.column :comments, :text
end
end
def self.down
drop_table :employees
end
end
and this the controller code
class EmployeesController < ApplicationController
# GET /employees
# GET /employees.xml
def index
@employees = Employee.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @employees }
end
end
# GET /employees/1
# GET /employees/1.xml
def show
@employee = Employee.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @employee }
end
end
# GET /employees/new
# GET /employees/new.xml
def new
@employee = Employee.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @employee }
end
end
# GET /employees/1/edit
def edit
@employee = Employee.find(params[:id])
end
# POST /employees
# POST /employees.xml
def create
@employee = Employee.new(params[:employee])
respond_to do |format|
if @employee.save
flash[:notice] = 'Employee was successfully created.'
format.html { redirect_to(@employee) }
format.xml { render :xml => @employee, :status => :created, :location => @employee }
else
format.html { render :action => "new" }
format.xml { render :xml => @employee.errors, :status => :unprocessable_entity }
end
end
end
# PUT /employees/1
# PUT /employees/1.xml
def update
@employee = Employee.find(params[:id])
respond_to do |format|
if @employee.update_attributes(params[:employee])
flash[:notice] = 'Employee was successfully updated.'
format.html { redirect_to(@employee) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @employee.errors, :status => :unprocessable_entity }
end
end
end
# DELETE /employees/1
# DELETE /employees/1.xml
def destroy
@employee = Employee.find(params[:id])
@employee.destroy
respond_to do |format|
format.html { redirect_to(employees_url) }
format.xml { head :ok }
end
end
end
why is this happening?
Subject
Written By
Posted
Re: Ruby and MySQL with windows
July 10, 2008 09:15AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.