小编Sov*_*ina的帖子

升级到macOS后,Mojave gem更新失败

构建原生扩展.这可能需要一段时间...错误:安装libxml-ruby时出错:错误:无法构建gem本机扩展.

Building native extensions. This could take a while...
ERROR:  Error installing libxml-ruby:
    ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.3.0/gems/libxml-ruby-3.1.0/ext/libxml
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20180926-80978-eoqfjh.rb extconf.rb
checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/$(RUBY_BASE_NAME)
    --with-xml2-config
    --without-xml2-config …
Run Code Online (Sandbox Code Playgroud)

macos rubygems

20
推荐指数
2
解决办法
5107
查看次数

Rails + Vue.js-使用Ajax更新Vue组件

我有一个使用webpacker的Rails 5应用程序,其中显示了用户列表。这样做的逻辑是在其中包含Vue组件代码的部分代码中,例如

<profile_modal>

  <template slot="trigger">

    <figure class="profile-card__figure | image -is1x1">
      <img src="<%= person.avatar.url %>" alt="">
    </figure>
...
Run Code Online (Sandbox Code Playgroud)

一切正常,处理页面时,.erb可以将其正确更改为HTML。到目前为止,一切都很好。

现在,我添加了一个显示“显示更多用户”的按钮,该按钮发出ajax调用以吸引更多用户。我已经制作了一个js.erb:

$("#users").html("<%= escape_javascript(render partial: 'layouts/components/profile-card--modal', collection: @users.last(12), as: :person, locals: { content: @users_presenter.profile_modal }) %>"); 
Run Code Online (Sandbox Code Playgroud)

该代码已执行,但是rails只是将其正确插入页面中,而不是将“ profile_modal”转换为正确的html,这会使所有错误。

有没有一种方法可以将Vue代码转换为在正常,非ajaxy处理期间将变成的html?

ajax ruby-on-rails vue.js ruby-on-rails-5

12
推荐指数
1
解决办法
276
查看次数

具有多个模型和auth标头的devise_token_auth

这是我的问题,我为User模型覆盖了控制器:

mount_devise_token_auth_for 'User', at: 'auth', controllers: {
     registrations:      'v1/authentication/registrations'
     sessions:           'v1/authentication/sessions'
     token_validations:  'v1/authentication/token_validations'
 }
Run Code Online (Sandbox Code Playgroud)

这样工作正常,没有问题。但是,当我使用相同的控制器添加新模型时:

mount_devise_token_auth_for 'Admin', 'admin_auth', controllers: {
   sessions:           'v1/authentication/sessions',
   token_validations:  'v1/authentication/token_validations'
}
mount_devise_token_auth_for 'User', at: 'auth', controllers: {
   registrations:      'v1/authentication/registrations',
   sessions:           'v1/authentication/sessions',
   token_validations:  'v1/authentication/token_validations'
}
Run Code Online (Sandbox Code Playgroud)

他们的Admin模型的响应标头没有auth键。响应是ok(200),但不返回auth标头。但是,如果删除Admin模型的控制器部分(替代),则响应将返回auth密钥。顺便说一句,重写仅更改控制器的渲染方法。有什么可以帮助找到解决此问题的方法吗?

ruby-on-rails access-token rails-api devise-token-auth

8
推荐指数
1
解决办法
530
查看次数

How to hide section in a Chart.js Pie Chart

In Chart.js you can hide a section of a chart by clicking on the label on top.
在此处输入图片说明
带有隐藏部分的饼图图片

我希望在启动时隐藏图表的一部分。对于另一种类型的图表,我将使用数据集隐藏属性,但饼图部分与数据集不对应。因此,如果你这样做,整个数据集都会被隐藏,而不仅仅是需要的部分。

(额外信息:我使用包含多个数据集的饼图)

我最接近解决方案的是以下代码:

for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) {
  meta = chart.getDatasetMeta(i);
  meta.data[index].hidden = !meta.data[index].hidden;
}

chart.update();
Run Code Online (Sandbox Code Playgroud)

或者我可以覆盖 generateLabels 函数。

谁能帮我找到更好的解决方案?

谢谢

hidden pie-chart chart.js

5
推荐指数
1
解决办法
7926
查看次数

如何在设置 Ruby on Rails 时安装 SQLite3?

我是编程新手,正在尝试安装适用于 Windows 10 的 Ruby on Rails。

我已经尝试了几次运行 gem 安装捆绑程序,但 SQLite3 总是出现错误。

