ruby-on-rails-5

Can't get the 'Follow' button to work with Acts_As_Follower

杀马特。学长 韩版系。学妹 提交于 2019-12-25 15:55:16
问题 I'm using Acts_as_follower in a wishlist app I'm working on. I think it should be working, but the button to actually follow another user is not. The follow button is in my user index view, and I can see it there, but it doesn't respond to being clicked. Any help would be appreciated. Here's my code: index.html.erb <div class="container"> <% @users.each do |u| %> <div class="col-sm-8 col-lg-4"> <div id="gifts"> <div class="box panel panel-default"> <h2><%= link_to u.name, u %></h2> <p> <table

Rails 5 - ExecJS::RuntimeError

做~自己de王妃 提交于 2019-12-25 13:43:12
问题 My project was working fine, I was tweaking a chart made with chartkick and updating a HTML badge with ActionCable, when suddenly I get this error: ExecJS::RuntimeError in Pages#create_session Showing B:/.../app/views/layouts/application.html.erb where line #7 raised: SyntaxError: [stdin]:14:32: unexpected end of input Extracted source (around line #7): 5 <%= csrf_meta_tags %> 6 <%= javascript_include_tag "https://www.gstatic.com/charts/loader.js" %> 7 <%= javascript_include_tag 'application'

Creating a nested model instance (has_many relation) on the view of its parent model

爷,独闯天下 提交于 2019-12-25 12:48:25
问题 I have a model A und a model B and the relation is A has_many B (and B belongs_to A). I have a model, a controller and views for A and only a model for B. I want to create and edit the instances of B on the edit view of A ( url/a/1/edit). I know I can create a controller for B and call those methods using a form in the view of A, but then I need to redirect back to the view of A, because I don't want actual views for B. Is there a recommended way to do this? What I want is to not break any of

Rails 5 Server Issues (Windows 10)

我的梦境 提交于 2019-12-25 12:03:29
问题 Newbie to Ruby on Rails here, I just did a fresh install of Ruby & Rails on Windows 10 (Bash on Ubuntu shell). I seems to having issues on starting the Rails server. Already checked the other threads on the issue, but everyone else is using OSX. :( Hope someone can help! When running rails s, root@TEAMROCKETHQ:~/newapp# rails s /root/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/app_loader.rb:40: warning: Insecure world writable dir /root/.rbenv/versions in PATH,

Rails 5 - implement reusable comment model - views?

你说的曾经没有我的故事 提交于 2019-12-25 08:46:11
问题 In my app that I am building to learn RoR, I have a similar situation like this question. Now my question is how to change my views for this? I have an Annotation model, a Document model and a Comment model. If I switch to a polymorphic association such that my Annotations and my Documents can have Comments, how to do the view (in the partial)? This is the current partial: <%= simple_form_for([@annotation, @annotation.comments.build], html: { class: 'form-vertical', multipart: true }) do |f|

Rails - Linking stylesheet and javascript in layout causes syntax error - “Missing ///”

筅森魡賤 提交于 2019-12-25 08:00:44
问题 I came into work today to find that my project is throwing a syntax error for some reason, and I can't find a single thing about this error. When using the stylesheet_link_tag or javascript_include_tag helpers, I receive SyntaxError: [stdin]:1:1: missing /// . Some things I have noted are: If the links dont lead to a valid file, it compiles just fine. Even if the files are empty the error is still thrown so the syntax error is definitely in the erb, even though I havent changed my application

unexpected indentation error with favicon_tag after migration to rails 5.0

北慕城南 提交于 2019-12-25 07:31:26
问题 With this HAML part !!! %html %head %title=document_title = favicon_link_tag 'logo16.png' %meta{content: form_authenticity_token, name: "csrf-token"}= '' ... I get the error SyntaxError: [stdin]:68:1: unexpected indentation So I played a bit with wrong Identation; then I get other but correct errors Inconsistent indentation: "\t\t " used for indentation, but the rest of the document was indented using 1 tab. Inconsistent indentation: "\t " used for indentation, but the rest of the document

How do I dynamically check to see if a remote font-icon exists?

[亡魂溺海] 提交于 2019-12-25 07:13:54
问题 I am using these Devicon font icons for various programming languages. They don't have every icon, but they have most. What I want to do is to have a default icon I use for the languages that this font library does not support. These are their instructions: <!-- in your header --> <link rel="stylesheet" href="https://cdn.rawgit.com/konpa/devicon/master/devicon.min.css"> <!-- in your body --> <i class="devicon-ruby-plain"></i> So in my view, I have this: <div class="vote-icon"> <i class=

Rails count article per tag and related article by tag

允我心安 提交于 2019-12-25 06:57:51
问题 Hey guys I'm new to rails and try to do something I never did before. First I now Rails have the gems acts_as_taggable but I try it and didn't work for me maybe need to learn how to install him(have already install acts_as_votable). So this is my question, I want to show related articles(with tag) for each article show. And also want to put the article.count by tag into my label. article.rb class Article < ApplicationRecord acts_as_votable belongs_to :category belongs_to :user has_many

Many to many through: Going from Associations::CollectionProxy to AssociationRelation

丶灬走出姿态 提交于 2019-12-25 05:06:18
问题 I have a many to many through relationship with users favoriting clients (Through favorites.rb) and I want to know how to turn a CollectionProxy into an AssociationRelation, so I can get a relation with all the clients that are the users' favorites. Or just simply, how to get them all in a AssociationRelation - doesn't have to be turned into from the CollectionProxy. EDIT: What I'm looking for is simply a relation that lists all the clients. I realize I asked the question differently. How do