Facebox and rails not working!
Am trying to use Facebox with rails, it's not working at all.
I have added all files to th开发者_如何学JAVAere 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
andjavascript_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
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"
The issue is this line: 1:
Change posts_path to the old style:
精彩评论