Monthly Archives: May 2011

rails

Scaffolding in admin namespace with model in the root namespace

This is by far the most popular structure used by any web application.

To have ‘admin’ in sub-folder using to manage the administrative information.

Such as we have ‘category’ model, and we want to manage the scaffold in www.myrailsapp.com/admin/categories instead of www.myrailsapp.com/categories

Too bad, the generators provided by RoR didn’t included this.

Here are the steps you need to do this practices.

  • Generate a blank controller named ‘admin/categories’. (mentioned that it is ‘categories’, you have to manually ‘s’ it.)
  • Generate a scaffold ‘category’, the model ‘category’ will be generated while the ‘categories_controller’ and related views will be generated too.
  • Move all functions from ‘categories_controller’ to ‘admin/categories_controller’.
  • Delete ‘categories_controller’.
  • Move all views from ‘views/categories’ to ‘views/admin/categories’.
  • Delete the folder ‘views/categories’.
  • Edit the routes.rb and add this line :
    namespace :admin do resources :categories end
  • Edit the ‘admin/categories_controller’, modify the redirect_to to specify the namespace being used like this :
    redirect_to([:admin,@category], ...)
  • Edit the ‘admin/categories_controller’, modify the categories_url to admin_categories_url.
  • Now edit all views, do the same with link_to, if you found @categoy, just add :admin to specify the namespace.
  • Do the same in all views, change xxx_categories_path to xxx_admin_categories_path.
  • Then modify the form view, change from form_for(@category) to form_for([:admin,@category]).

It will works now.

Also, if the Destroy action didn’t work, didn’t popup a confirm message, please include the bundled ‘prototype.js’ and ‘rails.js’ into your template too.

Hope this help.

 

rails

Ruby on Rails Problem #2 : rake 0.9.0 (undefined command ‘task’)

Yup, this is the problem #2 of Ruby on Rails which I want to jot down into my blog.

It is an error message showing after I’ve executed ‘rails new …’ (yo, when attempting to create new rails application)

Problem : Error message is undefined command ‘task’.

Reason

This is somewhat a bug in rake 0.9.0 from what I’ve observe this problem over Google.

Solution

Simple by adding this piece of code…

module ::AppName
class Application
include Rake::DSL
end
end

module ::RakeFileUtils
extend Rake::FileUtilsExt
end

between the line…


require 'rake'

and


AppName::Application.load_tasks

Hope this help!

rails

Ruby on Rails Beginner’s Problem #1

Well, I just want to write a quick short post here about the problem I’m facing when beginning with Ruby on Rails on Windows while I didn’t found this problem when I’m riding Ruby on Rails on Mac OSX.

Problem #1 : error message when the database gems were installed but not required binaries. (sqlite3, mysql or else…)

Reason

This is just because you don’t have the required binaries for those database in the correct place.

Solution

Easy, just download the binaries of those database and put it into c:\Ruby192\bin folder or your ruby’s bin folder.

For sqlite3_ruby gem -> you need sqlite3.dll

For mysql gem -> you need libmysql.dll

Sqlite website allow you to download on compiled binaries, I’m not sure about mysql but I just copy the libmysql.dll from wamp/mysql/bin folder.

Hope this help.

NicheReaper Status

Is NicheReaper for you?

Hi friends,

I’m not going to make this post SEO well-written. Just want to make a quick short share about NicheReaper which is claim as one of the great Keyword Research tool for niche marketers.

I also got many emails from big names who almost enjoy promoting this service probably because it has a strong potential to generate passive income commission which is 60% of the $69 for the first month and 40% on the next months. It is by far one of the best affiliate program I found on earth. (I didn’t post about commissions from 2 upsells and 1 down sell yet.)

However, what made me very interesting about NicheReaper is that my most respected marketer is promoting it as he never promotes suck products for a long time.

So, I join in immediately since yesterday.

Today I’m going to share with you the first experience of mine on NicheReaper after about 18 hours of purchase.

What is NicheReaper?

What type of problems it try to solve?

Quick and short, NicheReaper try to solve the problem most niche marketers are facing even they are newcomers or the experienced one.

Yup, it is niche/keyword research.

Do you tired finding a new niche to market by…

- Visit some news site to see what niche is interesting

- Extract keywords related to the chosen niche

- Do competitive intelligence to see if you can dominate or share the profit which is includes checking these parameters, AdWords CPC, Search volume, Competitor’s PageRank, Backlinks check

- If it is good to go, you have to do more by finding a good domain name to easily dominate the niche

Sounds very familiar right? It is a standard process of doing niche marketing. Smile

NicheReaper is designed to do all of the above process for you and it is doing automatically.

What I think NicheReaper is standing out from other keyword research tools is that it is automatically research new niches/keywords everyday, actually, every minutes because you can see new keywords coming in the system lively.

Haha, like watching stock. Smile

From the first day, I think NicheReaper is great but what I’m wondering is…

Does NicheReaper worth $69/month?

The main point made me wonder is that NicheReaper is using Phrase Match Type for search volume, yes, I written it correct, Phrase Match not Exact Match which I never experiences with it in my own niche marketing.

I always use Exact Match in the pass, but I saw in the forum from Matt, the co-founder of NicheReaper that Exact Match will produce virtually zero opportunity right now which I almost agreed with him.

I will share you guys in the next week after I’ve more experienced with NicheReaper, also, I will share here the result from trying to market a niche by using Phrase Match instead of Exact Match.

Keep visit here to update.

PS. I’m an active user of the following keyword research tools…

- Market Samurai : The best tool for detailed research!

- Brad Callen’s Niche Finder : The best tool for quick research and identify the profitable niche!

- NicheReaper : The best tool like Niche Finder but I can have virtually nothing in my brain to use it. Open-mouthed smile