[Rails] Re: Parameters passing of select_tag

2010-04-21 Thread Prashant
Thanks,
I had to place everything in form_tag and everything else worked fine.
Now I have all values in Parameters list

On Apr 22, 10:32 am, soldier <8863...@gmail.com> wrote:
> how about the rails api doc ?
>
> 2010/4/22 Prashant :
>
>
>
>
>
> > I wish to have an option in my application where user can select a
> > value from Combo Box shown in a page and on clicking of button this is
> > passed as parameters to another controller. There will be 4 combo
> > boxes on the selection page. I am using select_tag to populate data
> > from database
>
> > Something like
>
> > Town <%= select_tag(:town, "-Select a Town" +
> > options_from_collection_for_select(@towns, :NAME, :NAME)) %>
>
> > Can you please suggest what is the method to do it ?
> > I am not able to find some clear guidelines for the same, I am new to
> > web development so maybe I am searching at wrong place.
>
> > --
> > 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 rubyonrails-t...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > rubyonrails-talk+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: RAILS not SCALABLE?

2010-04-21 Thread Robert Walker
David Zhu wrote:
> Heyyy
> 
> First off, I love rails. Even thuogh I'm not as good as some of you
> guys here, but hey, I started couple months ago, and I am still on my
> way learning more.
> 
> 
> But I know there are downsides to Rails too. One of them is
> scalability. What on earth does that mean?

You don't have a scaling problem!

If you ever do have a scaling problem you won't have to ask what it 
means. Most of us here would love to have scaling problems, or rather 
the need to be concerned about it.

A scaling problem means that people are actually using your application. 
Unless you have a completely boneheaded business plan, then it also 
means you're making more than enough profit to acquire whatever you need 
to solve said scaling problem.

Although, some reasonable level of planning along way would be prudent.
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] ActionController::RoutingError after using scaffold

2010-04-21 Thread William Lang
Hey there,

I'm new to Ruby and was following a tutorial found here:

http://stackoverflow.com/questions/545951/ruby-on-rails-link-to-syntax

Anyway, I already had my own MySQL database from PHP development so I
decided to try to create a scaffold off of a table 'users'.

I get the following error:
ActionController::RoutingError in Users#index

Showing app/views/users/index.html.erb where line #9 raised:

user_url failed to generate from {:controller=>"users", :action=>"show",
:id=>#<...>}

The issue is coming from this line:
<%= link_to 'Show', user %>

I tried deleting that code and trying this instead:
<%= user["user_id"] %> -- where user_id is a field in the users table
and it printed the user_id

Is this a known scaffold bug in Ruby installs on Windows? How do I go
about fixing it?

Thanks,
Lang
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Parameters passing of select_tag

2010-04-21 Thread soldier
how about the rails api doc ?


2010/4/22 Prashant :
> I wish to have an option in my application where user can select a
> value from Combo Box shown in a page and on clicking of button this is
> passed as parameters to another controller. There will be 4 combo
> boxes on the selection page. I am using select_tag to populate data
> from database
>
> Something like
>
> Town <%= select_tag(:town, "-Select a Town" +
> options_from_collection_for_select(@towns, :NAME, :NAME)) %>
>
> Can you please suggest what is the method to do it ?
> I am not able to find some clear guidelines for the same, I am new to
> web development so maybe I am searching at wrong place.
>
> --
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> 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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Calling destroy on a model that has no id column

2010-04-21 Thread soldier
 # File rails-2.3.2/activerecord/lib/active_record/base.rb, line 2576
2576:   def destroy
2577: unless new_record?
2578:   connection.delete(
2579: "DELETE FROM #{self.class.quoted_table_name} " +
2580: "WHERE
#{connection.quote_column_name(self.class.primary_key)} =
#{quoted_id}",
2581: "#{self.class.name} Destroy"
2582:   )
2583: end
2584:
2585: freeze
2586:   end

i think  could help you about primary key and id.

otherwise:
you can use DBI.
ActiveRecord::Base.connection().execute( "delete from table_name where id = ?")



2010/4/22 Lee Smith :
> The finder works though.
>
> It looks like destroy relies specifically on the id column...maybe
> there's a way to tell it otherwise?
>
> --
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> 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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Database error

2010-04-21 Thread Anubhaw Prakash
Smit Shah wrote:
> Hi All,
> 
> I am trying to save my form data in to table. I am able to add the data
> successfully but it creates the 2 record for the single time of form
> submission.
> 
> Let me explain in detail. My flow is like following:
> 
> First the user fills the form. When it submits the form, create method
> will called and after completion of that it redirects to show page of
> created user.
> 
> In browser it works just like I said. But, in back-end(in log), it
> creates one record than redirects to the show page, than once again it
> hits the create def and insert the same data in to table and again
> redirects to show page.
> 
> I am using rails 2.3.5 and ruby 1.8.6
> 
> Any idea???

Your create method is getting called twice. A look at code would help in 
resolving the issue.

Anubhaw
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] HOW TO Track How Many Recipients Open Your Mail IN RAILS?

2010-04-21 Thread Tony Augustine
HOW  TO Track How Many Recipients Open Your Mail IN RAILS?

please help me PROVIDE  SOLUTIONS AND  STEPS  OR ELSE  ANY  PLUGIN
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Parameters passing of select_tag

2010-04-21 Thread Prashant
I wish to have an option in my application where user can select a
value from Combo Box shown in a page and on clicking of button this is
passed as parameters to another controller. There will be 4 combo
boxes on the selection page. I am using select_tag to populate data
from database

Something like

Town <%= select_tag(:town, "-Select a Town" +
options_from_collection_for_select(@towns, :NAME, :NAME)) %>

Can you please suggest what is the method to do it ?
I am not able to find some clear guidelines for the same, I am new to
web development so maybe I am searching at wrong place.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Database error

2010-04-21 Thread Smit Shah
Hi All,

I am trying to save my form data in to table. I am able to add the data
successfully but it creates the 2 record for the single time of form
submission.

Let me explain in detail. My flow is like following:

First the user fills the form. When it submits the form, create method
will called and after completion of that it redirects to show page of
created user.

In browser it works just like I said. But, in back-end(in log), it
creates one record than redirects to the show page, than once again it
hits the create def and insert the same data in to table and again
redirects to show page.

I am using rails 2.3.5 and ruby 1.8.6

Any idea???
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Calling destroy on a model that has no id column

2010-04-21 Thread Lee Smith
The finder works though.

It looks like destroy relies specifically on the id column...maybe
there's a way to tell it otherwise?

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: content displaying below posts in "[ ]"

2010-04-21 Thread Joe Smith


"Michael Michael"  wrote in 
message news:fce2a0ce9e610603f85b4cff455f6...@ruby-forum.com...

I think i found the problem I had

<%= @posts.each do |post| %>

instead of

<% @posts.each do |post| %>

I just realized that, because having <%= outputs right?


Yep, that sure sounds like that would be the problem. :D 



--
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Calling destroy on a model that has no id column

2010-04-21 Thread soldier
i think rails must be use table's id colunm.


2010/4/22 Lee Smith :
> params[:id] is the incoming article_idthe dynamic finder tells you
> that too.
>
> And again, the favorites table does not have an id column...the unique
> key is user-article.  That's why I didn't put an id column on the
> table.
>
> Maybe this is one of scenarios where you just don't fight
> conventions...
>
> --
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> 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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] How to create Voronoi diagrams

2010-04-21 Thread Jorge Sosa suazo
Anyone know how to generate Voronoi diagrams with rubyvor library? ..
It would be helpful ..
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: content displaying below posts in "[ ]"

2010-04-21 Thread Michael Michael
I think i found the problem I had

<%= @posts.each do |post| %>

instead of

<% @posts.each do |post| %>

I just realized that, because having <%= outputs right?

Thanks for responding, I appreciate it.

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: content displaying below posts in "[ ]"

2010-04-21 Thread Michael Michael
My Blog!
<%= @posts.each do |post| %>
<%= post.title %>

  <%= post.body %>
  

<% end %>
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: content displaying below posts in "[ ]"

2010-04-21 Thread Lee Smith
Post your view code.

On Apr 21, 10:20 pm, Michael Michael  wrote:
> I am running into this issue, I am a super newbie when it comes to ruby
> on rails, mysql. I am a front-end developer trying to get into more of a
> MVC type structured language, and ruby on rails seemed like the one.
>
> Here is the issue I am having.
>
> I have created a post through rails c
>
> i go back to browser localhost:3000/posts and it displays
>
> My Blog!  --this is the blog title
>
> Hello Blog! --this is the post title
>
> Hi guys! This is my first entry :) --this is the body content
>
> NOT SURE WHAT THIS IS BELOW AND HOW TO STOP IT FROM APPEARING. I was
> wondering if it was some kind of debugging system. I have no clue. Would
> love the help.
>
> [# entry :)", created_at: "2010-04-22 03:10:34", updated_at: "2010-04-22
> 03:10:34">]
>
> Thank you.
> --
> Posted viahttp://www.ruby-forum.com/.
>
> --
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Calling destroy on a model that has no id column

2010-04-21 Thread Lee Smith
params[:id] is the incoming article_idthe dynamic finder tells you
that too.

And again, the favorites table does not have an id column...the unique
key is user-article.  That's why I didn't put an id column on the
table.

Maybe this is one of scenarios where you just don't fight
conventions...

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] content displaying below posts in "[ ]"

2010-04-21 Thread Michael Michael
I am running into this issue, I am a super newbie when it comes to ruby
on rails, mysql. I am a front-end developer trying to get into more of a
MVC type structured language, and ruby on rails seemed like the one.

Here is the issue I am having.

I have created a post through rails c

i go back to browser localhost:3000/posts and it displays


My Blog!  --this is the blog title

Hello Blog! --this is the post title

Hi guys! This is my first entry :) --this is the body content


NOT SURE WHAT THIS IS BELOW AND HOW TO STOP IT FROM APPEARING. I was
wondering if it was some kind of debugging system. I have no clue. Would
love the help.

