<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
            "http://my.netscape.com/publish/formats/rss-0.91.dtd">

<rss version="0.91">

<channel>
<title>ruby-rails archive @ ASPN</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Browse/Threaded/ruby-rails</link>
<description>Discussion about using the ruby on rails framework</description>
<language>en-us</language>
<copyright>Copyright 2005, ActiveState</copyright>
<managingEditor>aspn-feedback@activestate.com</managingEditor>
<webMaster>aspn-feedback@activestate.com</webMaster>

<image>
<title>ruby-rails @ ASPN Mail Archive</title>
<url>http://ASPN.ActiveState.com/ASPN/img/logo_78x25.gif</url>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Browse/Threaded/ruby-rails</link>
</image>

<item>
<title>[Rails] finding one db entry and how to display it in a view</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-rails/3173805</link>
<description>&lt;PRE>Here is my controller:

class BrowseController &lt; ApplicationController
  def index
    @... = Product.find(:all)
  end

  def item
    @... = Product.find(:all, :conditions => "id = #{params[:id]}")
  end
end


---

the 'item' method is bothering me, because I know I should be able to 
simply do:


  def item
    @... = Product.find(params[:id])
  end

but then I don't know how to access it in the view other than,

&lt;% for column in Product.content_columns %>

which I don't want to do, I want to be able to call @... 
@... directly... Any ideas?

TIA

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Rails mailing list
Rails@...
http://lists.rubyonrails.org/mailman/listinfo/rails
&lt;/PRE></description>
</item>

