ruby-on-rails-plugins

translate database fields with rails

懵懂的女人 提交于 2019-12-08 04:34:24
问题 I know about the built-in I18n in Rails, but how can I select a database field per locale? My model structure is something like this: title #default (englisch) title_de #(german) title_it #(italian) In my template I want to be able to write only <%= @model.title %> and should get the value in the right language. Is there a plugin or a solution to use different fields per different locale settings with a structure like mine? 回答1: Although your db architecture (different locales hardcoded as

Mounting multiple instances of the same engine in Rails 3

北战南征 提交于 2019-12-07 11:58:56
问题 I'm wanting to make use of the new modularity prospects offered by the architecture changes in rails 3. However, rather than just mount an engine as in the majority of examples... Rails.application.routes.draw do match "/blog" => Rack::Blog end ...I'd like to mount multiple versions of the same engines, and have those instances independently configured. Something along the lines of... Rails.application.routes.draw do match "/news" => Blog.new("path/to/blog_1/config") match "/blog" => Blog.new

Importing gmail/yahoo/hotmail/aol address book with rails

試著忘記壹切 提交于 2019-12-07 11:20:56
问题 I want to import address book of users from their gmail/hotmail/yahoo and aol address books. I am looking for a gem/plugin in rails which can help me do this. Any help is appreciated. Thanks. 回答1: Ive been trying Contacts : http://github.com/cardmagic/contacts It allows to import contacts from gmail with 2 lines of code!!! Works wonderfully for me. Still have to check out if it supports insertion and syncing (??) maybe. 回答2: I once used a gem called Blackbook: http://github.com/purzelrakete

How to include a controller with a Ruby on Rails gem?

对着背影说爱祢 提交于 2019-12-06 23:17:44
问题 I'm trying to contribute to an open source project and I need a controller to handle a couple of forms that need to be submitted in. I created these controllers inside a directory inside the gem called app/controllers/gemname/my_controller.rb . However, when I try to access the controller, it seems not to be loaded (I get a name error just as if I typed something like NonExistentController). How do I load my controller with the gem? Thanks! 回答1: Let's assume your gem is called MyGem and you

Rendering validation errors in Ruby on Rails

六月ゝ 毕业季﹏ 提交于 2019-12-06 20:43:28
问题 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

Server won't start on using authlogic-oauth2

纵然是瞬间 提交于 2019-12-06 11:24:53
问题 I have included oauth2 and authlogic-oauth2 in the gemfile as I want to use them and am trying to start the server. It doesn't start and gives me the error: /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails.rb:44:in `configuration': undefined method `config' for nil:NilClass (NoMethodError) from /Library/Ruby/Gems/1.8/gems/authlogic_oauth2-1.1.2/lib/authlogic_oauth2.rb:14 from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require' from /Library/Ruby/Gems/1.8/gems

Heroku Gem doesn't work after installing it

喜欢而已 提交于 2019-12-06 11:23:31
问题 I am trying to get heroku running on Ubuntu 9.10 I typed sudo gem install heroku and everything works fine but then when I go to run: heroku list I get heroku: command not found 回答1: run gem enviroment and look where is the EXECUTABLE DIRECTORY and add it to your PATH In my case: $ gem environment RubyGems Environment: - RUBYGEMS VERSION: 1.3.5 - RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [i486-linux] - INSTALLATION DIRECTORY: /var/lib/gems/1.8 - RUBY EXECUTABLE: /usr/bin/ruby1.8 -

What is a suitable testing framework for Rails 3?

点点圈 提交于 2019-12-06 10:40:48
I am working with Ruby On Rails for the last year. But, could not work on Unit Testing. Now I have to write a unit testing code. Which testing framework is good and why? Is there any good tutorial for this? My system configuration: Ruby 1.9.2, Rails 3, Ubuntu 10 The first tip is: Try upgrading to Rails 5.x. This is good practice to always leave your system clean and faultless from third parties. Your greatest friend will always be the rails documentation: http://guides.rubyonrails.org/v3.2/testing.html In last case if you can not upgrade, you can use the Minitest/Rspec gems, in old versions

How to Install wkhtmltopdf?

廉价感情. 提交于 2019-12-06 09:54:19
Now i am working on rails 3.0.0.i am using Ubuntu 11.10 ,64 bit os.i want to install wkhtmltopdf.please tell me the static version of wkhtmltopdf. Sunny Installing wkhtmltopdf on Ubuntu Linux machine First check os is 32 bit or 64 bit by using following command Try uname -m . It seems like the uname -m actually gives x86_64 when it is an kernel 64 bits Run following command sudo apt-get install openssl build-essential xorg libssl-dev libxrender-dev Then run following command sudo apt-get install wkhtmltopdf Based on OS download wkhtmltopdf package from following site http://code.google.com/p

Rails - how to use a plugin from github (how to install, utilize, etc)

只愿长相守 提交于 2019-12-06 08:35:16
I'm trying to install a couple of different plugins for my rails 3 app. I cd to '/vendor/plugins/', then type git clone the_git_src_url . I see the files in the /vendor/plugins/ directory. However when I try to use any of the tags provided by the plugin I get uninitialized constant ContentsController::HTMLToTextileParser PriceTag and html2textile are the two plugins I'm trying to use. This is what triggers the error above: <%= PriceTag.html_to_textile(@content.desc) %> I'm working in development, I've tried to restart the server. Is there something I'm missing? html2textile is a Ruby gem, not