[#]

Thank you.
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Calling destroy on a model that has no id column

2010-04-21 Thread soldier
what's content of params[:id], why not use favorite_id;

2010/4/22 Lee Smith :
> I've got a model, Favorite, that I'm trying to remove from the
> database by calling the destroy method on it.  What's noteworthy about
> this model is that it doesn't have an id column.  The unique index on
> the Favorites table is a both the user_id and the article_id.  A
> favorite belongs to a user and an article.
>
> So in my destroy method of my Favorites Controller, I first retrieve
> the favorite to delete:
>
> favorite = Favorite.find_by_article_id_and_user_id(params[:id],
> @current_user.id)
>
> Then I call favorite.destroy and I notice this in the log:
>
> "DELETE FROM favorites where id = NULL"
>
> So the delete doesn't actually work.  What gives?  Do I HAVE to have
> an id column in the favorites table?  Thanks for any help.
>
> --
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> 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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Calling destroy on a model that has no id column

2010-04-21 Thread Lee Smith
I've got a model, Favorite, that I'm trying to remove from the
database by calling the destroy method on it.  What's noteworthy about
this model is that it doesn't have an id column.  The unique index on
the Favorites table is a both the user_id and the article_id.  A
favorite belongs to a user and an article.

So in my destroy method of my Favorites Controller, I first retrieve
the favorite to delete:

favorite = Favorite.find_by_article_id_and_user_id(params[:id],
@current_user.id)

Then I call favorite.destroy and I notice this in the log:

"DELETE FROM favorites where id = NULL"

So the delete doesn't actually work.  What gives?  Do I HAVE to have
an id column in the favorites table?  Thanks for any help.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: SMS service

2010-04-21 Thread Northband
Thanks so much - looks like I found what I was looking for.




On Apr 21, 7:09 pm, "Andrew C."  wrote:
> Doesn't get any easier than Twilio.
>
> On Apr 21, 9:21 am, Northband  wrote:
>
> > What's a good SMS service to use?   I want to start sending messages
> > from my apps via SMS.
>
> > Thanks!
>
> > --
> > 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 rubyonrails-t...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > rubyonrails-talk+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Rails 3 + Rspec 2 + Remarkable

2010-04-21 Thread Ho-Sheng Hsiao

Another quick poll

How many folks care about these features:

describe Post do
  subject_attributes { valid_attributes }
  def valid_attributes
{ :name => "my post" }
  end

  it "should give me a post with valid attributes" do
  # ...
  end

  describe :name => "blah" do
it "should give me a shorthand for :name => blah" do
# ...
   end
end

For some reason, describe is not being properly overridden. But more
importantly, the hash syntax conflicts with the built-in metadata
functionality in Rspec 2

I never knew this functionality existed in Remarkable 3.3, and
frankly, I don't really use it.

subject_attribute {} is neat but you can just as easily use subject
{ Post.new(:attributes ... ) }

If there are enough people that care about this, I may give it another
crack. At this point though, I'm culling it from the feature set and
push for a bundle-able-prerelease.

Ho-Sheng Hsiao
http://hosheng.blogspot.com

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Using AR.connection.execute(sql) -- messing with my string?

2010-04-21 Thread Fearless Fool
Frederick Cheung wrote:
> when connecting via activerecord you're using a different client so
> you get to skip the delimiter stuff.
> 
> Fred

Lovely. I commented out the DELIMITER calls, and sure enough, it works:

  ActiveRecord::Base.connection.execute('DROP FUNCTION IF EXISTS 
`coverage`;')
  # ActiveRecord::Base.connection.execute('DELIMITER $$')
  ActiveRecord::Base.connection.execute(sql_body)
  # ActiveRecord::Base.connection.execute('DELIMITER ;')

I look forward to the day when I know epsilon more than someone else on 
this list and can help them as much as you've helped me.

Best,

- ff
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Multiple associations with to_json

2010-04-21 Thread Aj Oneal
So you're telling me that the solution to the problem is this simple?

model_name.to_json(
:include => [
   {:arbitrary_name_1 => {:assoc_1 => params} },
   {:arbitrary_name_2 => {:assoc_2 => params} }
])

Ugh... why isn't that in the documentation!?

I'll have to give it a try sometime.
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Multiple associations with to_json

2010-04-21 Thread Ricardo El-darwish
Aj Oneal wrote:
> Multiple json inculded associations without parameters
> model_name.to_json(
>   :include => [
> :assoc_1,
> :assoc_2
>   ])
> 
> Works
> 
> 
> 
> Multiple json inculded associations with parameters
> model_name.to_json(
>   :include => [
> {:assoc_1 => params},
> {:assoc_2 => params}
>   ])
> 
> Fails
> 
> 
> 
> Multiple json inculded associations mixing parameters
> model_name.to_json(
>   :include => [
> assoc_1,
> {:assoc_2 => params}
>   ])
> 
> Fails
> 
> 
> 
> Any work around?

First time poster... Hope this helps! Sorry it's rather late...
I found that allocating the hashes to variables first did the trick to 
me.  So you had this:
> model_name.to_json(
>   :include => [
> {:assoc_1 => params},
> {:assoc_2 => params}
>   ])

That becomes this:
assoc_1 = {:assoc_1 => params}
assoc_2 = {:assoc_2 => params}
model_name.to_json(:include => {:assoc_1 => assoc_1, :assoc_2 => 
assoc_2})

Incidentally, you can also tack on your :only argument as well, works a 
charm.
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: RAILS not SCALABLE?

2010-04-21 Thread Frederick Cheung


On Apr 22, 12:24 am, David Zhu  wrote:
> > Not an awful lot to be quite honest. That's not to say that building
> > an extremely high volume website in rails wouldn't present
> > difficulties, but that's because it's a difficult task in general.
>
> Sorry, not an awful lot of what? Problems? Or scalablity?

"What on earth does that mean?" => not an awful lot.
Also, does X scale has been discussed to death for most values of X.

Fred
>
> --
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Using AR.connection.execute(sql) -- messing with my string?

2010-04-21 Thread Frederick Cheung

On Apr 22, 12:01 am, Fearless Fool  wrote:
> ActiveRecord::StatementInvalid: Mysql::Error: You have an error in your
> SQL syntax; check the manual that corresponds to your MySQL server
> version for the right syntax to use near 'DELIMITER $$' at line 1:
> DELIMITER $$
>
> I'm still not sure what's going on, since (as I mentioned) I can
> hand-type this into dbconsole without getting an error.
>

As far as i understand things delimiter is a command/setting that is
part of the mysql command line utility, not the dialect of sql spoken
by mysql (just like exit, help etc).

The doc you linked to says

>The first thing we do is to change the command-line client's command delimiter,
>to ensure that we can use semicolons inside the stored procedure without the 
>client regarding them as end-of-statement.
>If you're using another client, you should of course skip the delimiter 
>commands

when connecting via activerecord you're using a different client so
you get to skip the delimiter stuff.

Fred

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] [windows] AAF Ferret-server can't get runnin'

2010-04-21 Thread Petr Makarov
I'm trying to run AFF's Ferret-server @ windows environment.
I'd modified ferret_daemon.rb(*) so I can get DRb server starts and
listening to provided port. Than I'm trying to build index for any model
I'm getting that exception: NoMethodError: method reopen! not supported
by DRb server
from (druby://localhost:9015)
C:/projects/apintra/vendor/plugins/acts_as
_ferret/lib/ferret_server.rb:144:in `method_missing'
from
C:/projects/apintra/vendor/plugins/acts_as_ferret/lib/remote_index.rb:22:in
`send'
from
C:/projects/apintra/vendor/plugins/acts_as_ferret/lib/remote_index.rb:22:in
`method_missing'
from
C:/projects/apintra/vendor/plugins/acts_as_ferret/lib/remote_functions.rb:15:in
`handle_drb_error'
from
C:/projects/apintra/vendor/plugins/acts_as_ferret/lib/remote_index.rb:22:in
`method_missing'
from
C:/projects/apintra/vendor/plugins/acts_as_ferret/lib/class_methods.rb:28:in
`rebuild_index'
from
C:/projects/apintra/vendor/extensions/search/app/models/search_engine.rb:113:in
`rebuild_index'
from
C:/projects/apintra/vendor/extensions/search/app/models/search_engine.rb:111:in
`each'
from
C:/projects/apintra/vendor/extensions/search/app/models/search_engine.rb:111:in
`rebuild_index'
from (irb):3

(*) -
http://www.pluitsolutions.com/2007/07/30/acts-as-ferret-drbserver-win32-service/
See Mike Smith's comment, Sun, 26 Jul 09 02:57 am.

See attachment also.

Extremely need help!

Attachments:
http://www.ruby-forum.com/attachment/4674/ferret_daemon.rb

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: RAILS not SCALABLE?

2010-04-21 Thread David Zhu

> Not an awful lot to be quite honest. That's not to say that building
> an extremely high volume website in rails wouldn't present
> difficulties, but that's because it's a difficult task in general.

Sorry, not an awful lot of what? Problems? Or scalablity?

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Ubuntu Linux Editor / Prettiefier

2010-04-21 Thread David Zhu
kwang do ur html.erb files automatically turn into rails highlighting?
I tried so many things, but it never automatically changes, I always
have to do it manuelly.

On Apr 21, 5:52 pm, Kwang How Tan  wrote:
> I uses gedit with gmate , it works well form
> me. Gedit has a lot of plugins ,
>
> --
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: RAILS not SCALABLE?

2010-04-21 Thread Frederick Cheung


On Apr 21, 11:59 pm, David Zhu  wrote:
> Heyyy
>
> First off, I love rails. Even thuogh I'm not as good as some of you
> guys here, but hey, I started couple months ago, and I am still on my
> way learning more.
>
> But I know there are downsides to Rails too. One of them is
> scalability. What on earth does that mean?
>
Not an awful lot to be quite honest. That's not to say that building
an extremely high volume website in rails wouldn't present
difficulties, but that's because it's a difficult task in general.

Fred
> --
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: SMS service

2010-04-21 Thread Andrew C.
Doesn't get any easier than Twilio.

On Apr 21, 9:21 am, Northband  wrote:
> What's a good SMS service to use?   I want to start sending messages
> from my apps via SMS.
>
> Thanks!
>
> --
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Using AR.connection.execute(sql) -- messing with my string?

2010-04-21 Thread Fearless Fool
Feh.  I've split it into FOUR statements, summarized as:

  ActiveRecord::Base.connection.execute('DROP FUNCTION IF EXISTS 
`coverage`;')
  ActiveRecord::Base.connection.execute('DELIMITER $$')
  ActiveRecord::Base.connection.execute(sql_body)
  ActiveRecord::Base.connection.execute('DELIMITER ;')

... and it's still bombing out at the 'DELIMITER $$' statement:

ActiveRecord::StatementInvalid: Mysql::Error: You have an error in your 
SQL syntax; check the manual that corresponds to your MySQL server 
version for the right syntax to use near 'DELIMITER $$' at line 1: 
DELIMITER $$

I'm still not sure what's going on, since (as I mentioned) I can 
hand-type this into dbconsole without getting an error.

I appreciate Rob & Fred's help, but it's not a show-stopper since I've 
manually stored the function.  But I remain curious as to why something 
entered via execute() will fail when executing it by hand works.  But 
that's just curiosity, not a need.

Thanks.

- ff
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] RAILS not SCALABLE?

2010-04-21 Thread David Zhu
Heyyy

First off, I love rails. Even thuogh I'm not as good as some of you
guys here, but hey, I started couple months ago, and I am still on my
way learning more.


But I know there are downsides to Rails too. One of them is
scalability. What on earth does that mean?

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Using AR.connection.execute(sql) -- messing with my string?

2010-04-21 Thread Fearless Fool
P.S.: I should have mentioned: I get your point about multiple 
statements, and can certainly do the DROP FUNCTION and the CREATE 
FUNCTION as two separate execute() calls.  Whether or not the delimiters 
will mess it up is a discovery waiting to happen -- boundless joy.

- ff
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Using AR.connection.execute(sql) -- messing with my string?

2010-04-21 Thread Fearless Fool
Frederick Cheung wrote:
> That sort of state is done on a per connection basis.
> Secondly my understanding is that the point of changing the delimiter
> to $$ is because you don't want a ; in your function to be interpreted
> as the end of your create function statement. However if multiple
> statement handling isn't turned on, do you need to change the
> delimiter at all ?  (you would need to separate the drop and the
> create since those are two separate statements)
> 
> Fred

I'm way out of my league here, but I believe you need to set the 
delimiters when you store a function: SQL requires ';' termination at 
the end of individual statements within the function, but unless you 
modify the delimiters, the client will interpret ';' as the end of the 
CREATE FUNCTION ... call.

There's an explanation for the delimiter munging[*] on the mysql site:

http://dev.mysql.com/tech-resources/articles/mysql-storedproc.html

... but heck, I'm willing to try it w/o the delimiters.  Just not today 
-- client deadline.

- ff

[*] MUNG: (verb and acronym), recursively defined as "Mung Until No 
Good"
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Using AR.connection.execute(sql) -- messing with my string?

2010-04-21 Thread Rob Biedenharn

On Apr 21, 2010, at 5:19 PM, Fearless Fool wrote:


Rob Biedenharn wrote:


Can you do it in two steps?
...
You could also split your single sql on a '$$' boundary and iterate
over each fragment.

-Rob



Hi Rob: Sure - I could feed a line at a time for that matter.  But
consider me curious: what's the rationale behind splitting it?  (I  
admit
I'm a little nervous about a function that leaves the intermediate  
state
of the SQL interpreter with delimiters set to $$ -- I suspect  
everything

would stop working if that was interrupted before resetting the
delimiters...)

- ff



I'm not saying to change the delimiter at all!  You just need to pass  
one statement to the mysql adapter (note Fred's post) rather than  
expecting it to parse the multiple statements.  You're not feeding  
"lines", but "statements". The create part is certainly more than one  
line.


-Rob

Rob Biedenharn  http://agileconsultingllc.com
r...@agileconsultingllc.com



--
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Using AR.connection.execute(sql) -- messing with my string?

2010-04-21 Thread Frederick Cheung


On Apr 21, 10:19 pm, Fearless Fool  wrote:
> Rob Biedenharn wrote:
>
> > Can you do it in two steps?
> > ...
> > You could also split your single sql on a '$$' boundary and iterate
> > over each fragment.
>
> > -Rob
>
> Hi Rob: Sure - I could feed a line at a time for that matter.  But
> consider me curious: what's the rationale behind splitting it?  (I admit
> I'm a little nervous about a function that leaves the intermediate state
> of the SQL interpreter with delimiters set to $$ -- I suspect everything
> would stop working if that was interrupted before resetting the
> delimiters...)

That sort of state is done on a per connection basis.
Secondly my understanding is that the point of changing the delimiter
to $$ is because you don't want a ; in your function to be interpreted
as the end of your create function statement. However if multiple
statement handling isn't turned on, do you need to change the
delimiter at all ?  (you would need to separate the drop and the
create since those are two separate statements)

Fred
>
> - ff
> --
> Posted viahttp://www.ruby-forum.com/.
>
> --
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: .each do iteration question

2010-04-21 Thread Babos Catalin
Sijo k g wrote:
> Hi
>> I got a simple iteration going on
>> 
>> <% @user.sender.each do |sender| %>
>> ...
>> <% end %>
>> 
>> Can I fetch and display for example only 2 items from my database insted
>> of all 4 of them  ?
> 
>  in controller @sender = @user.sender.find(:all,:limit => 2)
> 
> in view
> <% @sender.each do |s| %>
> 
> 
> 
> Sijo

Thank you very much, that did the trick.
It was a selection issue and I think I will use a named scope later on.

Cata
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] can't seem to install bleak house

2010-04-21 Thread ct9a
hi, guys

 I looked at http://guides.rubyonrails.org/debugging_rails_applications.html
and figured I give bleak house a try.

I ran into a problem during installation of the gem.

Here's an extract:

- Extract start
---
Makefile:671: warning: overriding commands for target `dist'
Makefile:671: warning: ignoring old commands for target `dist'
gcc -O2 -g -Wall -Wno-parentheses-DRUBY_EXPORT -D_GNU_SOURCE=1   -
L. -L.  -rdynamic -Wl,-export-dynamic -rdynamic -Wl,-export-dynamic
main.o  -lruby-static -lrt -ldl -lcrypt -lm -lpthread -lrt -ldl -
lcrypt -lm   -o ruby
make[1]: Leaving directory `/tmp/bleak_house/ruby-1.8.7-p174'
-%{ BUILDING SNAPSHOT }%-
build_snapshot.rb:1: warning: already initialized constant
RUBY_VERSION
/usr/local/lib/ruby/1.9.1/x86_64-linux/rbconfig.rb:7: ruby lib version
(1.9.1) doesn't match executable version (1.9.1p376) (RuntimeError)
from /usr/local/lib/ruby/1.9.1/mkmf.rb:4:in `require'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:4
from build_snapshot.rb:2:in `require'
from build_snapshot.rb:2
-%{ BUILDING RUBY }%-
** Binary `ruby-bleak-house` is already available (patchlevel 905)
-%{ BUILDING SNAPSHOT }%-
build_snapshot.rb:1: warning: already initialized constant
RUBY_VERSION
/usr/local/lib/ruby/1.9.1/x86_64-linux/rbconfig.rb:7: ruby lib version
(1.9.1) doesn't match executable version (1.9.1p376) (RuntimeError)
from /usr/local/lib/ruby/1.9.1/mkmf.rb:4:in `require'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:4
from build_snapshot.rb:2:in `require'
from build_snapshot.rb:2
-%{ BUILDING RUBY }%-
** Binary `ruby-bleak-house` is already available (patchlevel 905)
-%{ BUILDING SNAPSHOT }%-
build_snapshot.rb:1: warning: already initialized constant
RUBY_VERSION
/usr/local/lib/ruby/1.9.1/x86_64-linux/rbconfig.rb:7: ruby lib version
(1.9.1) doesn't match executable version (1.9.1p376) (RuntimeError)
from /usr/local/lib/ruby/1.9.1/mkmf.rb:4:in `require'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:4
from build_snapshot.rb:2:in `require'
from build_snapshot.rb:2


Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/
bleak_house-7.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/bleak_house-7.2/
ext/gem_make.out


- Extract end
---


I tried googling around and even went to the project homepage,
http://github.com/fauna/bleak_house.
 I cannot find any solutions there.

Has anyone tried using bleak house and had luck?

Thanks :)


-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Ubuntu Linux Editor / Prettiefier

2010-04-21 Thread Kwang How Tan
I uses gedit with gmate , it works well form
me. Gedit has a lot of plugins ,

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Using AR.connection.execute(sql) -- messing with my string?

2010-04-21 Thread Frederick Cheung


On Apr 21, 7:35 pm, Fearless Fool  wrote:
> Does ActiveRecord.connection.execute(string) perform any modifications
> on the given string?  If so, what quoting do I need to add?
>
> Here's why: I'm trying to use execute(string) to load a stored
> procedure.  I can hand-load the procedure without error (i.e. via
> dbconsole), but when I call the function below, it throws the error:
> 
> ActiveRecord::StatementInvalid: Mysql::Error: You have an error in your
> SQL syntax; check the manual that corresponds to your MySQL server
> version for the right syntax to use near 'DELIMITER $$

Looks like the mysql adapter doesn't enable the multi statement
option.

Fred

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Using AR.connection.execute(sql) -- messing with my string?

2010-04-21 Thread Fearless Fool
Rob Biedenharn wrote:
> 
> Can you do it in two steps?
> ... 
> You could also split your single sql on a '$$' boundary and iterate
> over each fragment.
> 
> -Rob
> 

Hi Rob: Sure - I could feed a line at a time for that matter.  But 
consider me curious: what's the rationale behind splitting it?  (I admit 
I'm a little nervous about a function that leaves the intermediate state 
of the SQL interpreter with delimiters set to $$ -- I suspect everything 
would stop working if that was interrupted before resetting the 
delimiters...)