<item>
<title>[Rails] Re: Problem integrating rails into apache</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-rails/3173804</link>
<description>&lt;PRE>SmokeyD wrote:
> An error appears in development.log about
> Operation not permitted - 
> /web/rails/cookbook/public/../config/../tmp/sessions//ruby_sess.2e1330f3de760fc2
> /usr/lib/ruby/1.8/cgi/session/pstore.rb:72:in `chmod'

As I already guessed, the problem was permission related. Rails tries to 
chmod the ruby.sess.... files in &lt;railsroot>/tmp/sessions/. I had the 
files with permissions 777 (everybody rwx on windows), but I didn't 
realize that in order to chmod a file, you have to be the actual owner 
of the file, not just a member of the owning group. So I changed the 
owner to the user under which apache is running and the problem was 
solved.

A tip to apache2 users though, use mod_fcgid to speed up rails. The 
alternative mod_fastcgi isn't really good. I read bad things about it on 
the internet, but most of all, I couldn't get rails to work with 
mod_fastcgi, but could with mod_fcgid. See Paul's journal on 
http://journal.paul.querna.org/articles/2006/01/01/using-mod_fcgid-for-ruby-on-rails-applic
ations

If you're using debian or any debian based system, skip steps 1-6. Just 
install libapache2-mod_fcgid and make sure there are symlinks in 
/etc/apache2/modules-available to the fcgid files in 
/etc/apache2/modules-enabled.

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Rails mailing list
Rails@...
http://lists.rubyonrails.org/mailman/listinfo/rails
&lt;/PRE></description>
</item>

<item>
<title>[Rails] best way to generate sums of groups</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-rails/3173795</link>
<description>&lt;PRE>I'm a rails newby, so I'm trying to wrap my
head around how to tackle 
this, since my first few attempts failed.

Let's say your database looks like this:

Users
id, name, created_at

Points
id, user_id, value, created_at

Users complete different tasks and are awarded varying levels of points, 
which are recorded in the Points table.  What if you wanted to display a 
"high score list", showing the users in order by who had the most 
points?  It might look like:

Username A  -  20 points
Username B  -  14 points
Username C  -  13 points
and so on...

You'd need to sum the values for each user_id, then display them in
order.	And, based on the user_ids, you'd need to pull in and display
the users' names from the Users table.

I've been attempting to do this using various incarnations of 
Point.sum(:values, :group => 'user_id'), but without luck.  Using that 
approach, I can display the point totals for each user_id, but the thing 
breaks down when I try to bring in the names from the Users table.

Any help would be hugely appreciated!

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Rails mailing list
Rails@...
http://lists.rubyonrails.org/mailman/listinfo/rails
&lt;/PRE></description>
</item>

<item>
<title>[Rails] Re: rendering partials in layouts?</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-rails/3173784</link>
<description>&lt;PRE>Jon Mr wrote:
> Hello all,
> 
> Forgive me if this is a really stupid question. How do you render 
> partials in a layout? It's probably way easier than i believe it to be. 
> thanks!

Hi Jon

Not sure if this is what you need, but you can use

&lt;%= render(:partial => "name_of_partial") %>
where the name_of_partial is a rhtml file started with '_' for example
_name_of_partial.rhtml

Hope this help :)

Victor

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Rails mailing list
Rails@...
http://lists.rubyonrails.org/mailman/listinfo/rails
&lt;/PRE></description>
</item>

<item>
<title>[Rails] error messaging for a form without ActiveRecord model</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-rails/3173783</link>
<description>&lt;PRE>I have a form that has no ActiveRecord model
behind it, it is just 
composed of random fields like "email_address", "email_body", etc. 
Even though there is no model, some of these fields are required, and I 
would like to use the built-in Rails methods for automatically showing 
errors in the form.   Unfortunataely, I can only see how to do this if 
the form is based on an object whose model extends ActiveRecord.   What 
is the best way to use all the error message functionaity?

thanks,
Jeff

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Rails mailing list
Rails@...
http://lists.rubyonrails.org/mailman/listinfo/rails
&lt;/PRE></description>
</item>

<item>
<title>[Rails] re: create pie chart</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-rails/3173782</link>
<description>&lt;PRE>It's not a rails plugin, but see the XML/SWF
Charts plugin from  
http://www.maani.us/xml_charts/index.php. This thing is pretty	
frickin' cool. It needs more configuration but not too tough, &amp; the  
images are worth it IMHO. It's cheap too, like $50 or something.

-Jason

> Message: 4
> Date: Thu, 22 Jun 2006 11:20:56 +0200
> From: ss &lt;mail@...
> Subject: [Rails] create pie chart
> To: rails@...
> Message-ID: &lt;a6368bbfffc2d7585effe6f69329a980@...
> Content-Type: text/plain; charset=utf-8
>
> Hi,
>
> I want to be able create a pie chart using rails, does anyone know of
> any plugin's taht could help me here?
>
> Scott
>
> -- 
> Posted via http://www.ruby-forum.com/.
>
_______________________________________________
Rails mailing list
Rails@...
http://lists.rubyonrails.org/mailman/listinfo/rails
&lt;/PRE></description>
</item>

<item>
<title>[Rails] rendering partials in layouts?</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-rails/3173781</link>
<description>&lt;PRE>Hello all,

Forgive me if this is a really stupid question. How do you render 
partials in a layout? It's probably way easier than i believe it to be. 
thanks!

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Rails mailing list
Rails@...
http://lists.rubyonrails.org/mailman/listinfo/rails
&lt;/PRE></description>
</item>

<item>
<title>[Rails] fade and appear effects</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-rails/3173764</link>
<description>&lt;PRE>i have a box of content on my site that i
would like to fade out, load 
new content and then fade back in with the new content. i tried 
something like this:

		&lt;%= link_to_remote(image_tag(url_for_file_column('project', 'image')),
				   :update => 'project-info',
				   :before => "new Effect.Fade('project-info')",
				   :success => "new Effect.Appear('project-info')",
				   :url => { :action => 'show_project', :id => 
@... }) %>

but it doesn't do what i want it to. it blinks several times and then 
just disappears altogether. is there a simple way to accomplish this 
type of effect?

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Rails mailing list
Rails@...
http://lists.rubyonrails.org/mailman/listinfo/rails
&lt;/PRE></description>
</item>

<item>
<title>Re: [Rails] invalidating a session on multiple login</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-rails/3173763</link>
<description>&lt;PRE>On 6/22/06, Francois Beausoleil
&lt;francois.beausoleil@... wrote:
> Hello Martin,
>
> 2006/6/22, Martin DeMello &lt;martindemello@...
> > I want to invalidate the session in the first tab and throw up a
>
> Create a new session by resetting the session prior to doing your
> authentication.  session.reset should do it.	If you had stored
> anything in the session, that will obviously be cleared.  Copy off
> anything you might want to keep.

Doh - don't know why I didn't think of that! Thanks :)

martin
_______________________________________________
Rails mailing list
Rails@...
http://lists.rubyonrails.org/mailman/listinfo/rails
&lt;/PRE></description>
</item>

<item>
<title>Re: [Rails] id column for join table... kosher?</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-rails/3173751</link>
<description>&lt;PRE>1.   migration
   create_table :bookmarks_tags, :id=>false do |t|
     t.column :bookmark_id. :integer
     t.column :tag_id, :integer
   end

2. No ids on join tables.  However, see has_many :through     That lets you
do a has_and_belongs_to_many using a model as the middle piece instead of a
join table. Then you *can* have an id on that table. However, I would advise
against this unless you have additional fields on the join

2.b  Looks like you're doing tagging. Have a look ath the acts_as_taggable
plugin.  http://wiki.rubyonrails.com/rails/pages/Acts+As+Taggable+Plugin(You
want the plugin, not the Gem!)

2 c.  I don't get your question about individual joins.  With a HABTM
relationship, you just do

    @... = Bookmark.find(1)
    @... = @...

    @... &lt;&lt; Tag.create :name => "ajax"

   ...
   etc

So what would you be doing with joins?

Hope some of that helps you.


On 6/22/06, Jason Frankovitz &lt;jason@... wrote:
>
> I've got two tables, bookmarks &amp; tags. Using a
> has_and_belongs_to_many association, I can do lookups using a join
> table called bookmarks_tags. Two questions:
>
> 1. Can I have a migration for my join tables? Rails seems to "know"
> about join tables implicitly from the associations, but if I do a
> rake migrate the join tables won't be built. I've been creating them
> using SQL/by hand.
>
> 2. Is there anything wrong with having an 'id' column on my join
> table? Rails expects:
> bookmark_id &amp; tag_id
>
> ...but what if I want to reference individual joins? Can I do:
> bookmark_id &amp; tag_id &amp; id
>
> Does this mess anything up? The Agile book says don't do it, articles
> on the web say it's OK. Who to believe?
>
> Thanks for any/all advice!
> -Jason
>
>
> _______________________________________________
> Rails mailing list
> Rails@...
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
&lt;/PRE></description>
</item>

</channel>
</rss>