Posts#indexのSyntaxError?

google1254

この特定のエラーが発生します:C:/Sites/rails_projects/blog/app/views/posts/index.html.erb:26:構文エラー、予期しないkeyword_ensure、keyword_endが必要ですC:/ Sites / rails_projects / blog / app / views / posts / index.html.erb:28:構文エラー、予期しない$ end、keyword_endが必要です

ここに完全なインデックスビューがあります

    <!DOCTYPE html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>

<%= will_paginate %>
<% @posts.each do |post| %>
  <div class="container", "relative">
    <div class="row-fluid">
      <h1><%= post.Title %></h1>
        <p><%= post.Post %></p>
        <% if is_admin? %>
        <p><%= link_to 'Show', post %></p>
        <p><%= link_to 'Edit', edit_post_path(post) %></p>
        <p><%= link_to 'Destroy', post_path(post),
        method: :delete, data: { confirm: 'Are you sure?'} %></p>

    </div>
  </div>
  <% end %>
  <%= will_paginate %>
<% if is_admin? %>
<%= link_to 'New Post', new_post_path %>
<% else %>
<% end %>

理由はis_adminだと思いますか?

これが私のsessions_helperです。

def sign_in(user)
    cookies.permanent[:remember_token] = user.remember_token
    current_user = user
  end

  def signed_in?
    !current_user.nil?
  end

  def current_user=(user)
    @current_user = user
  end

  def current_user
    @current_user ||= User.find_by_remember_token(cookies[:remember_token])
  end

  def current_user?(user)
    user == current_user
  end


  def is_admin?
    signed_in? ? current_user.admin : false
  end

  def sign_out
    current_user = nil
    cookies.delete(:remember_token)
  end

エラーがどこにあるのか正確にはわかりませんか?

ローガン・サーマン
<% **@posts.each do |post|** %>
  <div class="container", "relative">
    <div class="row-fluid">
      <h1><%= post.Title %></h1>
        <p><%= post.Post %></p>
        <% **if is_admin?** %>
        <p><%= link_to 'Show', post %></p>
        <p><%= link_to 'Edit', edit_post_path(post) %></p>
        <p><%= link_to 'Destroy', post_path(post),
        method: :delete, data: { confirm: 'Are you sure?'} %></p>

    </div>
  </div>
  <% **end** %>
  <%= will_paginate %>

開いたアスタリスクの付いたブロックは2つありますが、終了ステートメントは1つだけです(アスタリスクも付いています)。

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Posts#indexのNoMethodError

分類Dev

Account :: Posts#indexのNoMethodError

分類Dev

Railsの「GettingStarted」ルート:「posts#index」を取得できません

分類Dev

Rails上のrubyのPostsController#indexのSyntaxError

分類Dev

JupyterのSyntaxError %% R

分類Dev

Microsoft EdgeJavascriptのSyntaxError

分類Dev

GLSLのSyntaxerror'varying '

分類Dev

FlaskapschedulerのSyntaxError

分類Dev

非ASCII文字のSyntaxError

分類Dev

非ASCII文字のSyntaxError

分類Dev

コードのSyntaxError

分類Dev

Uncaught SyntaxError:Unexpected token <in dist / index.html

分類Dev

django 2.0.7 / postsでのNoReverseMatch

分類Dev

Node.jsの「SyntaxError:Unexpected token)」

分類Dev

関数定義のSyntaxError

分類Dev

npmパッケージの更新後に、「SyntaxError:ejsのコンパイル中に... index.ejsで予期しないトークン '/'」エラーが発生する

分類Dev

WordPressの関数have_postsの操作

分類Dev

Ruby on Rails-Posts#showのActionView :: MissingTemplate

分類Dev

カテゴリ番号別のWPquery_posts

分類Dev

ビルド後の不要な_posts構造

分類Dev

Python3.4のeuclid.pyのsyntaxerror

分類Dev

PyCharm5.0.4のpython.exeのSyntaxError

分類Dev

SyntaxError:解析中の予期しないEOF

分類Dev

エクスポート用のPhantomJSKarma SyntaxError

分類Dev

Rails:Syntaxerror-sessionscontrollerの予期しない '{'

分類Dev

SyntaxError:URLpatternの構文が無効です

分類Dev

PythonデコレータのSyntaxError

分類Dev

SyntaxError:TwilioQuestの予期しない識別子

分類Dev

yieldステートメントのSyntaxError

Related 関連記事

ホットタグ

アーカイブ