Setup Rails 3 project :
- rails new howto
- cd howto
- bundle install
- rake db:create
- rails plugin install git://github.com/vhochstein/
active_scaffold.git - rails g active_scaffold_setup [prototype| jquery]
Setup two activescaffolds:
- rails g active_scaffold Team name:string position:integer
- rails g active_scaffold Player name:string injured:boolean salary:decimal date_of_birth:date team:references
- rake db:migrate
- edit file app/models/team.rb -> has_many :players
- edit file /app/views/layouts/
application.html.erb-> <%= javascript_include_tag :defaults %> <%= active_scaffold_includes %>
Add this to ur controller active_scaffold :<your_model_name>
- Add :active_scaffold => true to your routes: by writing his in /config/routes.rb
map.resources :users, :active_scaffold :user
- rails s
- Open Browser: http://localhost:3000/teams
No comments:
Post a Comment