- ff
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Want to override ruby_site oci8 library

2010-04-21 Thread Don.Mc
Our network installation of ruby has an old oci8 library in it's
ruby_site directory. My rails program is finding this instead of my up
to date oci8 gem in my own gems library. How can I force the rails
program to
load my gem instead of the ruby_site version?

Thanks in advance,
Don

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Accessing the router from a helper

2010-04-21 Thread Thomas Allen
Ah, that makes sense now. For the sake of correctness, the final code
(with a yield and without the unused routes variable):

def menu_item text, url = {}
  unless url[:access] and active_user.cannot? url[:access]

unless url.is_a? String
  if url[:controller]
url = url_for url
  else
url = url_for :controller => text
  end
end

unless text.is_a? String
  text = t text
end

active = request.request_uri == url

content = link_to text, url
if block_given?
  content << yield
end

"#{content}"
  end
end

Thomas

On Apr 21, 5:07 pm, Michael Pavling  wrote:
> On 21 April 2010 22:00, Thomas Allen  wrote:
>
> > On Apr 21, 4:37 pm, Michael Pavling  wrote:
> >> On 21 April 2010 20:36, Thomas Allen  wrote:
>
> >> >    active = request.request_uri == url
>
> >> Would using url_for() not save you a lot of hassle generating that url?
>
> > But why do you think that would change the line you quoted?
>
> It wouldn't necessarily; I was just referring to its use of the "url" 
> variable.
>
> --
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Using AR.connection.execute(sql) -- messing with my string?

