ruby-on-rails-plugins

Anyone knows good private message gem for rails 3.2?

左心房为你撑大大i 提交于 2019-12-06 03:19:25
问题 I spent day and day to figure out how to make good messaging system between registered member via devise. But in all cases, those gems are out of date and they don't support rails3. If you guys are trying to make the system, which include these function. How do you make? Member registration (devise) private messaging system (with acition mailer) 回答1: https://github.com/ging/mailboxer ? /config/initializer/mailboxer.rb : Mailboxer.setup do |config| config.uses_emails = true config.default_from

Rails 3.1 Mountable Engines : How to use/template it inside another application?

回眸只為那壹抹淺笑 提交于 2019-12-06 02:32:40
问题 Let's say I created a mountable engine called 'Soho' that has a controller for 'Users'. I can go to /users/1 to see my user with ID 1. Inside 'Soho', I have a application.html.erb for layout. Now let's assume I want to "blend" my engine 'Soho' in an application called 'Soho_test', and I mount my engine at "/". So, in my host application 'Soho_test', I can also go at /users/1 to see my user with ID 1. This is working. My question is : how can I do in my host application 'Soho_test' to apply

Creating WYSIWYG form builder (á la Wufoo) in Rails

荒凉一梦 提交于 2019-12-06 01:38:44
问题 I have to add Wufoo-like WYSIWYG form-builder functionality to a Rails webapp. Does anyone know of good resources (gems/engines/plugins/example code) that would help? 回答1: this is not really an answer to your question, but I still can't add comments unfortunately, due to my reputation level, sorry :) There is exact equivalent of such functionality in Drupal(php) http://drupal.org/project/webform especially useful for contact forms, i.e. clients happy and don't bug me every time they want to

recaptcha plugin for rails

心不动则不痛 提交于 2019-12-05 11:58:25
I am currently using ambethia's recaptcha plugin for rails. I want to disable the message "incorrect-captcha-sol" whenever the user incorrectly enters the wrong recaptcha. How should I go about doing this? In the source file I get the following tags surrounding the error message <p class="recaptcha_error">incorrect-captcha-sol</p> The plugin sets the flash (more precisely flash[:recaptcha_error]), i.e. it won't display message automatically. Most likely you have a piece of code that displays all flash messages. Try removing it and/or excluding flash[:recaptcha_error] from being displayed.

Gem-idea: Automatic spam protection with captcha in before_filter when HTTP-method is post,put or delete

◇◆丶佛笑我妖孽 提交于 2019-12-05 08:18:38
问题 I'm thinking about writing an automatic spam protection system (maybe I will write a public gem) for rails. My concept is to include a helper method in application_controller f.e.: class ApplicationController < ActionController::Base automatic_captcha_redirect(:min_time => 30.seconds :limit => 50) ... end Then I want to include automatical a before_filter in every controller, which checks, if the current request is via post, put or delete-method. If the user's last post-request is smaller

Factory_girl has_one relation with validates_presence_of

a 夏天 提交于 2019-12-05 03:54:57
I have 2 Models: # user.rb class User < ActiveRecord::Base has_one :profile, :dependent => :destroy end # profile.rb class Profile < ActiveRecord::Base belongs_to :user validates_presence_of :user end # user_factory.rb Factory.define :user do |u| u.login "test" u.association :profile end I want to do this: @user = Factory(:user) => #<User id: 88,....> @user.profile => #<Profile id:123, user_id:88, ......> @user = Factory.build(:user) => #<User id: nil,....> @user.profile => #<Profile id:nil, user_id:nil, ......> But this doesn't work! It tells me that my profile model isn't correct because

Rendering validation errors in Ruby on Rails

你离开我真会死。 提交于 2019-12-05 01:06:44
In a model say Task , I have following validation validates_presence_of :subject, :project, :user, :status How do I render error messages for these validations using some other controller. Inside CustomController I am using, Task.create(hash) passing nil values in hash gives following error, ActiveRecord::RecordInvalid in CustomController#create Validation failed: Subject can't be blank Code in the controller's create action @task = Task.create(hash) if @task.valid? flash[:notice] = l(:notice_successful_update) else flash[:error] = "<ul>" + @task.errors.full_messages.map{|o| "<li>" + o + "</li

Saving the order of associated records in a Rails has_many :through association

北慕城南 提交于 2019-12-04 21:35:16
问题 I'm working on a Rails plugin that includes a way to modify the order of associated records in a has_many :through association. Say we have the following models: class Playlist < ActiveRecord::Base has_many :playlists_songs, :dependent => :destroy has_many :songs, :through => :playlists_songs end class Song < ActiveRecord::Base has_many :playlists_songs, :dependent => :destroy has_many :playlists, :through => :playlists_songs end class PlaylistsSong < ActiveRecord::Base belongs_to :playlist

TypeError (can't convert nil into Integer):

怎甘沉沦 提交于 2019-12-04 21:07:25
I developed a plugin in rails 3, which servers a a document repository for models. In any model you can attach any number of documents with specific names. Like. class Person < ActiveRecord::Base attach_documents_as :job_documents attach_documents_as :personal_documents end It was working very good. I know it looks to be stupid, but today i start my project and found it dead. Can not figure out why does it happens. Tried a lot to figure out but no luck. New and Update forms shows well but when ever we create or update it does generate an error. It is giving a major error: TypeError (can't

Ruby on Rails Win7 x64?

谁都会走 提交于 2019-12-04 19:54:04
I've just upgraded to Win7 x64 Professional and wanted to recommence developing my Rails Apps, however I'm getting the following error : => Booting Mongrel => Rails 2.3.5 application starting on http://127.0.0.1:3344 D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:271:in `require_frameworks': 193: %1 is not a valid Win32 application. - D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/1.8/i386-mswin32/openssl.so (RuntimeError) from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:134:in `process'