Facebox 和导轨无法正常工作!

发布于 2024-09-11 03:51:13 字数 1400 浏览 3 评论 0原文

我正在尝试将 Facebox 与 Rails 一起使用,但它根本不起作用。

我已将所有文件添加到正确的位置:

  • 安装 FaceboxRender gem 安装 FaceboxRender
  • 下载 jQuery
  • https://github 处下载 Facebox。 com/defunkt/facebox
  • 将facebox js 文件复制到/public/javascripts/
  • 将facebox css 文件复制到/public/styleshees/
  • 将facebox 所有图像文件复制到/public/facebox/
  • 更新布局的stylesheet_link_tagjavascript_include_tag 添加这些 js、css 文件

我已将 FaceboxRender 包含在我的应用程序控制器中,

我在这里缺少什么,

这是一个仅用于测试的链接:

<%= facebox_link_to 'Posts', posts_path %>

错误:

can't convert Symbol into String
Extracted source (around line #1):

1:  <li><%= facebox_link_to 'Posts', posts_path %></li>
2: 
3: 
4: <% @photos.each do |photo| %>

我尝试添加 config.gem "facebox-render" 到我的 config/environment.rb 但我只是收到错误!

虽然我已经安装了 gem, 我运行 rake gems:install 安装时没有遇到任何问题,但是当我

rake db:migrate

时出现此错误:

Missing these required gems:
  facebox-render  

You're running:
  ruby 1.8.7.174 at /opt/local/bin/ruby
  rubygems 1.3.6 at /Users/Mister/.gem/ruby/1.8, /opt/local/lib/ruby/gems/1.8

Run `rake gems:install` to install the missing gems. 

任何帮助都会很棒!

谢谢丹

Am trying to use Facebox with rails, it's not working at all.

I have added all files to there right places:

  • Install FaceboxRender gem install FaceboxRender
  • Download jQuery
  • Download facebox at https://github.com/defunkt/facebox
  • Copy facebox js file to /public/javascripts/
  • Copy facebox css file to /public/styleshees/
  • Copy facebox all image files to /public/facebox/
  • Update your layout’s stylesheet_link_tag and javascript_include_tag to add these js, css files

I have included FaceboxRender in my application controller

what am I missing here

this is a link am using just to test things:

<%= facebox_link_to 'Posts', posts_path %>

error:

can't convert Symbol into String
Extracted source (around line #1):

1:  <li><%= facebox_link_to 'Posts', posts_path %></li>
2: 
3: 
4: <% @photos.each do |photo| %>

I've tried adding config.gem "facebox-render" to my config/environment.rb
but i just get errors!

Although I have installed the gem already,
I ran rake gems:install I get no problems as it's installed, but when I

rake db:migrate

I get this error:

Missing these required gems:
  facebox-render  

You're running:
  ruby 1.8.7.174 at /opt/local/bin/ruby
  rubygems 1.3.6 at /Users/Mister/.gem/ruby/1.8, /opt/local/lib/ruby/gems/1.8

Run `rake gems:install` to install the missing gems. 

Any help will be great!

Thanks

Dan

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

北陌 2024-09-18 03:51:13

1.在 Gemfile 中包含 gem 'facebox-rails'

2.运行捆绑安装

3.粘贴到您的application.js

jQuery(document).ready(function($) { 
    $('a[rel*=facebox]').facebox() 
})

4.在您的视图中,例如something.html.haml(如果您使用erb,只需添加<% %>)只需添加

= link_to "Link name",your link, rel: "facebox"

1.include gem 'facebox-rails' in the Gemfile

2.run bundle install

3.paste to your application.js

jQuery(document).ready(function($) { 
    $('a[rel*=facebox]').facebox() 
})

4. in your view like something.html.haml ( if you use erb just add <% %>) just add

= link_to "Link name",your link, rel: "facebox"
甩你一脸翔 2024-09-18 03:51:13

问题是这一行: 1:

  • <%=facebox_link_to 'Posts', posts_path %>
  • 将 posts_path 更改为旧样式:

  • <%= facebox_link_to '帖子', :url => {:控制器=> '帖子', :action => '索引'} %>
  • The issue is this line: 1:

  • <%= facebox_link_to 'Posts', posts_path %>
  • Change posts_path to the old style:

  • <%= facebox_link_to 'Posts', :url => {:controller => 'posts', :action => 'index'} %>
  • ~没有更多了~
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文