2010-04-21 Thread Rob Biedenharn

On Apr 21, 2010, at 2:35 PM, Fearless Fool wrote:


Does ActiveRecord.connection.execute(string) perform any modifications
on the given string?  If so, what quoting do I need to add?

Here's why: I'm trying to use execute(string) to load a stored
procedure.  I can hand-load the procedure without error (i.e. via
dbconsole), but when I call the function below, it throws the error:

ActiveRecord::StatementInvalid: Mysql::Error: You have an error in  
your

SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near 'DELIMITER $$

FWIW, I've pawed over the sources and see that mysql_adapter's  
execute()
calls @connection(query), but I lose the thread after that.  Here's  
the

function (some lines elided for brevity):



Can you do it in two steps?

# -- COVERAGE(astart, aend, bstart, bend)

  sql_drop = 

Re: [Rails] Re: Accessing the router from a helper

2010-04-21 Thread Michael Pavling
On 21 April 2010 22:00, Thomas Allen  wrote:
> On Apr 21, 4:37 pm, Michael Pavling  wrote:
>> On 21 April 2010 20:36, Thomas Allen  wrote:
>>
>> >    active = request.request_uri == url
>>
>> Would using url_for() not save you a lot of hassle generating that url?
>
> But why do you think that would change the line you quoted?

It wouldn't necessarily; I was just referring to its use of the "url" variable.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Accessing the router from a helper

2010-04-21 Thread Thomas Allen
On Apr 21, 4:37 pm, Michael Pavling  wrote:
> On 21 April 2010 20:36, Thomas Allen  wrote:
>
> >active = request.request_uri == url
>
> Would using url_for() not save you a lot of hassle generating that url?

Thanks Michael, url_for was what I was looking for in place of
manually grabbing the router. But why do you think that would change
the line you quoted?

Here is the updated method:

def menu_item text, url = {}
  unless url[:access] and active_user.cannot? url[:access]

routes = ActionController::Routing::Routes

unless url.is_a? String
  if url[:controller]
url = url_for url
  else
url = url_for :controller => text
  end
end

unless text.is_a? String
  text = t text
end

active = request.request_uri == url

"#{ link_to text, url }"
  end
end

Thomas

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Accessing the router from a helper

2010-04-21 Thread Michael Pavling
On 21 April 2010 20:36, Thomas Allen  wrote:
>    active = request.request_uri == url

Would using url_for() not save you a lot of hassle generating that url?

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: slow tests on large rails app

2010-04-21 Thread Nick Gauthier
Check out this (my) presentation:

http://bit.ly/grease-your-suite-html

arrow keys navigate.
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Accessing the router from a helper

2010-04-21 Thread Thomas Allen
I find manually accessing the router to be quite ugly below. Is there
a more direct way to access it?

module ApplicationHelper

  def menu_item text, url = nil
routes = ActionController::Routing::Routes

url = if url
if url.is_a? String
  url
else
  routes.generate url
end
  else
routes.generate :controller => text
  end

unless text.is_a? String
  text = t text
end

active = request.request_uri == url

"#{ link_to text, url }"
  end

end

Thomas

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] dynamic :conditions for has_many?

2010-04-21 Thread DJ Cole
In the setup of
class Group < ActiveRecord::Base
   has_many users :through =>user_groups
end

class User ..
...
end

for "admin" like behavior (i.e. we want to see any/all users associated
with this group), this is enough.
However, in other cases, I want something like


class Group < ActiveRecord::Base
   has_many users :through =>user_groups, :conditions =>
"user_groups.user_status_for_this_group = 'OK'"
end