命令提示符显示从http://www.sqlite.org/安装 SQLite3 ,但我不知道将其放置在目录中的何处。

我看了看,mkmf.log但我不明白它在告诉我什么。

当我查看 RailsInstaller 的“bin”文件夹 sqlite3.def 时,存在 sqlite 3.dll sqlite3 应用程序和 sqlite3_ruby (文件和批处理文件)。

如果有人知道可能出了什么问题以及如何解决它,我真的很感激一些帮助,这个问题永远不会发生在在线操作指南上。

非常感谢

命令提示信息:

安装 sqlite3 (1.4.0) 时出错,Bundler 无法继续。确保gem install sqlite3 -v '1.4.0' --source 'https://rubygems.org/'捆绑前成功。

在 Gemfile 中:sqlite3

C:\Sites\test_app>gem install sqlite3 -v 1.4.0 暂时增强 PATH 以包含 DevKit... 构建本机扩展。这可能需要一段时间...错误:安装 sqlite3 时出错:错误:无法构建 gem 本机扩展。

current directory: C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.0/ext/sqlite3
Run Code Online (Sandbox Code Playgroud)

C:/RailsInstaller/Ruby2.3.​​3/bin/ruby.exe -r ./siteconf20190317-7152-n0tljg.rb extconf.rb 检查 sqlite3.h...没有 sqlite3.h 丢失。首先从http://www.sqlite.org/安装 SQLite3 。 * …

ruby sqlite rubygems ruby-on-rails

3
推荐指数
1
解决办法
6770
查看次数

angular 6 @angular/core/core"' 没有导出成员 'state'

我从 angular 5.2 迁移到 6.0。当我发出 ng serve 命令时,出现以下错误:

src/app/mappy/mappy.component.ts(1,36) 中的错误:错误 TS2305:模块 '"C:/NSE911/applicationDev/angular/alo/node_modules/@angular/core/core"' 没有导出成员'状态'。

我正在使用:打字稿:2.7.2,角度cli:6.0.1,节点:8.11.2,操作系统:win32 x 64,角度:6.0.0,rxjs-compat:“^6.1.0”,

我删除了 node_modules 目录并重新创建了它(npm install)。这没有用。
我会很感激任何想法(我是使用这种技术的新手)。谢谢你的帮助。

angular6

1
推荐指数
1
解决办法
1万
查看次数

ng2-smart-table在编辑单击时打开弹出窗口

ng2-smart-table当用户单击“编辑”和“新建”按钮时,我想在组件上打开一个弹出页面,但是我无法捕获这些事件。
例如我找不到onEditRowSelect($event)函数,你有什么主意吗?
为了简短起见,我想删除表格内的编辑输入字段并打开一个弹出页面

<ng2-smart-table 
  [settings]="settings" 
  [source]="data"                
  (editConfirm)="onEditRowSelect($event)">
</ng2-smart-table>
Run Code Online (Sandbox Code Playgroud)

这是我的ng2-smart-table设定

this.settings = {

  columns: {
  },
  actions: {
    position: 'right',
    add: true,
    edit:true,
    editable:false,
    columnTitle: '',
  },
  add: {
    addButtonContent: 'NEW',                        
  },
  edit: {
    editButtonContent: 'EDIT',                        
    position: 'right',
  }      
}    

onEditRowSelect(event) {
  console.log(event.data.nombre);             
}
Run Code Online (Sandbox Code Playgroud)

ng2-smart-table angular

1
推荐指数
1
解决办法
2125
查看次数

syntax error, unexpected keyword_ensure, expecting

I am getting this error when trying to send a message on my rails app. Please help me get it right. The conversations.html.erb file does not have any line 36 and 38. Here is the error:

syntax error, unexpected keyword_end, expecting ')' end ^): app/views/private/conversations/_conversation.html.erb:36: syntax error, unexpected keyword_ensure, expecting ')' app/views/private/conversations/_conversation.html.erb:38: syntax error, unexpected keyword_end, expecting ')' app/views/private/conversations/_open.js.erb:10:in _app_views_private_conversations__open_js_erb___4089549709349058989_70036360651440' app/views/assignments/show/contact_user/message_form/_success.js.erb:8:in _app_views_assignments_show_contact_user_message_form__success_js_erb__1046129379162570439_70036360658520' app/controllers/private/conversations_controller.rb:18:in block (2 levels) in create' app/controllers/private/conversations_controller.rb:16:increate'

I have attached the controller and the _conversation.html.erb file.Any help …

ruby ruby-on-rails

-2
推荐指数
1
解决办法
73
查看次数