thanks you so much.. Joanne On Tue, Jun 21, 2011 at 1:29 PM, Chirag Singhal <[email protected]>wrote:
> Getting pretty late here, heading to bed. We can work on a cleaner solution > tomorrow or others on the forum can help. > For now, this quick and dirty solution should work: > > # In your view > <% @users.each do |user| %> > <td><%= user.name %></td> > <td><%= image_tag url_for(:controller => "users", :action => > "culture_image, :culture_id => user.culture_id, :phrase_id => ""), :width => > "25px", :height => "25px"%></td> > <% end %> > > Note that I haven't put in a value for :phrase_id in the url, please > substitute appropriate value there as required. > > # In your controller > def index > @user= User.all > end > > def culture_image > picture = Picture.where(:phrase_id => params[:phrase_id], :culture_id > => params[:culture_id]).limit(1) > if picture > send_data picture.image, :type => 'image/png', :disposition => > 'inline' > else > render :status => 404 > end > end > > Note that you may have to modify your routes to include the new method > "culture_image"... something like this" > resources :users do > get :culture_image, :on => :collection > end > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/amryLvSd4UEJ. > > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

