Want to say me "thanks" ?
Send SMS to number 97605 with message
RRR TNK iNNERMAn
from USA only.. cost u 1$ only and alot for me
10x !
Color is not a module
/usr/lib/ruby/gems/1.8/gems/color-1.4.0/lib/color.rb:19
#require "color"
require 'pdf/writer'
require 'pdf/writer/graphics'
require 'pdf/simpletable'
class ModelA
require 'RMagick'
include Magick
require 'rvg/rvg'
class ModelB
require "color"BEFORE
require 'RMagick'in ModelB so it will looks like:
require "color"
require 'RMagick'
include Magick
require 'rvg/rvg'
class ModelB
Tags: globalize, rails 2.3.2, update
Hi,
In 2.1+ there are new migration style - it uses time stamp to create migration filename , just like Enhanced Migrations Plugin did.
Recently i updated my application to 2.1.2 (from 2.0.2) and found incompatibility with this plugin.
So we need to update our database!
We need take all Enhanced Migrations Plugin "migrations_info" and simply put them on schema_migration table !
First, backup your database.
Next:
DROP TABLE IF EXISTS schema_migrations;
CREATE TABLE schema_migrations (
version varchar(255) NOT NULL,
UNIQUE KEY unique_schema_migrations (version)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO schema_migrations (SELECT ID FROM migrations_info);
DROP TABLE migrations_info;
Adding and modifying table with Rails was never so easy and sexy !
You don't need to make tons of add_column for one type.. use change_table !!
and for def self.down use remove_column :table_name, [:column1, :column2 ...]
change_table(:suppliers) do |t|
t.column :name, :string, :limit => 60
end
change_table(:suppliers) do |t|
t.integer :width, :height, :null => false, :default => 0
end
change_table(:suppliers) do |t|
t.timestamps
end
change_table(:suppliers) do |t|
t.references :company
end
Creates a company_id(integer) column
change_table(:suppliers) do |t|
t.belongs_to :company, :polymorphic => true
end
Creates company_type(varchar) and company_id(integer) columns
change_table(:suppliers) do |t|
t.remove :company
end
change_table(:suppliers) do |t|
t.remove :company_id
t.remove :width, :height
end
change_table(:suppliers) do |t|
t.remove_index :company_id
end
HAVE FUN !!
Tags: alter table, migrations, new migration
Do you want will_paginate with AJAX functionality ?
Follow:
gem sources -a http://gems.github.comgem install mislav-will_paginateRails::Initializer.run do |config|Next step, create new helper: remote_link_renderer.rb .. and copy&paste inside:
...
end
require 'will_paginate'
Now, to ajaxize put:
class RemoteLinkRenderer < WillPaginate::LinkRenderer
def prepare(collection, options, template)
@remote = options.delete(:remote) || {}
super
end
protected
def page_link(page, text, attributes = {})
@template.link_to_remote(text, {:url => url_for(page), :method => :get}.merge(@remote))
#replace :method => :post if you need POST action
end
end
<%= will_paginate @events, :renderer => "RemoteLinkRenderer",:remote => {, :update => "events_container", :loading => visual_effect(:appear, "loader"),:complete =>visual_effect(:fade,"loader" ) } %>will call /events?page=x with AJAX request..
respond_to do |format|
format.html { }
format.js { render :partial => "events" }
format.xml { render :xml => @events.to_xml }
end
Tags: ajax, gem, will_paginate
Okay, situation is:
Parties involved: Rails 2.0.2, Globalize plugin, acts_as_taggable_on_steroids, ME.
(clickables) :)
Having model Event that translates :name, :body, :description with Globalize plugin.
Also Event are acts_as_taggable with acts_at_taggable_on_steroids ...
Ok for now, model works well, translated well, adding/removing/editing tags as well !
The problem is raise when we trying to @tags = Event.tag_cloud
we got :select option not allowed on translatable models (DISTINCT * FROM events .... !! THAT IS BADD !!!
Solution:
Open /ventor/plugin/acts_as_tabbable_on_steroids/lib/acts_as_taggable.rb
FIND:
LINE: 66
def find_tagged_with(*args)
options = find_options_for_find_tagged_with(*args)
options.blank? ? [] : find(:all, options)
end
def find_tagged_with(*args)
options = find_options_for_find_tagged_with(*args)
options.blank? ? [] : untranslated_find(:all, options)
end
Hi !
Personally i am hosting 3 websites working very well with dreamhost ( thru mod_rails & passanger), and its very easily to create new projects, svn repositories, mysql, custom gem packs, etc... everything You need for Rails site.
SOO if you want fast and cheap rails hosting check Dreamhost !
I would recommend basic plan(its really enought for hosting rails!),
I can give You free LIFETIME domain registration(domain never expires and You NEVER pay for him) !
This discount give's You upon NEW registration.
Plus i give You:
10$ off for monthly hosting plan,
25$ off for one year plan,
40$ (!) off for two year plan,
So get yourself promotional code BOTVECTORCX on DREAMHOST (click here)
(free lifetime domain + hosting discounts), enter promotional code in bottom of registration form to redeem $$$$$$ !
Have Fun !!! :)
p.s. If you need more specific code let me know ;)
Tags: discount, dreamhost, free domain, rails, rails hosting