ruby-on-rails-plugins

Filter chain halted as [:login_required] rendered_or_redirected

[亡魂溺海] 提交于 2019-12-03 10:58:43
Hopefully I can explain this well enough, but please let me know if more information is needed! I'm building a form where a user can create an "incident". This incident has the following relationships: belongs_to: customer (customer has_many incidents) belongs_to: user (user has_many incidents) has_one: incident_status (incident_status belongs to incident) The form allows the user to assign the incident to a user (select form) and then select an incident status. The incident is nested in customer. However, I'm getting the following in the server logs: Processing IncidentsController#create (for

Warning while installing the rails plugin

廉价感情. 提交于 2019-12-03 10:34:43
I am getting the following warning while installing any plugin in my rails application. /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/core_ext/kernel/agnostics.rb:7: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777 Can someone please tell me how to solve this problem? Thanks Ruby (on all Unixes, including Cygwin) warns if you try to run an external program and your $PATH contains a world-writable directory. It doesn't just check the directories on $PATH: it checks each of their parents, too, because if /usr/local (say) is world-writeable,

Dependency included in gemspec not added to asset pipeline in rails engine

早过忘川 提交于 2019-12-03 09:52:15
I'm writing a rails engine that has some dependencies. I've specified the dependencies in the gemspec and the engine is finding them when I run bundle install (i.e. Gemfile.lock looks correct). When I want to use the plugin in a Ruby file, I can do so but need to explicitly require dependency-name at the top of the file. However, when I want to use the dependency's asset pipeline, sprockets can't find it. The app I'm using (for now) is the dummy app that comes in a rails plugin's test folder. Sprockets can find the assets if I specify them in the engine's Gemfile (which is really the dummy app

Rails plugin development documentation and resources

心不动则不痛 提交于 2019-12-03 09:29:43
Are there any resources or documentation for developing Rails plugins? I'm using other plugins as examples, but it's hard to know if I'm doing something wrong, or if there's another way to do something. All I can find are old blog posts. I haven't found any documentation on how to develop plugins and what functionality/hooks are available. Check this very good list: HOWTO: Make A Rails Plugin From Scratch Rails Plugin Tutorial Demystifying Rails Plugin Development How to write a Rails Plugin (for controllers) The Basics of Creating Rails Plugins Build Your Own Rails Plugin Platform with Desert

Mahout Plugin for ruby on rails

我与影子孤独终老i 提交于 2019-12-03 09:17:03
问题 I want to use Apache Mahout in my project on Ruby on Rails for implementing recommendations and collaborative filtering. In Particular my requirements are: suggesting related tags. suggesting related articles. based on user's preferences prompt him for review of articles. based on geographical location, and other meta information of a user, suggest him similar users. I am open to using any other solution (other than mahout) if it integrates with rails easily and fulfills my requirements. 回答1:

Multiple Paperclip default_urls

时光怂恿深爱的人放手 提交于 2019-12-03 09:08:08
I am using Paperclip to upload an image to my Project model and I want to have an array of default images (not depending on the style, but different images) is that posible? To pass an array instead of just one URL to the :default_url option? Thank you, Nicolás Hock Isaza So close: If you want the images to change randomly, and not just on first load of the model: :default_url => lambda { "path/to/images/#{rand(5)}.jpg" } Putting rand(5) in the default_url proc will assign a random image every time a new model object is created. If you want the images to be randomly assigned and that each

How to detect browser type and its version

一曲冷凌霜 提交于 2019-12-03 08:22:18
问题 how can i detect browser type and its version in Rails. I want to put check on the version of specific browser and if its not required browser version than ask user to upgrade it.. i use below specified command but as its not following a standard pattern am unable to use it. request.env['HTTP_USER_AGENT'] Chrome out put is below Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.205 Safari/534.16 Safari out put is below Mozilla/5.0 (Windows;

How to get the list of all engines in Rails 3 app

时间秒杀一切 提交于 2019-12-03 08:12:43
According to Rails engines extending functionality in Rails 2.x one could do Rails::Initializer.new(Rails.configuration).plugin_loader.engines This code is not working in Rails 3 ActionController::RoutingError (undefined method `new' for Rails::Initializer:Module): config/application.rb:12:in `require_or_load' What do I need to do in Rails 3 to get such list of engines? This is needed for Extending controllers of a Rails 3 Engine in the main app As of 5/10/2011 and Rails 3.1 beta, it's now Rails::Application::Railties.engines This has changed with Rails 4.1. The accepted answer is deprecated

Get a value of object field inside fields_for loop

寵の児 提交于 2019-12-03 05:33:55
问题 In the following scenario, I need to check the value of the object property in the fields_for loop. <%= f.semantic_fields_for :review_details do |rd| %> <%= rd.input :review_criteria_id, :as=>:hidden %> <% end %> As in the loop, :review_criteria_id is rendered as hidden field, but I have a scenario, where I have to print some more information if it is a specific criteria. How can I get the value of review_criteria_id in the loop. I used: rd.review_criteria_id But since rd is the formtastic

switching a subdirectory managed by git to a submodule

六月ゝ 毕业季﹏ 提交于 2019-12-03 03:21:24
We used to have a local hack of delayed_job in a Rails app, in vendor/plugins/delayed_job. It was installed as a one-time event and checked into git in the main app repo. Now we decided to fork delayed_job on github and replace the subdirectory by a git submodule, as described e.g. here: http://doblock.com/articles/using-git-submodules-to-manage-plugins-in-rails Before doing that, I simply removed vendor/plugins/delayed_job, without checking it in. Now, despite adding the submodule, git status in the main repo still shows new files in vendor/plugins/delayed_job. How should we handle the