rails主页路由无法正常工作

时间:2017-05-07 05:43:50

标签: ruby-on-rails ruby

我创建了欢迎控制器和更新的路径文件



public class LocationSearchFragment extends PlaceAutocompleteFragment implements 
    GoogleApiClient.OnConnectionFailedListener, 
    PlaceSelectionListener {

    public static final String TAG="Location Search:";
    private GoogleApiClient mGoogleApiClient;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setOnPlaceSelectedListener(this);
    }

    @Override
    public void onPlaceSelected(Place place) {
        Toast.makeText(getActivity(),
              place.getName(),Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onError(Status status) {
         Toast.makeText(getActivity() ,
             status.toString(),Toast.LENGTH_SHORT).show();
      }

      @Override
     public void onConnectionFailed(ConnectionResult result)  {

      }

    @Override 
    public void onAttach(Activity activity) {
        mGoogleApiClient = new GoogleApiClient
             .Builder(activity)
             .addApi(Places.GEO_DATA_API)
             .addApi(Places.PLACE_DETECTION_API)
            .build();
     } 

}




但是我收到了这个错误。

enter image description here

1 个答案:

答案 0 :(得分:1)

你的root并没有真正映射到某个地方。假设您有welcome_controller和方法index,请执行:

Rails.application.routes.draw do
  root :to => 'welcome#index'
  get 'welcome/index'
end

我看了你的照片,发现错误发生在stylesheet_link_tag。您可能在application文件夹中没有名为vendor/assets/stylesheets的文件/文件夹。因此,请删除该行或将文件名更改为vendor/assets/

中的内容