This is helpful to have the single login for multiple level domains. Edit your environment configuration and add something like this; (E.g in environment.rb or production.rb) config.action_controller.session = {:domain => “.arthurneil.com”, :key => ‘_arthurs_session_id’, :secret => ’4gfsdf234jmfv35ksdf23m44m4m4neserf345′} Likewise, to target the cookies based on particular domain, try; (E.g) cookies[:my_test_cookie] = {:value => “test”, :expires => [...]
Posts Tagged ‘Ruby on Rails’
Domain based sessions and cookies [Ruby on Rails 2.2+]
Posted in Ruby on Rails, tagged lessons, programming, Ruby on Rails on July 14, 2009 | Leave a Comment »
Removing extra whitespaces from string or params [Ruby on Rails]
Posted in Ruby on Rails, tagged lessons, ruby, Ruby on Rails on July 10, 2009 | Leave a Comment »
” Arthur Neil “.squeeze(” “).strip To find empty characters/space in a filed; use if params[:description].squeeze(” “).strip.length == 0 [handle it here] end
‘load_missing_constant’: uninitialized constant Inflector (NameError) -[Active Merchant and RoR]
Posted in installations, Ruby on Rails, Weird Errors, tagged bug fixes, installations, lessons, Ruby on Rails on June 30, 2009 | Leave a Comment »
If you have recently updated to Rails 2.2 or +, you may encounter this error: /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:443:in `load_missing_constant’: uninitialized constant Inflector (NameError) from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:80:in `const_missing’ from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:92:in `const_missing’ from /usr/local/rails/mogulus/vendor/plugins/active_merchant/lib/active_merchant/billing/integrations.rb:13 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’ Go to the error file; /usr/local/rails/mogulus/vendor/plugins/active_merchant/lib/active_merchant/billing/integrations.rb and replace; Inflector.inflections do |inflect| . . . end with; ActiveSupport::Inflector.inflections do |inflect| . . . end
No such file to load mysql – Ruby on Rails [even after gem install mysql]
Posted in installations, Ruby on Rails, Weird Errors, tagged bug fixes, installations, lessons, Ruby on Rails on June 25, 2009 | Leave a Comment »
You may face some issues while configuring rails; no such file to load — mysql /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’ /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’ /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require’ /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/mysql_adapter.rb:65:in `mysql_connection’ and so on step 1: If you havn’t done “gem install mysql”; do it first. step 2: If it doesn’t work even after “gem install mysql”; search for “mysql.so” in your system. [...]
Single/custom table name for a model in Ruby on Rails
Posted in Ruby on Rails, tagged lessons, Ruby on Rails on June 20, 2009 | Leave a Comment »
Use; set_table_name :name_of_the_table in your model (E.g) class myTable < ActiveRecord::Base set_table_name :media end
Generating sitemap in Ruby on Rails
Posted in Ruby on Rails, tagged lessons, Ruby on Rails on April 27, 2009 | Leave a Comment »
Create a controller with the name ‘sitemap’ (or) with the name you desire….. (E.g) ruby script/generate controller sitemap (or) You can manually create one [app/controllers/sitemap_controller.rb] When you view the ‘controller file’ which you created just now, it would look like; class SitemapController < ApplicationController end Once it’s done, we need to add the functionality to [...]
Running Rails code through a cron job
Posted in Ruby on Rails, tagged Ruby on Rails, tips on April 7, 2009 | Leave a Comment »
Rails comes with a script/runner script that can be used to run the code in your Rails app. There’re many ways to organize your code to let this runner script execute it, but one obvious way is to write the code as a model’s action. Here are quick steps for doing this: 1. Insert the [...]
Rails Freeze
Posted in Ruby on Rails, tagged lessons, Ruby on Rails on January 11, 2009 | Leave a Comment »
To Freeze to your installed version of rails: rake rails:freeze:gems Freeze to edge rails (latest version, probably not a good idea as rails has had some radical changes lately. If you want to do RESTful, then go for it). rake rails:freeze:edge Freeze to a specific version, eg 1.2.3: rake rails:freeze:edge TAG=rel_1-2-3
undefined method fragment_cache_store=
Posted in Ruby on Rails, Weird Errors, tagged bug fixes, Ruby on Rails on December 18, 2008 | Leave a Comment »
Make it ‘cache_store‘ insted of ‘fragment_cache_store’ It should look something like, ActionController::Base.cache_store = :file_store, “../my_cache”
undefined method template_root=
Posted in Ruby on Rails, Weird Errors, tagged bug fixes, Ruby on Rails on December 18, 2008 | Leave a Comment »
template_path has been not only deprecated but is now gone. Try changing it to view_paths