ruby-on-rails-plugins

How do I convert an existing Rails 3 Application into an Engine?

房东的猫 提交于 2019-12-31 08:47:10
问题 How can I convert the Forum application I've been developing into a Rails Engine, so that it may be embedded inside other applications? What should I add, keep, or remove? Should I offer a way to integrate the models? How do I set up routes and user configuration? How do I package it into a Gem? What should I watch out for? After reading the articles and the documentation, I managed to narrow down my questions: Should I namespace the models? That is, should I keep them in my Engine's module

Rails 3.1.0, geokit, with error acts_as_mappable

邮差的信 提交于 2019-12-31 04:43:05
问题 I am getting the undefined local variable or method `acts_as_mappable' error when using geokit, and after tons of Goggling and attempts, I cannot seem to be able correct the problem. Basically, I have the following gems installed: geokit (1.6.0, 1.5.0) geokit-rails31 (0.1.3) and have the following in my model class House < ActiveRecord::Base acts_as_mappable end and Gemfile: gem 'geokit', '>= 1.5.0' gem 'geokit-rails31' I get the error with or without doing the following in my local app.

Facebooker extended permissions?

浪子不回头ぞ 提交于 2019-12-31 01:51:33
问题 Facebook gives access to users' emails via the extended permission. There's also a way in JS and PHP to force users to grant the permission when they accept the app's TOS - http://wiki.developers.facebook.com/index.php/Extended_permissions Is there a way that I can do this with Facebooker? Regards.. 回答1: You can do it just like that : :jquery , :app_settings => " { permsToRequestOnConnect : 'email' }"} %> 'facebook') + '\'') %> Note: Also get the last version of facebooker, because previus

JQuery AJAX exception only in Firefox: “Node cannot be inserted at the specified point in the hierarchy” (HierarchyRequestError)

可紊 提交于 2019-12-30 09:42:36
问题 Very strange problem: I have a 2-part dropdown, where selecting a State will then add a second dropdown giving you a list of MSA Areas in that State. This is done using a JQuery Get request to a controller that returns the list of Areas in a Select dropdown, like jQuery(function($) { // when the #area_state field changes $("#area_state").change( function() { // make a call and replace the content var state = $('select#area_state :selected').val(); if(state == "") state="0"; jQuery.get( '

JQuery AJAX exception only in Firefox: “Node cannot be inserted at the specified point in the hierarchy” (HierarchyRequestError)

别说谁变了你拦得住时间么 提交于 2019-12-30 09:42:28
问题 Very strange problem: I have a 2-part dropdown, where selecting a State will then add a second dropdown giving you a list of MSA Areas in that State. This is done using a JQuery Get request to a controller that returns the list of Areas in a Select dropdown, like jQuery(function($) { // when the #area_state field changes $("#area_state").change( function() { // make a call and replace the content var state = $('select#area_state :selected').val(); if(state == "") state="0"; jQuery.get( '

rails plugin isn't installing

て烟熏妆下的殇ゞ 提交于 2019-12-25 04:15:52
问题 I am trying to install restful_authentication plugin use following git... git://github.com/Satish/restful-authentication.git and i am trying to install using following command... c:\Users\Admin\Downloads\rails_apps\students> ruby script/plugin install git://github.com/Satish/restful-authentication.git But its not installing as expected, please help, thanks. 回答1: Not exactly an answer, but what version of rails are you using? The restful authentication plugin hasn't been updated in a long

How to extend a model in a Rails engine from another Rails engine?

扶醉桌前 提交于 2019-12-24 16:55:06
问题 I think the simplest way to explain this is with a contrived example. I am using Rails 2.3.8 with Ruby 1.8.7 and ActiveRecord to MySQL db. I have the following (contrived) model in one engine (installed in vendor/plugins directory of main app): # contrived_app/vendor/plugins/concerts_engine/app/models/ class Concert < ActiveRecord::Base has_many :artists belongs_to :venue end And the following (contrived) model in another engine: # contrived_app/vendor/plugins/tickets_engine/app/models/ class

Enabling stemming from sphinx.yml in Thinking Sphinx

谁都会走 提交于 2019-12-24 01:03:33
问题 I created a config/sphinx.yml file with the line: morphology: stem_en After running rake ts:config, it doesn't seem to have changed development.sphinx.conf, and following a rebuild, searching for "dawg" doesn't match "dawgs". How can I get this to work? 回答1: If I recall correctly the morphology line should fall under a "development" header like so: development: morphology: stem_en Not sure if you've done so already, but if not give it a try. 来源: https://stackoverflow.com/questions/1173777

Factory_girl has_one relation with validates_presence_of

好久不见. 提交于 2019-12-22 04:16:07
问题 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,

TypeError (can't convert nil into Integer):

夙愿已清 提交于 2019-12-22 01:15:13
问题 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