Giter Site home page Giter Site logo

taskshareapp's Introduction

Hi there 👋

Raisa's GitHub stats

Top Langs

  • 🔭 I’m currently working on My room.
  • 🌱 I’m currently learning Ruby on Rails URL Next.js URL TypeScript URL Linux mint URL

taskshareapp's People

Contributors

raisa0726 avatar

Watchers

 avatar  avatar

taskshareapp's Issues

cssの改善

取り組みたいこと

  • scssを使用する
  • bootstrapの導入

指定したprojectに参加、リダイレクトされない

現在起きているコード

  def join
    @project = Project.find(params[:id])
    puts "----------------------------------"
    puts params[:id]
    if @project.users.pluck(:id).include?(current_user.id)
      flash[:notice] = "既に加入しています"
      redirect_to @project
    else
      @project.users << current_user
      redirect_to @project
    end
  end
 <div class = "button">
    <%= button_to "参加", join_project_path(project), method: :post %>
 </div>

コンソールの挙動

Started POST "/projects/2/join" for ::1 at 2021-09-25 16:21:23 +0900
Processing by ProjectsController#join as HTML
  Parameters: {"authenticity_token"=>"[FILTERED]", "id"=>"2"}
  Project Load (1.1ms)  SELECT `projects`.* FROM `projects` WHERE (2) LIMIT 1
  ↳ app/controllers/projects_controller.rb:65:in `join'
----------------------------------
2    #project.id
   (1.0ms)  SELECT `users`.`id` FROM `users` INNER JOIN `associates` ON `users`.`id` = `associates`.`user_id` WHERE `associates`.`project_id` = 1
  ↳ app/controllers/projects_controller.rb:68:in `join'
  User Load (1.0ms)  SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 ORDER BY `users`.`id` ASC LIMIT 1
  ↳ app/controllers/projects_controller.rb:68:in `join'
Redirected to http://localhost:3000/projects/1
Completed 302 Found in 9ms (ActiveRecord: 3.2ms | Allocations: 3540)

vendor/bundleがアップロードされてしまっている

課題

GemがGitHubにアップロードされてしまっている

Gemはサイズが大きいため、Gemをアップロードするとgitコマンドの処理が遅くなってしまう
そのため、Gemを格納しているディレクトリはアップロードしない方がいい

提案

.gitignoreに/vendor/bundleというコードを追加し、git rm vendor/bundleを実行してvendor/bundleをGitの管理対象から除外する

postでsubmitあとのredirectのエラー

現在起きている問題

    if current_user.save
      redirect_to project_path(@project)
    else
      error_mes = ""
      @post.errors.full_messages.each do |error|
        error_mes += "!#{error}<br>"
      end
      flash[:alert] = error_mes.html_safe
      redirect_to new_post_path(@project)
    end

としたところ、

**Couldn't find Project without an ID**
  def new
    @post = Post.new
    @project = Project.find(params[:project_id]) <-ここ
  end

とエラーが出る

考えられる問題点

new -> createにプロジェクトのidを渡せていないことが原因と考えられる。

データを持ってこれていない

投稿ページに、どのプロジェクトに関する投稿をするか表示させるために、

@project_name = @project.name
<h2><%= @project_name %>に投稿することを記入してください</h2>

という記入がされているが、機能していない

projectのhostを追加できない(form内のcheck_bokのデータの引き渡し)

問題のコード

<%= form_with model: @project do |form| %>
<!-- 省略 -->
    <div class = "col">
      <%= form.label :host_users, "追加する管理者" %>
      <div class = "scroll">
        <div class = "col">
        <% @not_host_member.each do |user| %>
          <%= form.check_box :host_users,  {multiple: true}, user.id, nil %>
          <%= user.name %>
        <% end %>
        </div>
      </div>
      <div class = "link">
        <%= form.submit %>
      </div>
    </div>
  </div>
<% end %>
#省略
  def update
    @project = Project.find(params[:id])
    host = params[:host_users]
    new_host
    if @project.update(projects_params)
      # update メソッドが正しく実行できたとき詳細ページに戻る
      redirect_to @project
      flash[:notice] = "正常にアップデートされました"
    else
      # updateできなかったときにエラーを表示
      flash[:alert] = "エラー:#{@project.errors.full_messages}"
      # renderで入力した内容はそのままで変種ページに戻る
      render 'edit'
    end
  end
#省略
    def new_host
      host_users.each do |host|
        Associate.where(user: host,project: @project).update(host: :true)
      end
    end

行いたい動作

check_bokでチェックを入れたユーザーをhostにしたい

param is missing or the value is empty: project

現在起きている問題

Did you mean?
post
commit
controller
action

    def posts_params
      params.require(:project).permit(:user, :project, :topic1, :topic2, :topic3, :topic4, :topic5)
    end

おそらく:userあたりの書き方がまずい

README.mdの変更

変更すべき点

  • 環境構築の仕方を追記
cd TaskShareApp
# 別のアプリの方でpathが通っている場合、そちらのbundleになるため注意
bundle install --path vendor/bundle
sudo service mysql start
rails webpacker:install
rails db:create 
rails db:migrate

プロジェクト脱退ができない

現在起きている問題とコード

<%= link_to "脱退する", project_member_path(@project, current_user), method: :destroy %>

で脱退しようとすると、Routing Errorが出る。

考えられる問題点

おそらく、memberでのdestroyがないことが原因
それかassociateを削除にする

seeds.rbでデータを一括で追加したい

問題点

50.times do |n|
  User.create(name:'test#{n}', email:'mail#{n}@example.com', password:'test#{n}', password_confirmation:'test#{n}')
end

のように、変数を入れてユーザーを作ろうとしたが、文字になって追加できない

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.