Showing drop down list box for a field in RailsAdmin


RailsAdmin is really good if you want to create a out-of-the-box admin panel for your rails based application. It will generate a nice admin panel based on your models. Though, to me, it is not as intuitive as that of Django, it is very useful.

RailsAdmin can create several types of form fields like Text Fields, Text Area, Date Picker, Checkbox etc. based on your column’s type. However, sometime we may need to override it’s default behavior. For example, we may need to show a drop down list box for a field instead of text field.

Let’s assume we want to show a drop down list for status column of User model. So, open your user.rb from models directory and add the following method to the class definition.


def status_enum
   [['Active'],['Pending'],['Banned']]
end



Now you will see a list box for Status field when you go to Users section of Rails Admin. However,  if we can store different values in the database other than the strings shown in the list. Let’s modify our code to something like:
Continue reading →

Just received amazonkindle!

Today I came to office a bit late. Immediately after coming I was informed that a parcel has arrived on my name. I was expecting a dummy camera lens as it is supposed to come. However, seeing the packet I was a bit suspicious. The dummy lens’s package would not be so small. After I opened it, I could not believe my eyes. It is amazonkindle! Yes, I ordered it on 15th May from www.aliexpress.com! But still unbelievable. Do you know why? Keep following.

In aliexpress, when a order is placed and payment is done the order status was ‘Shipment Required‘. The seller was supposed to ship it and mark it as ‘Shipped’ and provide me the tracking ID. However, till now I did not receive any tracking and the order status was ‘Shipment Required’ last night. Seeing the seller is delaying unnecessarily, I canceled the order and aliexpress.com refunded me the whole money within few minutes. I also gave negative feedback to the buyer for wasting my time.

So, I guess you now can understand why I am so surprised seeing it. The seller must be stupid! Why s/he did not update the status of the order?

Anyway, as still in office, I could not get much time to explore it. I will explore it at home. I wish the seller will contact me and I will arrange a way to pay him.

The benefit of aliexpress is that it does keeps the money in escrow until you confirm that the product is reached to you and it is upto your expectation. I first heard about aliexpress.com from a member of Projanmo Forum.

My version is Kindle 3 WiFi + 3G. Costs (including shipping) was US$191. Also I had to pay 1050 tk here as excise duty and other fees.

“Reply to email…” most idiot feature of Facebook.com

Few days ago Facebook.com introduces a new feature “Reply to this email….”. To me this is the most stupid type feature of Facebook. Usually I get two types of email, i. when someone comments in my photo ii. when someone replies in my status.

1. Comments in my photo

Facebook sends me the comment as email and I can read it right from inbox rather than visiting the facebook. So, facilitate the conversation, Facebook now allows us to reply the comment by simply replying this email. This is the template of email

Foisal commented on a photo of you:

“some member is missing….sorry…. ;o( ”

New Feature: Reply to this email to comment on this photo.

To see the comment thread, follow the link below:

LINK TO PHOTO (Removed for Privacy)

Thanks,
The Facebook Team

Isn’t it a nice feature? But how do I know which photo is this? Suppose, someone asked me place of the photo like:

“Nice shot, where it is?”

Can you now tell me how you can answer without visiting the site? I don’t know which image, s/he commented on. So, I can’t reply without visiting the site and seeing the photo.

Suggestion: They should include image name and description in the photo and a thumbnail of image.

2. Comments on my status

When someone comments on my status, I also receive an email alert (as per my mail preference). But again, I don’t know on which status s/he commented. This is the template:

Sajjad Hossain commented on your status:

“Allah shohay hok!”

New Feature: Reply to this email to comment on this status.

To see the comment thread, follow the link below:
http://www.facebook.com/n/?profile.php&v=feed&story_fbid=331657240232&id=1080340658&mid=1e8c50fG4064b0b2G1522f9bG36

Thanks,
The Facebook Team

I don’t know what was my actual status and can’t comment by simply replying email.

Suggestion: Facebook should include original status in email.

PunBB Twitter – Twitter Updater for PunBB Forum

This morning I got this idea to make an extension for PunBB forum engine that will update twitter status upon new posts and other activities. Few hours back I have completed it.  It may need many many improvements. But yep, its ready for testing.

Current Version: 0.8

Current features:

  1. Configurable account
  2. Update on creation of new topic
  3. Update on reply on topic
  4. Update on new registration (future)
  5. Control update types (v0.5)
  6. URL shortening using to.ly (v.06)
  7. Skip forums. Updates not posted in twitter when posted on those forums.

Do you have any other update idea? please share me. I will add that too.

Click here to see a demo!

Download here. Feedback is appreciated.

Special thanks to Lee Findlow. I have used his class for updating posting message in twitter.