what is the best way to do both simultaneously (without resorting to
something like:
user_groups.scoped_by_user_status_for_this_group('OK').collect { |ug|
ug.user} etc...

-Cole
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Autoloading not working when using rake task

2010-04-21 Thread Dmitry Polushkin
Hi,

I have a problem when I'm doing rake tasks. This behavior happens only
on one machine, on another three ones all works fine (three is on
ubuntu, problem one is under debian); totally identical environment (I
guess).

I'm using translator gem, loading through config.gem in environment.rb
file. Server and script/console - works fine, this happens only when
I'm doing rake tasks (in both: development and production). I've
researched that problem for a while (6 hours since I've started to get
this problem, and research how to fix it), and now I'm at 90% sure
that the problem is in the autoload method.

When I'm executing for example rake db:migrate I'm getting this
exception:

stacktrace:

rake aborted!
undefined method `translate' for class `ActionView::Base'
/opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/core_ext/module/aliasing.rb:33:in `alias_method'
/opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/core_ext/module/aliasing.rb:33:in `alias_method_chain'
/opt/ruby/lib/ruby/gems/1.8/gems/translator-1.0.0/lib/translator.rb:
288
/opt/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
/opt/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
/opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:156:in `require'
/opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:521:in `new_constants_in'
/opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:156:in `require'
/opt/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/
gem_dependency.rb:208:in `load'
/opt/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in
`load_gems'
/opt/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in
`each'
/opt/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in
`load_gems'
/opt/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:164:in
`process'
/opt/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in
`send'
/opt/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in
`run'
/home/deploy/somesite.com/releases/20100421143409/config/
environment.rb:5
/opt/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
/opt/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
/opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:156:in `require'
/opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:521:in `new_constants_in'
/opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:156:in `require'
/opt/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/tasks/misc.rake:4
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in
`execute'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in
`execute'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in
`invoke_with_call_chain'
/opt/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in
`invoke_with_call_chain'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in
`invoke_prerequisites'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in
`invoke_prerequisites'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in
`invoke_with_call_chain'
/opt/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in
`invoke_with_call_chain'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in
`invoke_prerequisites'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in
`invoke_prerequisites'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in
`invoke_with_call_chain'
/opt/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in
`invoke_with_call_chain'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in
`invoke'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in
`invoke_task'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in
`top_level'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in
`top_level'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in
`standard_exception_handling'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in
`top_level'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in
`standard_exception_handling'
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8

[Rails] Re: Ruby existing database

2010-04-21 Thread Will Raffaele
Yes, I have installed Rails, as well as oracle_enhanced adapter and oci8 
installed.

I found an interesting link about using legacy databases:

  http://www.slideshare.net/napcs/rails-and-legacy-databases-railsconf-2009

I did:  rails --database=oracle ora_t1

I took the advice of Craig White and set the primary key and sequence as 
suggested in ctkagency.rb

ruby script\generate scaffold CTK_AGENCY   AGENCY_SEQUENCE:number 
AGENCY_NAME:text

I got to the localhost/3000 page ok, showing:

About your application’s environment
  Ruby version 1.8.6 (i386-mswin32)
  RubyGems version 1.3.6
  Rack version 1.0
  Rails version 2.3.5
  Active Record version 2.3.5
  Active Resource version 2.3.5
  Action Mailer version 2.3.5
  Active Support version 2.3.5
  Application root C:/Ruby/rails_apps/ora_t1
  Environment development
  Database adapter oracle_enhanced
  Database schema version 0

The next page bombed.

I think it's because my table names have underscores, like "CTK_AGENCY".

Processing Rails::InfoController#properties (for 127.0.0.1 at 2010-04-21 
14:49:21) [GET]
   [4;36;1mSQL (328.0ms) [0m[0;1mselect 
decode(table_name,upper(table_name),lower(table_name),table_name) name 
from all_tables where owner = sys_context('userenv','session_user') [0m
Completed in 421ms (View: 0, DB: 328) | 200 OK 
[http://localhost/rails/info/properties]
/!\ FAILSAFE /!\  Wed Apr 21 14:49:33 -0400 2010
  Status: 500 Internal Server Error
  Expected C:/Ruby/rails_apps/ora_t1/app/helpers/ctkagen_cies_helper.rb 
to define CtkagenCiesHelper

C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:426:in
 
`load_missing_constant'

C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in
 
`const_missing'

C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in
 
`const_missing'

C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:361:in
 
`constantize'

C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:360:in
 
`each'

C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:360:in
 
`constantize'

C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/string/inflections.rb:162:in
 
`constantize'

C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/helpers.rb:137:in
 
`helper'

C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/helpers.rb:115:in
 
`each'

C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/helpers.rb:115:in
 
`helper'

C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/helpers.rb:120:in
 
`helper'

C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/helpers.rb:115:in
 
`each'

C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/helpers.rb:115:in
 
`helper'
C:/Ruby/rails_apps/ora_t1/app/controllers/application_controller.rb:5


-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: refactoring question

2010-04-21 Thread Ichiro Saga
Philip Hallstrom wrote:
> On Apr 21, 2010, at 10:56 AM, Philip Hallstrom wrote:
> 
>>>  :check_amount, :decimal, :precision=>6, :scale=>2, :default=>0
>>> end
>>
>> change_table :accounts do |t|
>>  [:check_amount, :cache_amount, :change_amount, ..., :total].each do  
>> |c|
>>t.change :c, :decimal, :precision => 6, :scale => 2, :default => 0
> 
> Oops... that should be:
> 
> t.change c, .
> 
> (no colon before the c)

Thank you for your help.  It's much cleaner now.
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Using AR.connection.execute(sql) -- messing with my string?

2010-04-21 Thread Fearless Fool
Does ActiveRecord.connection.execute(string) perform any modifications
on the given string?  If so, what quoting do I need to add?

Here's why: I'm trying to use execute(string) to load a stored
procedure.  I can hand-load the procedure without error (i.e. via
dbconsole), but when I call the function below, it throws the error:

ActiveRecord::StatementInvalid: Mysql::Error: You have an error in your
SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near 'DELIMITER $$

FWIW, I've pawed over the sources and see that mysql_adapter's execute()
calls @connection(query), but I lose the thread after that.  Here's the
function (some lines elided for brevity):

  sql = <
END;
$$
DELIMITER ;
SQL
  ActiveRecord::Base.establish_connection
  ActiveRecord::Base.connection.execute(sql)
end
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Flattening 1:1 models

2010-04-21 Thread Robert Walker
Thomas Allen wrote:
> Is there a simple way to flatten 1:1 models so that the methods in one
> are accessible from another? This attempt results in a stack depth
> exception for any call to one of the explicitly defined methods:

If you wanted all the attributes on one model, why the heck did you 
break them apart in the first place?

I suppose you could write accessors to access the Contact attributes 
through User's association, but the whole design seem completely silly 
to me. Just get rid of Contact and put it's attributes on User and be 
done with it. Or, just access Contact's attributes though the 
association, like the system is designed to do.
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] refactoring question

2010-04-21 Thread Philip Hallstrom


On Apr 21, 2010, at 10:56 AM, Philip Hallstrom wrote:



On Apr 21, 2010, at 10:32 AM, Ichiro Saga wrote:

Hi, guys.  I changed some columns types to decimal in database, but  
the

code is not DIY.  Any thoughts on refactoring the following code?

change_table :accounts do |t|
t 
.change 
 :check_amount, :decimal, :precision=>6, :scale=>2, :default=>0
t 
.change :cash_amount, :decimal, :precision=>6, :scale=>2, :default=>0
t 
.change 
 :change_amount, :decimal, :precision=>6, :scale=>2, :default=>0

.
.
.
.
t.change :total, :decimal, :precision=>6, :scale=>2, :default=>0
end


change_table :accounts do |t|
 [:check_amount, :cache_amount, :change_amount, ..., :total].each do  
|c|

   t.change :c, :decimal, :precision => 6, :scale => 2, :default => 0


Oops... that should be:

t.change c, .

(no colon before the c)


 end
end

--
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 rubyonrails- 
t...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com 
.
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] refactoring question

2010-04-21 Thread Philip Hallstrom


On Apr 21, 2010, at 10:32 AM, Ichiro Saga wrote:

Hi, guys.  I changed some columns types to decimal in database, but  
the

code is not DIY.  Any thoughts on refactoring the following code?

change_table :accounts do |t|
t 
.change :check_amount, :decimal, :precision=>6, :scale=>2, :default=>0

t.change :cash_amount, :decimal, :precision=>6, :scale=>2, :default=>0
t 
.change 
 :change_amount, :decimal, :precision=>6, :scale=>2, :default=>0

.
.
.
.
t.change :total, :decimal, :precision=>6, :scale=>2, :default=>0
end


change_table :accounts do |t|
  [:check_amount, :cache_amount, :change_amount, ..., :total].each do  
|c|

t.change :c, :decimal, :precision => 6, :scale => 2, :default => 0
  end
end

--
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Radio buttons and :onchange

2010-04-21 Thread Shandy Nantz
Colin Law wrote:
> On 21 April 2010 17:12, Shandy Nantz  wrote:
>>
>> 
>> previous div is show from the "unheard" click.
>>
>> Really I'm just wondering if anybody has encountered a similar problem
>> and how they fixed it if they have. I have been looking at mis-matched
>> tags with no luck. IE is giving me a JavaScript error at the bottom, but
>> I am a little suspicious of this just because all other browsers fail to
>> give a similar error and work as designed.
> 
> Have you checked the html syntax by copying the full html of the page
> (View, Page source or similar in browser) and pasting into the w3c
> html validator (google it if necessary).  Often differences between
> browsers are due to them interpreting invalid html differently.  Not
> necessarily in this case of course but worth checking.
> 
> Colin

I have not done that yet, but will give it a try. Thanks,

-S
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] refactoring question

2010-04-21 Thread Ichiro Saga
Hi, guys.  I changed some columns types to decimal in database, but the
code is not DIY.  Any thoughts on refactoring the following code?

change_table :accounts do |t|
t.change :check_amount, :decimal, :precision=>6, :scale=>2, :default=>0
t.change :cash_amount, :decimal, :precision=>6, :scale=>2, :default=>0
t.change :change_amount, :decimal, :precision=>6, :scale=>2, :default=>0
.
.
.
.
t.change :total, :decimal, :precision=>6, :scale=>2, :default=>0
end


Thanks in advance.
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: tips on how to write a controller test for models associ

2010-04-21 Thread Michal Burak
Kura Monni wrote:
> current_user is defined in the ApplicationController class and it's set 
> as a helper_method, but apparently it's still not visible in the Webrat 
> steps.

Check this out 
http://programmers-blog.com/2010/04/21/cucumber-vs-webrat-vs-current_user-from-authenticatedsystem

PS. Sorry for resurrecting the thread. I bounced with this stuff for 
like 2 hours and found nothing. Hope others find the solution useful.
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: problem with partial rendering for groups of objects

2010-04-21 Thread Ar Chron
Adler Santos wrote:
> Errata:
> 
> Replace <% form_remote_tag :url => {:action => "next", :remaining =>
> @everything} do %> with <% form_remote_tag :url => {:action =>
> "next", :remaining => @remaining} do %>.

Somewhere you need to keep track of which iteration of "Next" you are on 
in the view - perhaps a hidden field would suffice.

A processing heavy version would use in_groups_of in the controller to 
let you walk the groups and just return the one you want (along with the 
new current set so you know that on the next 'Next' iteration).


-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: .each do iteration question

2010-04-21 Thread Ar Chron
Babos Catalin wrote:
> I got a simple iteration going on
> 
> <% @user.sender.each do |sender| %>
> ...
> <% end %>
> 
> Can I fetch and display for example only 2 items from my database insted
> of all 4 of them  ?
> 
> Is there a better way to do this ?
> I could use will_paginate on the iteration (per_page => 2) but I don`t
> want the links to show up.
> 
> Cata

Which two are you interested in seeing?

The first two, or two with certain attributes. Is this a space issue or 
a selection issue?

You could create a named scope I think, then refer to

@user.special_senders.each do |sender|

where the special_senders scope limits the associated senders to only 
those you want.
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Anyone know of a Rails POS (point-of-sale) app?

2010-04-21 Thread Trausti Thor Johannsson
Potion Factory has a free web store made with rails, open source that
connects to Paypal.

http://www.potionfactory.com/free/


Trausti

On Wed, Apr 21, 2010 at 4:18 PM, agung sukariman putra
 wrote:
> its that true  brother ? amazing,.. i'll check soon..
>
> --
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> 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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Conditionally adding a link to a form -- how?

2010-04-21 Thread Colin Law
On 21 April 2010 17:17, Viorel  wrote:
>
>> Bob, I don't understand, a variable @show_new_expense_page set in the
>> controller will be available in the view.
>>
>> Colin
>
> Set where in the controller? In a :before_filter or in show?

It doesn't matter, either will do.  Assuming that 'show' is the action
being run.

Colin

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: .each do iteration question

2010-04-21 Thread Sijo k g
Hi
> I got a simple iteration going on
> 
> <% @user.sender.each do |sender| %>
> ...
> <% end %>
> 
> Can I fetch and display for example only 2 items from my database insted
> of all 4 of them  ?

 in controller @sender = @user.sender.find(:all,:limit => 2)

in view
<% @sender.each do |s| %>



Sijo
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Radio buttons and :onchange

2010-04-21 Thread Colin Law
On 21 April 2010 17:12, Shandy Nantz  wrote:
> Hi all,
>
> I have three radio buttons that when clicked are supposed to show a
> particular div and hide other divs, pretty straight forward. But what I
> have noticed is that while the code works perfectly in Chrome and
> Firefox it breaks down in IE 7 & 8. Here is the code:
>
> <%= radio_button_tag( :synch, :div_1, @account.div_1 == true ? true :
> false, :onchange => 'new Effect.Fade(\'div2_check\'); new
> Effect.Appear(\'div1_check\');' ) %>
>
> <%= radio_button_tag( :synch, :div_2, @account.div_2 == true ? true :
> false, :onchange => 'new Effect.Fade(\'div1_check\'); new
> Effect.Appear(\'div2_check\');' ) %>
>
> <%= radio_button_tag( :synch, :none, (@account.div_1 == false and
> @account.div_2 == false) ? true : false, :onchange => 'new
> Effect.Fade(\'div1_check\'); new Effect.Fade(\'div2_check\');' ) %>
>
> 
> 
> 
>
> 
> ...
> 
>
> When the page loads and I click on one of the radio buttons it's almost
> as if the first click isn't "heard", and when I click a different radio
> button a div is shown but not the div that I clicked, instead the
> previous div is show from the "unheard" click.
>
> Really I'm just wondering if anybody has encountered a similar problem
> and how they fixed it if they have. I have been looking at mis-matched
> tags with no luck. IE is giving me a JavaScript error at the bottom, but
> I am a little suspicious of this just because all other browsers fail to
> give a similar error and work as designed.

Have you checked the html syntax by copying the full html of the page
(View, Page source or similar in browser) and pasting into the w3c
html validator (google it if necessary).  Often differences between
browsers are due to them interpreting invalid html differently.  Not
necessarily in this case of course but worth checking.

Colin

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] SMS service

2010-04-21 Thread Northband
What's a good SMS service to use?   I want to start sending messages
from my apps via SMS.

Thanks!

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Conditionally adding a link to a form -- how?

2010-04-21 Thread Viorel

> Bob, I don't understand, a variable @show_new_expense_page set in the
> controller will be available in the view.
>
> Colin

Set where in the controller? In a :before_filter or in show?

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Radio buttons and :onchange

2010-04-21 Thread Shandy Nantz
Hi all,

I have three radio buttons that when clicked are supposed to show a
particular div and hide other divs, pretty straight forward. But what I
have noticed is that while the code works perfectly in Chrome and
Firefox it breaks down in IE 7 & 8. Here is the code:

<%= radio_button_tag( :synch, :div_1, @account.div_1 == true ? true :
false, :onchange => 'new Effect.Fade(\'div2_check\'); new
Effect.Appear(\'div1_check\');' ) %>

<%= radio_button_tag( :synch, :div_2, @account.div_2 == true ? true :
false, :onchange => 'new Effect.Fade(\'div1_check\'); new
Effect.Appear(\'div2_check\');' ) %>

<%= radio_button_tag( :synch, :none, (@account.div_1 == false and
@account.div_2 == false) ? true : false, :onchange => 'new
Effect.Fade(\'div1_check\'); new Effect.Fade(\'div2_check\');' ) %>






...


When the page loads and I click on one of the radio buttons it's almost
as if the first click isn't "heard", and when I click a different radio
button a div is shown but not the div that I clicked, instead the
previous div is show from the "unheard" click.

Really I'm just wondering if anybody has encountered a similar problem
and how they fixed it if they have. I have been looking at mis-matched
tags with no luck. IE is giving me a JavaScript error at the bottom, but
I am a little suspicious of this just because all other browsers fail to
give a similar error and work as designed.
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Caching of data on server?

2010-04-21 Thread Sijo k g
Hi Pieter

> Is it possible to create variables in the rails environment that persist 
> globally - not as sessions - that would be too much porting of 
> information forwards and back. 

   This is possible by global variables in ruby (variables starts with 
@@ )

>In any case the data needs to be visible 
> 'between' sessions as well.

   But this needs the data to be stored in D B it self. Is it?


Sijo
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Flattening 1:1 models

2010-04-21 Thread Thomas Allen
Is there a simple way to flatten 1:1 models so that the methods in one
are accessible from another? This attempt results in a stack depth
exception for any call to one of the explicitly defined methods:

class User < ActiveRecord::Base

  has_one :contact

  Contact.column_names.each do |col|
define_method col.to_sym do
  contact.send col.to_sym
end
  end

end

I tried doing this with method_missing and respond_to? as well, with
similarly poor results, so I was hoping that someone else has found  a
way to cleanly map attributes in this way.

Thomas

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Best practice around putting rails database info into git

2010-04-21 Thread Rob Biedenharn

On Apr 21, 2010, at 3:12 AM, Matt wrote:


On Apr 20, 9:25 am, Pito Salas  wrote:
This maybe too vague a question, but I wonder if there's some  
wisdom out

there for me to tap...

Sometimes when I get ready to commit, git says that db/schema.rb has
changed. This is weird, and I think it's because I did a rake
db:migrate.

So my question is, what's the best practice relating to putting  
bits of

the database (schema.rb and the databases themselves) into sourc
control. And what's the best practice relating to running a rake
db:migrate after a git checkout of a new branch?

Anyone?

- Pito


Pito,

I'm going to leave the entire db version control question for someone
else, but to answer your question about the schema.rb, if you run a
migration, it will change the structure of the database, which is what
schema.rb keeps track of. Rails will rewrite that file every for every
migration ran to reflect the current structure of the db ( structure
as in tables, column names, indexes, etc... Not data the records
stored in the db ). This file should be checked into git, and like any
file that changes under version control, git will let you know about
the changes and track them.

As your app grows, your migration files will be more prone to hving
problems and shouldn't be used to create / setup the database. The
schema file is much better at recreating the db structure when
starting fresh ( like if you have to scale up your app and create a
new db on another server ). There are rake tasks for this, such as
rake db:reset ( caution, that one will wipe out all data in db), so
read up on them and they can save you many headaches as you have to
move your databases around.

-Matt


Matt, Pito, Marnen, and anyone else,

1. The opinion on whether db/schema.rb goes into the source repository  
has changed over time.  It is an opinion. (I'll give you some of mine.)


2. When properly written, migration files are not "prone to having  
problems" and certainly do not have to get worse over time. The advise  
here is to define at least a minimal version of your AR model class  
nested within the migration class if you need to do *any* manipulation  
at the model level.


3. I think that db/schema.rb does *NOT* belong in the repository.   
This is particularly true in a multi-developer environment where  
migrations are being initially created on different branches. The  
database itself isn't going into the repository after all. If you need  
the file, run a rake db:schema:dump or just run migrations. If you  
think about why the migration numbering (file naming) was changed from  
sequence number to timestamp, you'll realize that the practice of such  
"interleaved" migrations was a much bigger pain-point than what to do  
about db/schema.rb.


4. Unless you're initializing (inserting) data via migration, running  
all the migrations is really not much different than doing a  
db:schema:load because all the migrations are operating on empty  
tables. (Besides, if you have to "scale up your app", you probably  
aren't adding a new empty database, but creating a master-slave or  
sharding for performance.)


-Rob

Rob Biedenharn  http://agileconsultingllc.com
r...@agileconsultingllc.com



--
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: This works, but it can't be best practice. Advice?

2010-04-21 Thread paron
Added this to Project model:
  def self.find_in_funding_sources(f_s)
project_ids = f_s.reduce([]){|items, funding|
items.push(funding.project_id)}
projects = Project.find(:all, :conditions=>["id IN (?)",
project_ids.uniq])
return projects
  end

now the controller looks better:
.
.
.
else
  @projects =
Project.find_in_funding_sources(@team.funding_sources)
end
.
.
.

I don't know why I thought associations would take care of this.
Anyway, if they will, let me know how, please.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: api.rubyonrails.org site is taken over by a domain squatter

2010-04-21 Thread Amala Singh
Good news. Thank you.

On 21 April 2010 16:05, Shiv Narayan Gautam  wrote:

> DHH just tweeted saying that the domain is back up. Waiting for all the DNS
> servers to cache it. And the domain is registered for 10 years.
> So there you go Amala. Happy now :)
>
>
> On Wed, Apr 21, 2010 at 8:31 PM, Moo  wrote:
>
>> > Pointless remark? Ha. Cant this be avoided for the second time if not
>> for
>> > the first time?
>> > I dont still believe this it could happen to ROR.
>>
>> it's not the freaking rails framework man. it's the domain name
>> registrar.
>>
>> On Apr 21, 7:39 am, Amala Singh  wrote:
>> > Pointless remark? Ha. Cant this be avoided for the second time if not
>> for
>> > the first time?
>> > I dont still believe this it could happen to ROR.
>> >
>> > On 21 April 2010 15:26, Peter De Berdt 
>> wrote:
>> >
>> >
>> >
>> >
>> >
>> > > On 21 Apr 2010, at 14:56, Amala Singh wrote:
>> >
>> > > This is a sign of ROR losing credibility. It is such a shame that it
>> has
>> > > happened to
>> > > a wonderful innovation. Why they are going for RoR3 and so on, if they
>> > > cannot
>> > > maintain the existing things better?
>> >
>> > > What a pointless remark. 37signals paid the renewal of the domain well
>> > > beforehand, their registrar screwed up again. That's hardly their
>> fault and
>> > > has nothing to do with 37signal's infrastructure. It's not the first
>> major
>> > > site to have this problem btw, can happen to everyone.
>> >
>> > > Best regards
>> >
>> > > Peter De Berdt
>> >
>> > >  --
>> > > 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
>> rubyonrails-t...@googlegroups.com.
>> > > To unsubscribe from this group, send email to
>> > > rubyonrails-talk+unsubscr...@googlegroups.com
>> 
>> >
>> > > .
>> > > For more options, visit this group at
>> > >http://groups.google.com/group/rubyonrails-talk?hl=en.
>> >
>> > --
>> > --
>> > Nandri(Thanks in Tamil),
>> > Amala Singh
>> >
>> > --
>> > 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 rubyonrails-t...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> rubyonrails-talk+unsubscr...@googlegroups.com
>> .
>> > For more options, visit this group athttp://
>> 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 rubyonrails-t...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> rubyonrails-talk+unsubscr...@googlegroups.com
>> .
>> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>



-- 
-- 
Nandri(Thanks in Tamil),
Amala Singh

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: A way to build

2010-04-21 Thread Thomas Allen
Thanks, that seems to be the right idea. Here's what I ultimately
settled on...the following results in "Home | Dashboard | PNC" for a
request to DashboardController#index.

class ApplicationController < ActionController::Base

  def self.title item
before_filter do |controller|
  controller.instance_eval do
title item
  end
end
  end

  title :pnc

  def initialize
@title_parts = []
super
  end

  protected

  def title item
@title_parts.insert 0, item
  end

end

module ApplicationHelper

  def title
@title_parts.map { |part|
  t part
}.join ' | '
  end

end

class DashboardController < ApplicationController

  title :dashboard

  def index
title :home
  end

end

<%= title %>

Thomas

On Apr 21, 3:38 am, Alexandre Friquet  wrote:
> Hi Thomas,
>
> > How might I clean this up? My ideal would be for each controller to be
> > able to call "title" setting its part of the title, and for individual
> > actions to manually prepend their title part:
>
> You may have a look to this screencast from Ryan Bates 
> :http://railscasts.com/episodes/30-pretty-page-title
>
> Pretty clean and efficient!
>
> Hope it helps ;)
>
> @lex
>
>  smime.p7s
> 2KViewDownload

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: api.rubyonrails.org site is taken over by a domain squatter

2010-04-21 Thread Shiv Narayan Gautam
DHH just tweeted saying that the domain is back up. Waiting for all the DNS
servers to cache it. And the domain is registered for 10 years.
So there you go Amala. Happy now :)

On Wed, Apr 21, 2010 at 8:31 PM, Moo  wrote:

> > Pointless remark? Ha. Cant this be avoided for the second time if not for
> > the first time?
> > I dont still believe this it could happen to ROR.
>
> it's not the freaking rails framework man. it's the domain name
> registrar.
>
> On Apr 21, 7:39 am, Amala Singh  wrote:
> > Pointless remark? Ha. Cant this be avoided for the second time if not for
> > the first time?
> > I dont still believe this it could happen to ROR.
> >
> > On 21 April 2010 15:26, Peter De Berdt 
> wrote:
> >
> >
> >
> >
> >
> > > On 21 Apr 2010, at 14:56, Amala Singh wrote:
> >
> > > This is a sign of ROR losing credibility. It is such a shame that it
> has
> > > happened to
> > > a wonderful innovation. Why they are going for RoR3 and so on, if they
> > > cannot
> > > maintain the existing things better?
> >
> > > What a pointless remark. 37signals paid the renewal of the domain well
> > > beforehand, their registrar screwed up again. That's hardly their fault
> and
> > > has nothing to do with 37signal's infrastructure. It's not the first
> major
> > > site to have this problem btw, can happen to everyone.
> >
> > > Best regards
> >
> > > Peter De Berdt
> >
> > >  --
> > > 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 rubyonrails-talk@googlegroups.com
> .
> > > To unsubscribe from this group, send email to
> > > rubyonrails-talk+unsubscr...@googlegroups.com
> 
> >
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/rubyonrails-talk?hl=en.
> >
> > --
> > --
> > Nandri(Thanks in Tamil),
> > Amala Singh
> >
> > --
> > 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 rubyonrails-t...@googlegroups.com.
> > To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> > For more options, visit this group athttp://
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> 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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: api.rubyonrails.org site is taken over by a domain squatter

2010-04-21 Thread Moo
> Pointless remark? Ha. Cant this be avoided for the second time if not for
> the first time?
> I dont still believe this it could happen to ROR.

it's not the freaking rails framework man. it's the domain name
registrar.

On Apr 21, 7:39 am, Amala Singh  wrote:
> Pointless remark? Ha. Cant this be avoided for the second time if not for
> the first time?
> I dont still believe this it could happen to ROR.
>
> On 21 April 2010 15:26, Peter De Berdt  wrote:
>
>
>
>
>
> > On 21 Apr 2010, at 14:56, Amala Singh wrote:
>
> > This is a sign of ROR losing credibility. It is such a shame that it has
> > happened to
> > a wonderful innovation. Why they are going for RoR3 and so on, if they
> > cannot
> > maintain the existing things better?
>
> > What a pointless remark. 37signals paid the renewal of the domain well
> > beforehand, their registrar screwed up again. That's hardly their fault and
> > has nothing to do with 37signal's infrastructure. It's not the first major
> > site to have this problem btw, can happen to everyone.
>
> > Best regards
>
> > Peter De Berdt
>
> >  --
> > 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 rubyonrails-t...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > rubyonrails-talk+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/rubyonrails-talk?hl=en.
>
> --
> --
> Nandri(Thanks in Tamil),
> Amala Singh
>
> --
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Continously running a script

2010-04-21 Thread Stephan Wehner


On Apr 21, 7:17 am, "tashfeen.ekram"  wrote:
> Actually, I am interested in the former. That is, scan table and once
> it is done start form the top again and scan again without any delay.

http://cr.yp.to/daemontools.html should help (on Unix).

Your Ruby script has an endless loop. daemontools comes in to start it
initially,  or if the script fails, or for you to start/stop .

Stephan

> Thanks for the resource.
>
> On Apr 21, 8:25 am, Peter Hickman 
> wrote:
>
>
>
> > By continuously do you mean 'scan table, scan table, scan table ...' or
> > 'scan table, wait for 10 minutes, repeat'
>
> > If it is the latter then you could simply set up a cron job to run every few
> > minutes.
>
> > Here's some details on how you might do it
>
> >http://peter-hickman.blogspot.com/2009/09/rake-task-to-install-crons
>
> >http://peter-hickman.blogspot.com/2009/11/crons-for-rails.html
>
> > This sort of thing occurs a few times in my blog.
>
> > Hope it might be of help.
>
> > Of course this assumes that you are running on *nix or OSX
>
> > --
> > 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 rubyonrails-t...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > rubyonrails-talk+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: .each do iteration question

2010-04-21 Thread Kleber Shimabuku
limiting the Find method in the controller.

eg:

@user = User.find(:all, :limit => 2)


Hope it helps!



On Apr 21, 11:27 pm, Babos Catalin  wrote:
> I got a simple iteration going on
>
> <% @user.sender.each do |sender| %>
> ...
> <% end %>
>
> Can I fetch and display for example only 2 items from my database insted
> of all 4 of them  ?
>
> Is there a better way to do this ?
> I could use will_paginate on the iteration (per_page => 2) but I don`t
> want the links to show up.
>
> Cata
> --
> Posted viahttp://www.ruby-forum.com/.
>
> --
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Almost not a technical question

2010-04-21 Thread Hassan Schroeder
On Wed, Apr 21, 2010 at 5:05 AM, Greg Ma  wrote:

> But when you pay you are charged only
> if the limit number of people has been reached.
> This means then save somehow your credit card number somewhere and
> charged you when the sell is done.
>
> My question is how, where do they do their paying thing?

I would imagine most if not all payment gateways (e.g. Authorize.net)
allow a "Authorization Only" submittal; the card is only actually charged
with a subsequent "Prior Authorization Capture" using a transaction id
or some other token, which means there's no need to retain the actual
card data on the site (a very good thing!).

HTH,
-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: api.rubyonrails.org site is taken over by a domain squatter

2010-04-21 Thread Amala Singh
Pointless remark? Ha. Cant this be avoided for the second time if not for
the first time?
I dont still believe this it could happen to ROR.

On 21 April 2010 15:26, Peter De Berdt  wrote:

>
> On 21 Apr 2010, at 14:56, Amala Singh wrote:
>
> This is a sign of ROR losing credibility. It is such a shame that it has
> happened to
> a wonderful innovation. Why they are going for RoR3 and so on, if they
> cannot
> maintain the existing things better?
>
>
> What a pointless remark. 37signals paid the renewal of the domain well
> beforehand, their registrar screwed up again. That's hardly their fault and
> has nothing to do with 37signal's infrastructure. It's not the first major
> site to have this problem btw, can happen to everyone.
>
>
> Best regards
>
>
> Peter De Berdt
>
>  --
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>



-- 
-- 
Nandri(Thanks in Tamil),
Amala Singh

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] [ANN] Red Dirt Registration Ending

2010-04-21 Thread JEG2
Rubyists:

Friday is the last day for normal registration to the Red Dirt
RubyConf.

We have everything locked-in and it's going to be an awesome event.
Here are just a handful of the planned highlights:

* Keynote speeches from Jim Weirich and Dave Thomas
* Our themed program including Rails 3, NoSQL, and more
* Panel discussions with all of the speakers
* Expert trainings for the same topics the following day
* Scaling presentations from Twitter and Google
* Live recordings of The Changelog and Ruby 5 podcasts
* A huge hackfest
* An awesome location in Oklahoma City's "Bricktown"
* Good food (Weird, right?)

As you can see, we have the perfect tech storm planned.  We're filling
up, but we've planned carefully to make the best possible use of space
and we can still squeeze some bodies in.  You could still be one of
those bodies:

http://reddirtrubyconf.com/register_to_attend

James Edward Gray II

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] .each do iteration question

2010-04-21 Thread Babos Catalin
I got a simple iteration going on

<% @user.sender.each do |sender| %>
...
<% end %>

Can I fetch and display for example only 2 items from my database insted
of all 4 of them  ?

Is there a better way to do this ?
I could use will_paginate on the iteration (per_page => 2) but I don`t
want the links to show up.

Cata
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: api.rubyonrails.org site is taken over by a domain squatter

2010-04-21 Thread Peter De Berdt


On 21 Apr 2010, at 14:56, Amala Singh wrote:

This is a sign of ROR losing credibility. It is such a shame that it  
has happened to
a wonderful innovation. Why they are going for RoR3 and so on, if  
they cannot

maintain the existing things better?


What a pointless remark. 37signals paid the renewal of the domain well  
beforehand, their registrar screwed up again. That's hardly their  
fault and has nothing to do with 37signal's infrastructure. It's not  
the first major site to have this problem btw, can happen to everyone.



Best regards

Peter De Berdt

--
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Anyone know of a Rails POS (point-of-sale) app?

2010-04-21 Thread agung sukariman putra
its that true  brother ? amazing,.. i'll check soon..

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Continously running a script

2010-04-21 Thread tashfeen.ekram
Actually, I am interested in the former. That is, scan table and once
it is done start form the top again and scan again without any delay.

Thanks for the resource.

On Apr 21, 8:25 am, Peter Hickman 
wrote:
> By continuously do you mean 'scan table, scan table, scan table ...' or
> 'scan table, wait for 10 minutes, repeat'
>
> If it is the latter then you could simply set up a cron job to run every few
> minutes.
>
> Here's some details on how you might do it
>
> http://peter-hickman.blogspot.com/2009/09/rake-task-to-install-crons
>
> http://peter-hickman.blogspot.com/2009/11/crons-for-rails.html
>
> This sort of thing occurs a few times in my blog.
>
> Hope it might be of help.
>
> Of course this assumes that you are running on *nix or OSX
>
> --
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Anyone know of a Rails POS (point-of-sale) app?

2010-04-21 Thread Jason Richelson
jko170 wrote:
> I might need to integrate one with my Rails app.


We have built a web pos system using Ruby called ShopKeep.com.  Rails is 
turning out to be very good framework for this project.  We will 
officially launch in May but we already have customers up and running 
using it.  Our API for the platform is not yet published but I would 
love to know what you needed to integrate with.  A shopping cart system 
is the first place we want to go with the API.


If you are interested in learning more we have lots of info at 
www.shopkeep.com or support.shopkeep.com.  Or please feel free to email 
me at jason at Shopkeep.com.
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: This works, but it can't be best practice. Advice?

2010-04-21 Thread paron
Well, this is a little better.
.
.
.
else
  fundin...@team.funding_sources
  project_ids = fundings.reduce([]){|items, funding|
items.push(funding.project_id)}
  @projects = Project.find(:all, :conditions=>["id IN (?)",
project_ids.uniq])
end
.
.
.
So, now the problem becomes: how do I get all the projects that belong
to a bunch of funding sources? I am just sure there's a syntax that I
missed in the Rails Associations tut. "fundings.projects" doesn't
work.

Ron

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] how to change photo size from 300k -> 100k?

2010-04-21 Thread Ivan Nastyukhin
imagemagic 
-quality 

On Apr 21, 2010, at 5:18 PM, Chandle WEi wrote:

> In ruby how to change photo size from 300k -> 100k? 
> have any methods?
> 
> 
> -- 
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> 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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] how to change photo size from 300k -> 100k?

2010-04-21 Thread Chandle WEi
In ruby how to change photo size from 300k -> 100k?
have any methods?

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: api.rubyonrails.org site is taken over by a domain squatter

2010-04-21 Thread Amala Singh
This is a sign of ROR losing credibility. It is such a shame that it has
happened to
a wonderful innovation. Why they are going for RoR3 and so on, if they
cannot
maintain the existing things better?

On 21 April 2010 13:18, Rick  wrote:

> Any idea on how long it takes to recover from this annual screw-up?
> Eyecandy and grublinks are no substitute for a productive community
> site.
>
> Rick
>
> On Apr 21, 2:13 am, Frederick Cheung 
> wrote:
> > On Apr 21, 12:28 am, Philip Hallstrom  wrote:
> >
> > > Go here and download whatever set of rdocs you need... then you don't
> > > have to worry about the official site anymore :)
> >
> > or generate the docs locally (rake doc:rails) like that you don't have
> > to worry about having an internet connection
> >
> >
> >
> > >http://railsapi.com/
> >
> > > On Apr 20, 2010, at 4:26 PM, Moo wrote:
> >
> > > > API doesn't work with .com
> >
> > > > On Apr 20, 3:12 pm, jhaagmans  wrote:
> > > >> You can userubyonrails.comnow.
> >
> > > >> On Apr 20, 10:11 pm, dan  wrote:
> >
> > > >>> is there a direct ip for ruby rails site?
> >
> > > >>> --
> > > >>> 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
> rubyonrails-talk@googlegroups.com
> > > >>> .
> > > >>> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> > > >>> .
> > > >>> For more options, visit this group athttp://
> 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
> rubyonrails-talk@googlegroups.com
> > > >> .
> > > >> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> > > >> .
> > > >> For more options, visit this group athttp://
> 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 rubyonrails-
> > > > t...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> > > > .
> > > > For more options, visit this group athttp://
> 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 rubyonrails-talk@googlegroups.com
> .
> > > To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> > > For more options, visit this group athttp://
> 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 rubyonrails-t...@googlegroups.com.
> > To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> > For more options, visit this group athttp://
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


-- 
-- 
Nandri(Thanks in Tamil),
Amala Singh

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] map a resource to another controller

2010-04-21 Thread rtacconi
Hi,

I have a Page controller. I use it as a tree structure to manage pages
in a CMS. Is it possible to map an address /pages/1 to another
controller, say /forum ?

I need it because not every page should be a CMS page but sometimes it
should display another module, a forum, a gallery... etc...

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] This works, but it can't be best practice. Advice?

2010-04-21 Thread paron
I want to display all the projects in which a given team has a
product. The following code works, but isn't there a better way?
Railsier? Better Practice?

#Models#

class Team < ActiveRecord::Base
  has_many :products
  has_many :funding_sources, :through=>:products
end

class Product < ActiveRecord::Base
  belongs_to :funding_source
  belongs_to :team
end

class FundingSource < ActiveRecord::Base
  belongs_to :project
  has_many :products
end

class Project < ActiveRecord::Base
  has_many :funding_sources
  has_many :products, :through=>:funding_sources
  has_many :teams, :through=>:products #Can I do this?
end


#projects_controller.rb#
# Goal: all the projects in which a team has a product.
# GET /projects/by_team/team_id
# GET /projects/by_team/team_id.xml/
def by_team
begin
@team = Team.find(params[:team_id])
rescue
@projects=Project.find(:all)
else
produc...@team.products
funding_ids = products.reduce([]){|items, product|
items.push(product.funding_source_id)}

fundings=FundingSource.find(:all, :select=>:project_id,:conditions=>["id
IN (?)", funding_ids.uniq])
project_ids = fundings.reduce([]){|items, funding|
items.push(funding.project_id)}
@projects = Project.find(:all, :conditions=>["id IN (?)",
project_ids.uniq])
end
respond_to do |format|
  format.html #by_team.html.erb
  format.xml  { render :xml => @projects }
end
end

I can add some of the

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Gem install/update errors

2010-04-21 Thread Stacy Vlasits
Thanks Wayne and Arnie,

That did it.

artixan wrote:
> Check your Gem sources with: `gem sources` and remove 
> http://gems.rubyonrails.org
> if it's listed.
> The main rubyonrails.org domain is down. ihth
> 
> --arnie riquelme

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Is it possible to generate a breadcrumb from Rails controller?

2010-04-21 Thread Joshua Partogi
Dear all,

Is it possible to generate a breadcrumb from Rails controller without
using any additional plugin? What methods should I look into to be
able to generate breadcrumb in Rails?

Thank you very much in advance for your assistance.

Kind regards,
Joshua

-- 
http://twitter.com/scrum8

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Continously running a script

2010-04-21 Thread Peter Hickman
By continuously do you mean 'scan table, scan table, scan table ...' or
'scan table, wait for 10 minutes, repeat'

If it is the latter then you could simply set up a cron job to run every few
minutes.

Here's some details on how you might do it

http://peter-hickman.blogspot.com/2009/09/rake-task-to-install-crons.html

http://peter-hickman.blogspot.com/2009/11/crons-for-rails.html

This sort of thing occurs a few times in my blog.

Hope it might be of help.

Of course this assumes that you are running on *nix or OSX

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: STI Design Questions

2010-04-21 Thread Sharagoz
The questions and alternatives are going to be stored in the database,
right?
So basically somebody like a teacher can create a quiz that has many
questions, which has many alternatives, and the students take a quiz
where he responds to questions by picking alternatives or writing an
essay.

What makes this complicated is that there are different types of
questions, (multiple choice, single choice, essay), which has
consequences for the alternatives and the answers. I think it makes
sense to use STI here so that there can be 3 sub-classes of question
for each type. Without STI you will need a large amount of if-tests
which makes messy code. STI wont make it hard to list questions and
answers.

I think the models need to be structured like this:

Quiz has many questions
Question has many alternatives

When a student is answering the quiz, he is taking a test.

Test belongs to student
Test belongs to quiz
Test has many answers
Answer belongs to question (one answer per question)
Answer has_many chosen_alternatives
Chosen_alterntaive belongs to alternative (you might think that
chosen_alternative is unnecessary, and that an answer can be hooked
directly to an alternative, but this is going to create some issues
for the multiple-choice questions).
It is always a good idea to keep class names as single words where
possible. Calling it "choice" instead of "chosen_alternative" may be
better.

Then 3 sub-classes of question: Single, Multiple, Essay. This allows
you to put logic in the subclasses and base behaviour on which type
the question is. Examples of this would be; when the question is of
type single, the student can only pick one alternative, when it is
multiple, he can pick many. For the essay version no alternatives are
created, hence no chosen_alternative will be created when the student
answers. I would store this answer in a text field directly on the
answer record. I also suspect that it would be a good idea to use STI
on the answers, as some behaviour here will depend on which type the
question is. Instead of having a bunch if-tests everywhere checking
which type the question is and act accordingly, you can have 3 answer
types in parallel with the 3 question types and split the logic that
way.

This response became a lot longer than I had planned. I hope some if
it is usefull to you.

On Apr 21, 4:46 am, DGerton  wrote:
> It's often hard to keep up with changes in RoR, especially when you're
> still learning. A lot information on the web is for older versions of
> RoR. So I want to make sure this design using single-table inheritance
> (STI) makes sense.
>
> My design need is identical to this: I have a Quiz class, a Quiz
> has_many Answers. Answers belong to a Student and a Question and
> Answers can be types such as TrueFalse (a bool), MultipleChoice (a
> string), Essay (a text), etc.
>
> I want to query all the Answers for a particular Student and Quiz. Is
> STI still the way to go for this? I am currently using Rails 2.3 but
> have budgeted about a month to upgrade after Rails 3.0 is released.
>
> TIA
>
> --
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: api.rubyonrails.org site is taken over by a domain squatter

2010-04-21 Thread Rick
Any idea on how long it takes to recover from this annual screw-up?
Eyecandy and grublinks are no substitute for a productive community
site.

Rick

On Apr 21, 2:13 am, Frederick Cheung 
wrote:
> On Apr 21, 12:28 am, Philip Hallstrom  wrote:
>
> > Go here and download whatever set of rdocs you need... then you don't  
> > have to worry about the official site anymore :)
>
> or generate the docs locally (rake doc:rails) like that you don't have
> to worry about having an internet connection
>
>
>
> >http://railsapi.com/
>
> > On Apr 20, 2010, at 4:26 PM, Moo wrote:
>
> > > API doesn't work with .com
>
> > > On Apr 20, 3:12 pm, jhaagmans  wrote:
> > >> You can userubyonrails.comnow.
>
> > >> On Apr 20, 10:11 pm, dan  wrote:
>
> > >>> is there a direct ip for ruby rails site?
>
> > >>> --
> > >>> 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 rubyonrails-talk@googlegroups.com
> > >>> .
> > >>> To unsubscribe from this group, send email to 
> > >>> rubyonrails-talk+unsubscr...@googlegroups.com
> > >>> .
> > >>> For more options, visit this group 
> > >>> athttp://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 rubyonrails-talk@googlegroups.com
> > >> .
> > >> To unsubscribe from this group, send email to 
> > >> rubyonrails-talk+unsubscr...@googlegroups.com
> > >> .
> > >> For more options, visit this group 
> > >> athttp://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 rubyonrails-
> > > t...@googlegroups.com.
> > > To unsubscribe from this group, send email to 
> > > rubyonrails-talk+unsubscr...@googlegroups.com
> > > .
> > > For more options, visit this group 
> > > athttp://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 rubyonrails-t...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > rubyonrails-talk+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



  1   2   >