ruby-on-rails-plugins

Problem running Thinking Sphinx with Rails 2.3.5

﹥>﹥吖頭↗ 提交于 2019-11-30 17:10:49
问题 I just installed Sphinx (distro: archlinux) downloading the source. Then I installed "Thinking Sphinx" plugin for Rails. I followed the official page setup and this Screencast from Ryan Bates, but when I try to index the models it gives me this error: $ rake thinking_sphinx:index (in /home/benoror/Dropbox/Proyectos/cotizahoy) Sphinx cannot be found on your system. You may need to configure the following settings in your config/sphinx.yml file: * bin_path * searchd_binary_name * indexer_binary

Multi level block method is generating issue

依然范特西╮ 提交于 2019-11-30 16:08:33
I have a class class DataListBuilder include ActionView::Helpers::TagHelper include ActionView::Helpers::CaptureHelper include ActionView::Helpers::UrlHelper attr_accessor :object, :output_buffer def initialize(object) @object, @output_buffer = object, nil end def column (&block) if block_given? content_tag(:li, block.call(self)) else content_tag(:li, "") end end def options_column(&link_block) if block_given? content_tag(:li, content_tag(:dl, "<dt><a href='#'> </a></dt><dd><ul>#{link_block.call(self)}</ul></dd>".html_safe, :class=>'options')) else content_tag(:li, "") end end def link_item

How to make model IDs in Rails unpredictable and random

一笑奈何 提交于 2019-11-30 11:31:04
问题 I'm writing a rails app that, by its nature, CANNOT require users to register, and thus cannot use authentication as the usual means to protect records. (I know, I know...) User information here is limited to email addresses. So I do need a way to make my model IDs unpredictable so that other IDs cannot be easily guessed. (I know, I know...) I have tried using plugins like uuidtools to randomize ids as records are created, like so: require 'uuidtools' class Post < ActiveRecord::Base def

How can I force my plugin to reload with each request?

孤者浪人 提交于 2019-11-30 07:56:45
问题 As I understand it, plugins are not reloaded in Rails with each request in development mode. Which makes sense, as generally you add plugins to your app and it's the app you're developing. But if you are developing a plugin, you have to restart the server with each change to the plugin which has a significant overhead. Is there any way to make Rails reload your plugin during development, the way it reloads your models and controllers? 回答1: If restarting the server automatically when plugin

Multi level block method is generating issue

本小妞迷上赌 提交于 2019-11-30 00:13:55
问题 I have a class class DataListBuilder include ActionView::Helpers::TagHelper include ActionView::Helpers::CaptureHelper include ActionView::Helpers::UrlHelper attr_accessor :object, :output_buffer def initialize(object) @object, @output_buffer = object, nil end def column (&block) if block_given? content_tag(:li, block.call(self)) else content_tag(:li, "") end end def options_column(&link_block) if block_given? content_tag(:li, content_tag(:dl, "<dt><a href='#'> </a></dt><dd><ul>#{link_block

Building a ruby gem for Rails applications

不想你离开。 提交于 2019-11-29 23:09:04
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 plugin and convert it to a gem, I've seen the words 'package it as Gem'. Also the gem I'm thinking of

Is Cassandra production ready for Ruby on Rails?

最后都变了- 提交于 2019-11-29 20:17:47
I'm working on a project that is considering using Cassandra as a database. We would like to eventually migrate to Cassandra even if we use MySQL to start with, given its scalability. I know that big companies like Facebook, Digg, and recently Twitter is using Cassandra, but I don't believe any of those sites run off Rails. My question is whether or not it's feasible to use Cassandra using Ruby on Rails. Points to consider: We heavily rely on the Authlogic gem. Would switching to Cassandra affect how it works? Are there any mature ruby clients for Cassandra? Looking on Github it seems that

Rails Devise: get object of the currently logged in user?

﹥>﹥吖頭↗ 提交于 2019-11-29 19:48:58
I've recently installed Devise on a rails application, and I am wondering if it is possible to get an instance of the currently logged in user in either one of the other models or controllers, and if so, how do I do that? Devise creates convenience methods on the fly that represent your currently logged user. However you should note that the generated method name includes the class name of your user model. e.g. if your Devise model is called ' User ' then the currently logged in user can be accessed with ' current_user ', and if your Devise class is ' Admin ' then the logged in admin user can

Rails 3.1 plugin gem, dummy test app, rspec

扶醉桌前 提交于 2019-11-29 18:57:18
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 your tests are still in my_gem/test , the tests dont' live in the dummy app. And my_gem/test/test_helper

How can I force my plugin to reload with each request?

ぐ巨炮叔叔 提交于 2019-11-29 05:42:59
As I understand it, plugins are not reloaded in Rails with each request in development mode. Which makes sense, as generally you add plugins to your app and it's the app you're developing. But if you are developing a plugin, you have to restart the server with each change to the plugin which has a significant overhead. Is there any way to make Rails reload your plugin during development, the way it reloads your models and controllers? If restarting the server automatically when plugin code changes is an acceptable solution, you could use Mike Clark/topfunky's rstakeout for that, or the newer