当前位置: 首页 > 工具软件 > Ruby-Enum > 使用案例 >

Ruby on rails安装及使用过程中遇到的问题

谭志用
2023-12-01

1.

$ rails server
Could not find gem 'jquery-rails (>= 0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
To:you need install the jquery-rails

$ gem install jquery-rails
and then cd your project name.
$ cd projectName
$ bundle install
2.

$ rails server

Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)......
To:you need install node.js

$ sudo apt-get install nodejs
then use:
$ rails server
you can start a web server on your development machine.

3.

rails3.2版本出现"no route matches",修改~/config/routes.rb文件,向其中添加如下红色部分内容.

# The priority is based upon order of creation:
  # first created -> highest priority.


  # Sample of regular route:
  #   match 'products/:id' => 'catalog#view'
  # Keep in mind you can assign values other than :controller and :action
  match 'products/:id' => 'catalog#view'


  # Sample of named route:
  #   match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
  # This route can be invoked with purchase_url(:id => product.id)


  # Sample resource route (maps HTTP verbs to controller actions automatically):
  #   resources :products


  # Sample resource route with options:
  #   resources :products do
  #     member do
  #       get 'short'
  #       post 'toggle'
  #     end
  #
  #     collection do
  #       get 'sold'
  #     end
  #   end


  # Sample resource route with sub-resources:
  #   resources :products do
  #     resources :comments, :sales
  #     resource :seller
  #   end


  # Sample resource route with more complex sub-resources
  #   resources :products do
  #     resources :comments
  #     resources :sales do
  #       get 'recent', :on => :collection
  #     end
  #   end


  # Sample resource route within a namespace:
  #   namespace :admin do
  #     # Directs /admin/products/* to Admin::ProductsController
  #     # (app/controllers/admin/products_controller.rb)
  #     resources :products
  #   end


  # You can have the root of your site routed with "root"
  # just remember to delete public/index.html.
  # root :to => 'welcome#index'


  # See how all your routes lay out with "rake routes"
  # This is a legacy wild controller route that's not recommended for RESTful applications.
  # Note: This route will make all actions in every controller accessible via GET requests.
  # match ':controller(/:action(/:id))(.:format)'
  match ':controller/:action'
  match ':controller/:action/:id'
  match ':controller/:action/:id.:format'

end



 类似资料: