railsでリンク機能をつけたいのですが、以下のようにしてもリンクが機能しません。
<ul class="nav navbar-nav navbar-right"> <li> <%= link_to(root_path) do %> <i class="fa fa-home"></i>ホーム <% end %> </li> <li> <%= link_to(new_post_path) do %> <i class="fa fa-bookmark"></i>マイページ <% end %> </li> </ul>
コンソールを調べてみたところ、以下のようになっておりsvgというものが邪魔している(?)ようです
fontawsomeを導入するのにCDNを利用したのですが、なにか関係あるでしょうか?
解決策をご存知の方がいれば教えてください。
表示はされているのですが、クリックしてもURIが変わリマセン。
環境は
Rails 5.1.5
ruby 2.4.0
以下はgemfileです
source 'https://rubygems.org' git_source(:github) do |repo_name| repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") "https://github.com/#{repo_name}.git" end # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.1.5' # Use sqlite3 as the database for Active Record gem 'sqlite3' # Use Puma as the app server gem 'puma', '~> 3.7' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # See https://github.com/rails/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby # Use CoffeeScript for .coffee assets and views gem 'coffee-rails', '~> 4.2' # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks gem 'turbolinks', '~> 5' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.5' gem 'bootstrap-sass', '3.3.7' gem 'font-awesome-rails' group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] # Adds support for Capybara system testing and selenium driver gem 'capybara', '~> 2.13' gem 'selenium-webdriver' end group :development do # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. gem 'web-console', '>= 3.3.0' gem 'listen', '>= 3.0.5', '< 3.2' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
application.html.erbのheader部分です
<!DOCTYPE html> <!--[if IE 7 ]><html class="ie ie7 lte9 lte8 lte7" lang="en-US"><![endif]--> <!--[if IE 8]><html class="ie ie8 lte9 lte8" lang="en-US"> <![endif]--> <!--[if IE 9]><html class="ie ie9 lte9" lang="en-US"><![endif]--> <!--[if (gt IE 9)|!(IE)]><!--> <html class="noIE" lang="en-US"> <!--<![endif]--> <head> <title>Nevada Plus</title> <!-- meta --> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta name="viewport" content="width=device-width, initial-scale = 1.0, maximum-scale=1.0, user-scalable=no"/> <!-- google fonts --> <link href='http://fonts.googleapis.com/css?family=Raleway:500,300' rel='stylesheet' type='text/css'> <link rel='stylesheet' href='http://fonts.googleapis.com/css?family=PT+Sans'> <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Droid+Serif:regular,bold"/> <!-- css --> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> <link rel="stylesheet" href="assets/css/bootstrap.min.css"> <link rel="stylesheet" href="assets/css/font-awesome.min.css"> <link rel="stylesheet" href="assets/css/style.css" media="screen"/> <script defer src="https://use.fontawesome.com/releases/v5.0.8/js/all.js"></script> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="assets/js/html5shiv.js"></script> <script src="assets/js/respond.js"></script> <![endif]--> <!--[if IE 8]> <script src="assets/js/selectivizr.js"></script> <![endif]--> </head>
あなたの回答
tips
プレビュー