ruby-on-rails-plugins

Start or ensure that Delayed Job runs when an application/server restarts

拟墨画扇 提交于 2019-11-29 00:52:09
问题 We have to use delayed_job (or some other background-job processor) to run jobs in the background, but we're not allowed to change the boot scripts/boot-levels on the server. This means that the daemon is not guaranteed to remain available if the provider restarts the server (since the daemon would have been started by a capistrano recipe that is only run once per deployment). Currently, the best way I can think of to ensure the delayed_job daemon is always running, is to add an initializer

Best Rails Tagging Plugin/Gem [closed]

喜欢而已 提交于 2019-11-28 22:18:20
问题 what plugin or gem do you recommened for tagging? There are many of them, acts_as_taggable, acts_as_taggable_on_steroids, acts_as_taggable_on,... What do you say? 回答1: Here's a good list of tagging plugins ordered by ranking. 回答2: Just went through this. Started with is_taggable because I liked having something simple Then I need to find tagged items like Website.tagged_with("sports") which it didn't support so I switched to acts_as_taggable_on , the most popular one on github It worked well

Building a ruby gem for Rails applications

≡放荡痞女 提交于 2019-11-28 20:24:47
问题 As a Rails developer I feel a bit stupid asking this question but hopefully I will learn something new and someone can put me out of my misery! In my rails applications I use (other peoples) gems all the time, I also use plugins from the community or my own. I understand the benefits of use gems over plugins as they are version-able, segmented, system wide, easier to manage and share etc etc but I don't really know how to go about making a gem for my rails apps!? Do you always start with a

“Like”, “Dislike” plugin for rails

安稳与你 提交于 2019-11-28 19:34:19
Is there any "like" , "dislike" plugin for rails... I went through rating plugins... but all of them were 5 star rating plugins... I recommend creating the like and dislike option by taking on the classic vote model functionality. So you have Vote as a join table between the User and the Votable Item . A Vote value can work as Vote.value + 1 = Like, Vote.value -1 = Dislike, Vote.value = Neutral/Didn't vote. Your controller for your votable item can look like this : def like get_vote @vote.value += 1 unless @vote.value == 1 @vote.save respond_to do |format| format.html format.js end end def

OmniAuth + Pulling Tweets, FB Places, etc

北城余情 提交于 2019-11-28 17:20:33
I'm using OmniAuth + Devise to allow users to register using Facebook/Twitter/Gowalla/etc attached to normal user accounts. Now when a user logs in using any of these, or their account, all their social networks are attached in a authentications table. I need to be able to pull content from any of these providers, such as their tweets or their Facebook Places checkings, etc. I understand that I will need to use a different gem, plugin, whatever to do this but getting the config I need to work with those gems (and make requests) is confusing to me. I need to be able to access the provider

How to load vendor asset folder in Rails 4?

别来无恙 提交于 2019-11-28 16:05:07
I have a plugin with many types of files, and its own tree structure (html, css, js, documentation, images, etc) Rather than going through the plugin folder, and splitting all the css and js files into the vendor/assets/js/ vendor/assets/css/ folders, I want to just keep the entire plugin folder as is. For example, vendor/assets/multipurpose_bookshelf_slider/ How do I make sure the paths load properly, and reference them in my manifest files? Currently, I have some files place as follows (not exhaustive) /my_app/vendor/assets/multipurpose_bookshelf_slider/css/skin01.css /my_app/vendor/assets

Rails 3.1 plugin gem, dummy test app, rspec

风流意气都作罢 提交于 2019-11-28 14:10:24
问题 So Rails 3.1 comes with a little-known handy "rails g plugin new" generator, which gives you a skeleton suitable for a rails gem plugin. [http://guides.rubyonrails.org/plugins.html#or-generate-a-gemified-plugin] One of the useful things this does, is set things up conveniently for testing with Test::Unit. It gives you a basic dummy Rails app that your tests can run in the context of, to test 'engine' behavior that only functions in the copy of a Rails app. (it puts it in ./test/dummy). But

Upload Video in a rails application

跟風遠走 提交于 2019-11-28 10:25:05
I need a plugin for "Upload Videos" in a rails application. Can anyone give me an idea on how to do it? Try paperclip gem, very popular for this purpose Sujan Thakare You can also use carrierwave gem Add in your Gemfile: gem 'carrierwave' Run bundle install Create an uploader for uploading video using carrierwave generator. rails g uploader video It creates file video_uploader.rb in uploaders directory Create a migration in model where you want attach the video or image, be careful with the migration name it should be like add_{column}_to_{model} rails g migration add_video_to_post video

Rails Admin vs. ActiveAdmin [closed]

一世执手 提交于 2019-11-28 03:38:01
I've been looking into some rails admin plugins and came across these: https://github.com/gregbell/active_admin https://github.com/sferik/rails_admin https://github.com/thoughtbot/administrate (EDIT: added later) Any suggestions as to which one to go with. I would need it to support model associations and file uploads abilities. Harish Shetty I vote for rails_admin . I like its looks and the fact that out of the box all the models are available for administration. The history feature is quite useful too. Any project with Yehuda Katz as a mentor should be a safe bet. I personally think the two

execJs: 'Could not find a JavaScript runtime' but execjs AND therubyracer are in Gemfile

≯℡__Kan透↙ 提交于 2019-11-28 02:48:34
I'm getting this error: rake aborted! Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs , I have already spent more hours searching google then I am willing to admit. I believe this is an execJs bug. From all the posts, this is a very common issue with rails 3.1. A js runtime is now needed by what are now standard gems like coffee-script and sass. Most of these cases were resolved by adding the gems 'execjs' and 'therubyracer' to the app Gemfile, and then running 'bundle update' and/or 'bundle install'. But not for me. I guess I got lucky. I am running rails 3.1.3