Senior & Expert RoR Developers Discussion Forum by Nyros Technologies

HIRE Ruby on Rails Expert Developers Programmers Coders From India
Ruby on Rails PHP .Net Developers Community, Nyros Technologies, Kakinada
 
Log in  or IF not a member please REGISTER
Username:
Password:   


Keyword
Log in | Profile 

Mime type in rails

 
Post new topic   Reply to topic    Senior & Expert RoR Developers Discussion Forum by Nyros Technologies Index -> Plugins and Gems
View previous topic :: View next topic  
Author Message
ktulasi



Joined: 21 Oct 2009
Posts: 55

PostPosted: Thu Jan 21, 2010 2:01 pm    Post subject: Mime type in rails Reply with quote

hello friends,
Can any one tell me what is the Mime type in rails.

Thanks in advance.
Back to top
View user's profile Send private message
swaminadhan



Joined: 14 Sep 2009
Posts: 73

PostPosted: Thu Jan 21, 2010 2:13 pm    Post subject: Reply with quote

Hi,

Mime types will helps in rendering the content in many ways, that means displaying the content on many ways which is visible to the user.

Normally we have to add the file extensions o the mime type but in general few mime types were included in the default library.

WE can compile the mime types and we should place in th lib folder

You only need to add mime types to Rails if you intend to generate responses for them

Mime::Type will fail on extensions starting with a number (like .3gp) because it tries to define a constant for every extension, and of course constants can’t start with a number.



Some great Rails plugins like attachment_fu use the content type/mime type of a file to validate the instance of an object

When we use this attachment_fu plugin we will use the content type and we will give the image extensions as .jpj or .png.

Mime::Type.register will add the image/png mime type to the collection of mime types, bind it to the .png extension. It also creates a special Mime::Type instance at Mime::PNG



Thank you,
swaminadhan.
Back to top
View user's profile Send private message
suryakantb



Joined: 02 Dec 2009
Posts: 1
Location: India

PostPosted: Fri Jan 22, 2010 12:34 pm    Post subject: Reply with quote

Hi,
Check this out

Encapsulates the notion of a mime type. Can be used at render time, for example, with:
class PostsController < ActionController::Base
def show
@post = Post.find(params[:id])

respond_to do |format|
format.html
format.ics { render :text => post.to_ics, :mime_type => Mime::Type["text/calendar"] }
format.xml { render :xml => @people.to_xml }
end
end
end
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Senior & Expert RoR Developers Discussion Forum by Nyros Technologies Index -> Plugins and Gems
Page 1 of 1

 latest topics 
 Topics   Replies   Author   Views   Last Post 
No new posts validates_multiparameter_assignments plugin usage:
0 vijayalakshmi 27 Wed Jul 28, 2010 4:24 am
vijayalakshmi View latest post
No new posts paperclip plugin usage in rails:
0 vijayalakshmi 23 Wed Jul 28, 2010 4:07 am
vijayalakshmi View latest post
No new posts Polymorphism
1 phani.galla 46 Tue Jul 27, 2010 3:27 pm
umamahesh_nyros View latest post
No new posts Deploying Ruby on Rails Application with Passenger
2 sivakrishna.m 630 Tue Jul 27, 2010 2:16 pm
criether View latest post
No new posts Steps to implement star-rating using acts_as_rateable plugin
0 vijayalakshmi 46 Mon Jul 26, 2010 5:47 am
vijayalakshmi View latest post
No new posts Twitter Retweet Integartion
0 Anu 41 Thu Jul 22, 2010 12:27 pm
Anu View latest post
No new posts Usage of build method in rails
0 ktulasi 30 Thu Jul 22, 2010 12:19 pm
ktulasi View latest post
No new posts Facebook Like Integration in Rails
0 Anu 53 Thu Jul 22, 2010 12:16 pm
Anu View latest post
No new posts Fshare in your Rails Application.
0 Anu 39 Thu Jul 22, 2010 12:10 pm
Anu View latest post
No new posts Installation of Postgresql in windows.
1 swaminadhan 198 Thu Jul 15, 2010 10:17 am
proximity3 View latest post




Hire an expert Ruby on Rails developer / coder / programmer or development team from India now!!

Other Forums : PHP   ::   .Net   |   Free unlimited HTML CSS templates download

Nyros Technologies   |   Kakinada City Portal   |   Developers Blog   |   About Ruby on Rails Experts   |   More