[Rails] form_for with multiple objects, each with a preset attribute?

2009-05-13 Thread Jacob Patton

I'm using Rails to create a schedule of a shop's opening and closing
hours.  Simplified versions of the models I've set up is:

class Account  ActiveRecord::Base

  has_many :opening_hours, :dependent = :destroy

end

class OpeningHour  ActiveRecord::Base

  belongs_to:account

  # table schema
  # create_table opening_hours, :force = true do |t|
  #   t.integer account_id
  #   t.string  day_of_week
  #   t.string  begins
  #   t.string  ends
  # end

end

So an account might have one opening_hour for Monday (:day_of_week =
Monday, :opens =9am, :closes = 5pm), two for Tuesday
([:day_of_week = Tuesday, :opens = 9am, :closes = 12pm],
[:day_of_week = Tuesday, :opens = 1pm, :closes = 5pm]), etc.

As I begin work on the HTML form for this schedule, I realize I'm not
sure of the best way to allow the user to add multiple objects within
one form when each object already has an attribute defined (the
day_of_week attr).

The form I'm working on should look like this:

Monday Opening Hours

[begins text_input] - [ends text_input]

Tuesday Opening Hours

[begins text_input] - [ends text_input]

[begins text_input] - [ends text_input]
...

Does anyone know of a standard way to handle this sort of
requirement?  I'm familiar with this method[1] to add multiple child
objects in a single form, but in Ryan's example, the tasks lack any
pre-determined attribute values.

[1]: http://railscasts.com/episodes/73-complex-forms-part-1

Thanks very much for your help,

Jacob Patton


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Multilingual model content

2009-05-13 Thread Michael Rigart

Hi

I'm looking for some insight in a small problem I have. I allready
posted this in the Rails I18n forum, but didn't got any respond, so
maybe it was just the wrong forum.

I need multilingual input in my models. Lets say you have a Product
model. That product contains title, description and price. The price is
allways the same, but the title and description need to be inputted in
diffrent languages.

I have used the I18n framework build in Rails, so no external plugin and
I would like to keep it that way.

One idea I was playing with is the following model build:

Product
---
id
price

ProductI18n
---
id
product_id
language - I18n code like EN, BE, FR
title
description

But how do I link those 2 together, so that I can show the product
details in the current user language?

Is there a way to pass a variable trough the Product association like
this:

has_one :product_language, :class_name = :product_i18n, :conditions =
language = users_current_language_code

I know I'm on the good track, but I know I'm missing something.

thank you for the insight
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: Multilingual model content

2009-05-13 Thread Francesc Esplugas

On Wed, May 13, 2009 at 8:56 AM, Michael Rigart
rails-mailing-l...@andreas-s.net wrote:

 I need multilingual input in my models. Lets say you have a Product
 model. That product contains title, description and price. The price is
 allways the same, but the title and description need to be inputted in
 diffrent languages.

I wrote a plugin to solve the same problem you have.

   http://github.com/fesplugas/simplified_translation/tree/master

Hope that helps.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: Multilingual model content

2009-05-13 Thread Michael Rigart

Francesc Esplugas wrote:
 On Wed, May 13, 2009 at 8:56 AM, Michael Rigart
 rails-mailing-l...@andreas-s.net wrote:
 
 I need multilingual input in my models. Lets say you have a Product
 model. That product contains title, description and price. The price is
 allways the same, but the title and description need to be inputted in
 diffrent languages.
 
 I wrote a plugin to solve the same problem you have.
 
http://github.com/fesplugas/simplified_translation/tree/master
 
 Hope that helps.

Hi Francesc,

it looked good till I started reading further. I saw that you need to 
define every language that you want to support in your attributes. The 
thing I wanted to do is make sure that the list of supported languages 
is dynamic.

-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: Multilingual model content

2009-05-13 Thread Francesc Esplugas

On Wed, May 13, 2009 at 9:09 AM, Michael Rigart
rails-mailing-l...@andreas-s.net wrote:

 it looked good till I started reading further. I saw that you need to
 define every language that you want to support in your attributes. The
 thing I wanted to do is make sure that the list of supported languages
 is dynamic.

In that case maybe the translate_column plugin by Sam Lown may work for you.

http://www.samlown.com/en/page/RailsTranslateColumnsPluginReadme

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: Multilingual model content

2009-05-13 Thread Gianluca Tessarolo
Hi Michael,

if you want to have dynamic language support the best choice may be:

http://github.com/janne/model_translations/

or (better)

http://github.com/joshmh/globalize2/

and if you want the versions for your translations:

http://github.com/joshmh/globalize2_versioning/

The only problem with these plugins is that you can't have the control 
of the translation model (eg.: you cannot have an upload field on 
translations model, it is difficult to apply constraints on translations 
model, etc.), but if your goal is simply translating string fields these 
plugins are great !

 Francesc Esplugas wrote:
   
 On Wed, May 13, 2009 at 8:56 AM, Michael Rigart
 rails-mailing-l...@andreas-s.net wrote:

 
 I need multilingual input in my models. Lets say you have a Product
 model. That product contains title, description and price. The price is
 allways the same, but the title and description need to be inputted in
 diffrent languages.
   
 I wrote a plugin to solve the same problem you have.

http://github.com/fesplugas/simplified_translation/tree/master

 Hope that helps.
 

 Hi Francesc,

 it looked good till I started reading further. I saw that you need to 
 define every language that you want to support in your attributes. The 
 thing I wanted to do is make sure that the list of supported languages 
 is dynamic.

   


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: Integration testing edit actions (PUT method)

2009-05-13 Thread Jarl Friis

Starr Horne st...@chatspring.com writes:

 What does people do here? ignore the fact that the integration test
 generate HTTP request which differs from what a broswer will do, or do
 you use post (or post_via_redirect) and adding the _method parameter
 manually.

 I think you're just splitting hairs at that point. If the put request in your 
 integration test doesn't get routed to the correct action, the test will fail 
 anyway. 

Hi Starr.

Thanks for taking your time to answer my post.

I think you misunderstand. My put request in my integration test do
get routed to the correct action. My point is a standard browser will
not generate HTTP PUT request upon edits, so my integration test does
not reflect standard usage of my web-app.

rake routes show:
   edit_order GET/orders/:id/edit(.:format) {:controller=orders, 
:action=edit}
  PUT/orders/:id(.:format)  {:controller=orders, 
:action=update}

However the default (which I use) view (app/views/order/edit.html.erb
contains

% form_for(@order) do |f| %

And one should expect this to generate HTML that upon commit makes a
HTTP PUT request to the update action.

However the above form_for(@order) call generates the following HTML
form:

form action=/orders/785800374 class=edit_order id=edit_order_785800374 
method=postdiv style=margin:0;padding:0input name=_method 
type=hidden value=put //div

So even though I tell rails that I want the update action to use the
HTTP PUT request, the generated HTML in the edit.html.erb is form
generating a HTTP POST request with an additional hidden input named
_method with the value put

That means, that when people are using the app from a standard
browser the browser will send a HTTP POST request.

First of all I wonder why rails (the form_for method) does not
generate a form that will send a HTTP PUT request. I think (but this
is only a wild guess) this is because it is work-in-progress

Secondly, now the situation is like that, what does people do (in
their integration test) to accommodate for the situation.

Basically I don't have a problem with my application. I just see that
my integration tests does not generate the HTTP requests that a real
browser would have done.

Jarl


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: Multilingual model content

2009-05-13 Thread Francesc Esplugas

Taking a look at the code, maintenance and test coverage in my opinion
model_translations
it's a better solution than translate_columns.

 http://github.com/janne/model_translations/tree/master

On Wed, May 13, 2009 at 9:31 AM, Michael Rigart
rails-mailing-l...@andreas-s.net wrote:

 I'm going to take a look at the RailsTranslateColumnsPlugin. Maybe I can
 get some ideas from there.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: CMS and REST - best practices

2009-05-13 Thread John Small

wejrow...@gmail.com wrote:
 No, I want to build it myself.. I look at it though.
 
 So what is the best practice?
 
 Should I build a separate section with its own controllers to edit
 them? or make a separate private view within the component controller?

I started looking at Adva (see 
http://github.com/svenfuchs/adva_cms/tree/master) which has quite a lot 
of good stuff in it you can look at for your project. It separates out 
the admin side of things from the public view side of things and it 
isolates the packages into plugin engines leaving your own app directory 
free for putting what you want into it.

It's a nice idea and has some top coders working on it. Trouble is it 
has top coders working on it and they disdain documentation, so it's a 
bit hard for someone coming into it who hasn't followed the development. 
Clever coders often can't resist the temptation to re-code everything or 
re-write commonly used plugins, which is what they have done inside 
Adva. There're a lot of clever tricks, completely undocumented, so you 
really are on your own.

But on the other hand, once you've mastered some of the insider tricks, 
it's quite easy to add your own controllers, models, and views. I'm not 
an insider though and it's a moving target so I can't offer advice on 
how to integrate your own code into the latest version, I'm still trying 
to work it out.

The other thing I don't like about it is the assumption that a CMS is 
used solely for publishing articles. I guess if you spend your life 
blogging then that's a sensible assumption, but most websites aren't 
blogs or lists of articles. There doesn't seem to be a way to edit pages 
which are composed of many page sections each with unique/non-unique 
content. So if you wanted to have a standard page section that appeared 
on a restricted set of pages there's no way you could do it easily.

It's nice, it has potential, there's a lot of clever code in it, but 
it's a very very long way to go before it's as easy to use as Wordpress.

John Small

-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: Multilingual model content

2009-05-13 Thread Michael Rigart

Francesc Esplugas wrote:
 Taking a look at the code, maintenance and test coverage in my opinion
 model_translations
 it's a better solution than translate_columns.
 
  http://github.com/janne/model_translations/tree/master
 
 On Wed, May 13, 2009 at 9:31 AM, Michael Rigart

Hmm,

indeed, its looks tidy and support rails i18n. Thank for the input! :)
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: Multilingual model content

2009-05-13 Thread Michael Rigart

Hi,

I'm going to take a look at the RailsTranslateColumnsPlugin. Maybe I can 
get some ideas from there.

-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: CMS and REST - best practices

2009-05-13 Thread Francesc Esplugas

On Wed, May 13, 2009 at 9:39 AM, John Small
rails-mailing-l...@andreas-s.net wrote:

 The other thing I don't like about it is the assumption that a CMS is
 used solely for publishing articles. I guess if you spend your life
 blogging then that's a sensible assumption, but most websites aren't
 blogs or lists of articles. There doesn't seem to be a way to edit pages
 which are composed of many page sections each with unique/non-unique
 content. So if you wanted to have a standard page section that appeared
 on a restricted set of pages there's no way you could do it easily.

Anyone has it's own idea of CMS or backend for an application. People from
Django have their django-admin and they're happy with it, so I wrote
something
similar for Rails which I'm using on my projects, and I know lots of
people using it
on their projects. The project is called Typus.

http://github.com/fesplugas/typus

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: Upload file with url parameter

2009-05-13 Thread Peter Vandenberk
Hi Bennet,

On 12 May 2009, at 13:07, PyroHiroshi wrote:
 On May 11, 12:39 pm, Frederick Cheung frederick.che...@gmail.com  
 wrote:
 On May 11, 11:11 am, hongseok.com hongseok.y...@gmail.com wrote:
 I just want the client(kind a application running automatically)  
 to

 uploadfileto the web server as it wants. How do I do this?
 you'll need to construct an appropriate post request (read up on
 multipart post requests) containing the file

 This is exactly what I've been trying to do all day. Not as easy as
 you'd think. There are absolutely no examples of this available
 anywhere.

The mechanize gem makes file uploads a no-brainer...

Check out their example script which automates file uploads to Flickr  
in 10 or so lines of Ruby code:

 
http://github.com/tenderlove/mechanize/blob/a5d73af1f7f4f8d6889b6da68899b9357a63b847/examples/flickr_upload.rb

Also check out the mechanize homepage for more examples and API  
documentation:

 http://mechanize.rubyforge.org/mechanize/

Mechanize FTW!  ;-)

Peter


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] contact us form (n00b)

2009-05-13 Thread bhan...@hcinsight.com

Im at a loss..and its something with my routes..

i have an index.html.erb that generates a partial

% page_title(Contact Us) %

% content_for :banner do %
  %= render :partial = 'contacts/banner' %
% end %

%= render :partial = 'contacts/form' %

The partial in the contacts directory _form.html.erb

% form_tag :action = contacts_mailer do %
  div
%= label :contact, :first_name, First Name %br /
%= text_field :contact, :first_name %
  /div
  div
%= label :contact, :last_name, Last Name %br /
%= text_field :contact, :last_name %
  /div

  div
%= label :contact, :subject, Subject %br /
%= text_field :contact, :subject %
  /div

div
%= label :contact, :body, Message %br /
%= text_area :contact, :body, :rows = 10 %
  /div

  div
%= label :contact, :email, Email Address %br /
%= text_field :contact, :email %
  /div

div
%= submit_tag 'Send Request', :class = btn %
%= submit_tag 'Clear Form', :class = 'btn', :type = 'reset' %
/div
% end %


and i have a contacts_controller with the following

class ContactsController  ApplicationController

  def index

  end

  def contacts_mailer
  ApplicationMailer.deliver_contact_mailer(params[:contact])
  flash[:notice] = Your Message has been sent.
  redirect_to home_path
  end

end

And i have the ApplicationMailer setup according to a dozen tutorials.

the problem comes with the form action.
i have called
% form_tag :action = contacts_mailer do %
% form_tag :controller = contacts, :action = contacts_mailer do
%

and in the source it shows form method=post action=/contact-us

and i do have these in the routes

  map.contact_mailer 'contact-us', :controller = contacts, :action
= contact_mailer
  map.contact 'contact-us', :controller = contacts, :action =
index

I im getting this error

Showing app/views/contacts/_whistle.html.erb where line #1 raised:

No route matches {:action=contacts_mailer}

ive even created a contacts_mailer.html.erb but no dice.

any help would be awesome

thanks

Bob

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] ActionController::RoutingError - Functional Tests and :path_prefix in routes.rb

2009-05-13 Thread Pablo Alonso García

Hi,

I'm trying to write a test for my ProfilesController, which I mapped
in my routes.rb, using:

map.resource :profile, :path_prefix = ':account'

This way, I have routes like:

   profile POST   /:account/profile
{:controller=profiles, :action=create}
 formatted_profile POST   /:account/profile.:format
{:controller=profiles, :action=create}
   new_profile GET/:account/profile/new
{:controller=profiles, :action=new}
 formatted_new_profile GET/:account/profile/new.:format
{:controller=profiles, :action=new}
  edit_profile GET/:account/profile/edit
{:controller=profiles, :action=edit}
formatted_edit_profile GET/:account/profile/edit.:format
{:controller=profiles, :action=edit}
   GET/:account/profile
{:controller=profiles, :action=show}
   GET/:account/profile.:format
{:controller=profiles, :action=show}
   PUT/:account/profile
{:controller=profiles, :action=update}
   PUT/:account/profile.:format
{:controller=profiles, :action=update}
   DELETE /:account/profile
{:controller=profiles, :action=destroy}
   DELETE /:account/profile.:format
{:controller=profiles, :action=destroy}

My problem is that, when running the following test:

  def test_new
get :new
assert_redirected_to new_session_path
  end

I get the error:

test_new(ProfilesControllerTest):
ActionController::RoutingError: No route matches
{:controller=profiles, :action=new}
...

I can't understand why 'get :new' can't find that route and, on the
other hand, 'rake routes' does recognize it.

This part of my application works fine (including :url = {:controller
= 'profiles', :action = 'create'} in the form_for tags). Though, I
don't know how to write the proper tests. Do I have to pass any extra
parameter to 'get'? Do you think is it a bit silly to use this
mapping?

Thanks in advance,

Pablo.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: forms link css classes - not working

2009-05-13 Thread Jim

It's not supposed to be 'style', it's 'class'.

a href=/galleries/1 class=urgentDestroy/a
and input class=m_title id=gallery_name name=gallery[name]
size=80 type=text value=Camp 09 /


On May 12, 7:16 pm, wejrow...@gmail.com wejrow...@gmail.com wrote:
 I used a scaffold to create an interface. I'm trying to style it and
 I'm having trouble. In my css I have:

 #content a, a:link, a:visited{
         color: #ff8400;}

 #content a:hover{
         background: #ff8400;
         color: #FF;

 }

 #content a.urgent, a.urgent:link, a.urgent:visited {
         color: #FF;}

 #content a.urgent:hover {
         color: #FF;
         background: #FF;

 }

 #content input.m_title{
   font-weight: bold;
   font-size: 28px;
   padding: 3px;

 }

 The style for the links works, but not for the .urgent class. Also the
 style for the input.m_title will not work. When I view the source the
 class is written right too:
 a href=/galleries/1 style=urgentDestroy/a
 and input style=m_title id=gallery_name name=gallery[name]
 size=80 type=text value=Camp 09 /

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: Invalid authenticity token only in IE6

2009-05-13 Thread ianneub

We are seeing the same issue, but we're not using the restful-
authentication plugin. Are you using jQuery or Prototype at all?

On May 3, 8:26 pm, Andrew luckyd...@gmail.com wrote:
 Hi guys, I just discovered that both logging in and signing up does
 not work in IE6 due to anInvalidAuthenticityTokenerror. I'm using
 the latest restful-authetntication plugin. What's weird though, is
 that I viewed the source before submitting and took note of the token.
 After submission, on the error page (in the parameters section) the
 token is the exact same. The forms work in every other browser. What
 the heck?

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: Installing Warehouse- undefined symbol: apr_dbm_type_db

2009-05-13 Thread Diona

I just ran into this issue. Upon running the command
RAILS_ENV=production rake db:schema:load  a second time, I received no
error.

dionak

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] ruby script outside of rails app

2009-05-13 Thread phillee

Hello:

I would like to write a ruby script that runs on its own, but still
take advantage of the ActiveRecord configured by the web app. Is there
an easy way to do this?

Thanks in advance!

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: a problem http POST params

2009-05-13 Thread Matthew MacLeod

On May 13, 6:12 am, Yongning Liang liangyongn...@gmail.com wrote:
 Does RoR has an easy way to tell different about GET and POST params just
 like $_GET and $_POST in PHP?

You can use the request object:

case request.method
when :get
  #Do stuff for GET method
  return
when :post
  #Do stuff for POST method
  return
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-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
-~--~~~~--~~--~--~---



[Rails] Re: Deleting Sessions with no logout

2009-05-13 Thread Colin Law
2009/5/12 Shandy Nantz rails-mailing-l...@andreas-s.net


 Colin Law wrote:
  I think you may find there is no reliable way of achieving this, there
  was a
  significant thread on this issue a little while ago.
  What is the unwanted behaviour that you are seeing? Perhaps there is a
  better solution.
  Colin
 
  2009/5/11 Shandy Nantz rails-mailing-l...@andreas-s.net

 It has to do with the sessions which are holding id for the current
 users logged in. At most, there may be three session variables set - the
 two above and another called session[:admin]. An admin can move from
 profile to profile making modifications, but what I think is happening
 is that the admin are not logging like they should and are instead
 simply Xing out. This means that those sessions may be used to set up
 unwanted objects and show links, and other varous forms of undesired
 information.


Do you mean another user is coming along to the pc that had the admin user
logged in and using it as admin? Or that someone is picking up the admin
role on another PC when they should not? Or something else?



 --
 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-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
-~--~~~~--~~--~--~---



[Rails] Re: Apache / mod_rails config

2009-05-13 Thread Jeremy Olliver

Hi George,

This is a bit outside the scope of this group, but how you set that up
doesn't really have anything to do with the mod_rails install. From
what I know, you should just be able to create a new virtual host and
point it to the folder of files you want to serve. Mod rewrite would
only be needed if you want to change the url's from the file/folder
names to something else.

Cheers,
Jeremy

On May 13, 10:53 am, giorgio george.pever...@gmail.com wrote:
 Hi,

 I have mod_rails on Apache serving a rails app just fine.

 What I want to do is have another folder served by apache as a
 downloadable list of files.

 Do I need to do mod_rewrite stuff and mess around with htaccess?

 If so has anybody got a recipe?

 Cheers
 George
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: ruby script outside of rails app

2009-05-13 Thread Jeremy Olliver

Hi Phil,

you sure can. For offline tasks, I usually go with a rake task (http://
railscasts.com/episodes/127-rake-in-background) or writing a ruby
script which is executed with ruby script/runner (this makes it
similar to running script/console and typing the code yourself).

However if all you want is ActiveRecord and your db config you can do
this:

require 'rubygems'
require 'activerecord'

RAILS_ENV = (ENV[RAILS_ENV] || development)
RAILS_ROOT = /location/to/my/rails_app

# If we don't have a db connection, then parse the yml file, and
extract the db config for the relevant rails_env
unless ActiveRecord::Base.connected?
  db_options = YAML::load(File.read(File.join(RAILS_ROOT, config,
database.yml)))
  ActiveRecord::Base.establish_connection(db_options[RAILS_ENV])
end

You will also need to require any models you want explicitly too, if
you go this route.

Cheers,
Jeremy

On May 13, 1:49 pm, phillee philip.a@gmail.com wrote:
 Hello:

 I would like to write a ruby script that runs on its own, but still
 take advantage of the ActiveRecord configured by the web app. Is there
 an easy way to do this?

 Thanks in advance!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Recaptcha plugin problem

2009-05-13 Thread eng. Ilian Iliev

Hi all,

I am using radiant CMS and I am trying to create custom extension and
add recaptcha validation to it
but when I call
   if not verify_recaptcha(:private_key = 'aaa')
 #add error
   end
I get: undefined method `verify_recaptcha' for #Comment:0x4f4c460

Bellow is the full code for my model class

class Comment  ActiveRecord::Base

validates_presence_of :title, :author, :comment, :message =
'required'

validate :check_captcha

def check_captcha
if not verify_recaptcha(:private_key = 'aaa')
errors.add(:title, 'def error');
end
end


end

Please someone help

10x in adance,
Ilian Iliev
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] compare this sql query and corresponding ruby code

2009-05-13 Thread Sijo Kg

Hi
   Suppose I have a two models Ticket and Activity

Ticket has_many activities
Activity belongs_to Ticket

Now suppose if the Activity has field name Now for a Ticket with
id=1 say there are 10 activities So to update name of all activities  I
can directly wite the sql statement

update activities set name='somename' where ticket_id=1

So I am writing this like

ticket = Ticket.find(1)
ticket.activities.each do |a|
  a.update_attribute(:name = 'somename')
end
 But what about the performance Is both the above query and the ruby
code has same performance What is actually the generated sql for the
ruby code
Or Am I wrong? Is there any other way of doing this same like sql
above?

Thanks in advance
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-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
-~--~~~~--~~--~--~---



[Rails] Updtade 2.2.2 to 2.3.2

2009-05-13 Thread Fresh Mix

How can I updated my rails 2.2.2 project to 2.3.2?

Chane RAILS_GEM_VERSION = '2.3.2' and ???
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] What’s faster for getting Mails into Rails: Pop vs. MySQL

2009-05-13 Thread Olaf S.

Hi,

Suppose I wanted to get mails from my mailserver (different machine)
into my Rails App to process it there, what is faster:

* Connecting via net/Pop or net/imap to download the mails
* Storing the Mails on the Mailserver in a MySQL Database (using
something like DBMail) and then connecting directly to the MySQL
Database
* Or is there a third option I'm not seeing yet? Maybe letting the
mailserver itself post the Mail to the Rails App?

Thanks for your advice!
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: compare this sql query and corresponding ruby code

2009-05-13 Thread Sijo Kg

Hi
  I tried like
Activity.update_all(name='hi', :conditions = [ticket_id =?,1])

  But getting error
ActiveRecord::StatementInvalid: RuntimeError: ERROR C42703  Mcolumn 
activities.conditions does not existP42 Fparse_func.c 
L1104   Runknown_attribute: UPDATE activities SET name='hi' WHERE 
(activities.conditions IN (E'ticket_id =?',1))
  Could you please correct the syntax
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-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
-~--~~~~--~~--~--~---



[Rails] Re: compare this sql query and corresponding ruby code

2009-05-13 Thread Maurício Linhares

Here's the correct sintax:

Activity.update_all( [ 'name = ?', 'hi' ] , [ticket_id =?,1])


-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)



On Wed, May 13, 2009 at 8:24 AM, Sijo Kg
rails-mailing-l...@andreas-s.net wrote:

 Hi
  I tried like
 Activity.update_all(name='hi', :conditions = [ticket_id =?,1])

  But getting error
 ActiveRecord::StatementInvalid: RuntimeError: ERROR     C42703  Mcolumn
 activities.conditions does not exist    P42     Fparse_func.c
 L1104   Runknown_attribute: UPDATE activities SET name='hi' WHERE
 (activities.conditions IN (E'ticket_id =?',1))
  Could you please correct the syntax
 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-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
-~--~~~~--~~--~--~---



[Rails] Re: Updtade 2.2.2 to 2.3.2

2009-05-13 Thread Olaf S.

Fresh Mix wrote:
 How can I updated my rails 2.2.2 project to 2.3.2?
 
 Chane RAILS_GEM_VERSION = '2.3.2' and ???

How about updating your rails gem first

# gem rails update

Then maybe freeze it

Appdir # rake rails:freeze:edge RELEASE=2.3.2

And of course change your enviroment.rb as you already said.
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Login for iPhone webapp

2009-05-13 Thread Pål Bergström

I can't get a login action to work for an iPhone webapp (using the
iPhone Simulator).

Is there anything special that I should think about for a login action
on the iPhone?
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: What is the sequential steps of installing RoR?

2009-05-13 Thread sheru

Hi,
I have installed ruby186-27_rc2 on windows xp for the developement.

Now I have questions:

- How do I know now the ruby installed successfully  where do I write
coding?

- Does package install rubygems automatically or need to do manually?

Thank you for your suggestion
Sheru


On May 11, 1:52 am, 7stud -- rails-mailing-l...@andreas-s.net wrote:
 sheru wrote:
  Hi,
  I am Sheru  am completely new for this web framework. I am really
  really enthusiastic to know the Ruby on Rails  possibly try to use
  this framework near future.

  But at the start up, I don't have idea on installing RoR on Windows
  XP.

 http://www.ruby-forum.com/topic/185728#811600
 --
 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-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
-~--~~~~--~~--~--~---



[Rails] Re: Updtade 2.2.2 to 2.3.2

2009-05-13 Thread Colin Law
Don't forget
rake rails:update
to update scripts, boot etc

2009/5/13 Olaf S. rails-mailing-l...@andreas-s.net


 Fresh Mix wrote:
  How can I updated my rails 2.2.2 project to 2.3.2?
 
  Chane RAILS_GEM_VERSION = '2.3.2' and ???

 How about updating your rails gem first

 # gem rails update

 Then maybe freeze it

 Appdir # rake rails:freeze:edge RELEASE=2.3.2

 And of course change your enviroment.rb as you already said.
 --
 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-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
-~--~~~~--~~--~--~---



[Rails] How to ultimately override rails headers?

2009-05-13 Thread Piotr Wlodarek

How to ultimately override any/all rails headers, including X-Runtime,
Set-Cookie, etc.

As you know, standard response.headers[Set-Cookie] = '' in
after_filter will often *not* work, as rails overrides some headers.

TIA,
Qertoip
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Selenium - tips for avoiding a hundred fixture files.

2009-05-13 Thread Max Williams

I've just started using Selenium with Rspec and it's working well so
far.  However, i'm testing it against my local development version of
the site (ie running in mongrel).  What i really need to do is run it in
a test environment, so i can do destructive actions repeatedly.

Using fixtures seems like one obvious way to go - since it's a form of
integration testing i don't want to start mocking and stubbing things,
that's just going to cause more confusion and problems than it solves.
So, i could fixture everything up the wazoo.

The problem is, though, that we have a big site with loads of different
tables, and lots of different interrelated models.  Setting up all the
fixtures is going to be a pain in the ass.  So, i thought of a few ways
to go:

1) Make a stripped down version of our db, by basically deleting lots of
records and all their associations out.  Then

  a) Generate fixtures, or some data (maybe even just an sql file) that
is loaded into the db before every test.  This is going to be very slow
as the data will be reloaded *a lot*.

  b) Run every test (or group of tests) in a transaction, so the changes
are always undone after every test.  This should be a lot quicker than
1a.

2) Generate a lot of fixtures somehow using some kind of system that
basically makes it easier to have a lot of associated models.

3) Something else i'm too ignorant to think of.

Does anyone have any advice/guidance/urls/etc regarding this?

thanks
max
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: Ruby training? Worry no more.

2009-05-13 Thread Kevin Skoglund

Garfeee,

Thanks for the kind words and recommendation.

Ruby on Rails Essential Training is being updated for Rails v3 and
I'll be releasing a separate Ruby Essential Training soon.

Best,
Kevin
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Using adobe contribute on a rails project

2009-05-13 Thread Sergio Ruiz

we are currently trying to allow one of our clients to access and edit
some html files on their site via adobe's contribute.

the files live in the public directory of the rails site, and it seems
like there is a problem with contribute connecting to the site. it
looks like contribute is attempting to find a direct http connection
to the file as in:

http://www.domain.com/filename.txt

it seems to want to find the file at the root of the site, but on a
rails site, the files lives at:

site/public/filename.txt

i can't think of any other problem the connection  might be having..

anyone have any ideas?
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] application design : background process

2009-05-13 Thread Adam Akhtar

Hi im making a simple app which takes a users search term and scrapes
several sites rss feeds for relevant results. The scrape can take upto
10seconds. I want to make this a background process so I can update the
user with the scrapes status(currently scraping site x) and present
results as they are scraped.

Im looking at backgroundrb and have read a guide in Advanced Rails
Recipe however thats for an older version of backgroundrb and the api
has changed. So im a little confused - im also new to processes and
threads.

If my worker is responsible for scraping each site and providing updates
do I have one worker which will be used by all the users currently
online? I guess I then can use threads to process multiple search
requests at times when the site is busy.

OR

do i create a new worker for each user? Would this also allow for
concurrent processing?
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Counting

2009-05-13 Thread Remco Swoany

Hi,


I generate and download a cvs from my (HBX)stats-tool. The data is
campaign-history value for tracking the hisitory of campaigns

Campaign-history Orders
Direct 4
Direct~Direct  6
adwords2
adwords~direct~direct  4
organic12
organic_adwords_direct 4
ect

I download this by week (different campaign-history) and then i count
the orders based on campaign-history. Because the csv if very long and
also time consuming work,  i want to realize the counting the
campaign/orders in ruby.

Someone ideas?

grtz..remco
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] [ANN] Blue Ridge 1.0: JavaScript Unit Testing for Rails

2009-05-13 Thread Jason Rudolph

Blue Ridge 1.0 has been released!

 Blue Ridge
  by Relevance, http://thinkrelevance.com

Blue Ridge is a JavaScript testing plugin for Rails.  It provides
support for both command-line and in-browser JavaScript unit tests,
and it brings the goodness of test-driven and behavior-driven
development to your unobtrusive JavaScript code in a Rails-friendly
manner.

http://github.com/relevance/blue-ridge

 DESCRIPTION

You wouldn’t consider developing a Rails application without having a
solid test suite for your Ruby code, but you’ve somehow convinced
yourself to cross your fingers and look the other way when it comes to
JavaScript. It doesn’t have to be that way.

Historically, when selecting a JavaScript testing solution, you were
forced to choose whether you wanted a framework that could run your
tests in the browser or one that could only run your tests in a
headless fashion.  By providing a friendly convention-over-
configuration wrapper around a collection of great open source tools,
Blue Ridge gives us the best of both worlds: fast, automation-
friendly, and headless testing plus the ability to run your tests in
whichever browser is acting up on any given day.

 FEATURES

* BDD-style specs for your JavaScript code
* jQuery and Prototype support
* Headless execution of JavaScript specs for easy command-line
execution and integration with your Continuous Integration build
* In-browser execution of JavaScript specs for testing and debugging
browser-specific quirks
* Mocking support via Smoke
* TextMate integration for running specs from inside TextMate
* irb-like JavaScript shell for experimentation and debugging

 QUICK START

Install Blue Ridge into your Rails app:

./script/plugin install git://github.com/relevance/blue-ridge.git
./script/generate blue_ridge

Blue Ridge creates a small example spec to get you started.  Run your
JavaScript specs to make sure that all is well.

rake test:javascripts

Hint: You can also use the spec:javascripts or
examples:javascripts aliases.  Blue Ridge is compatible with your
testing framework of choice, be it test/unit, RSpec, Micronaut,
Shoulda, test-spec, etc.

 EXAMPLE SPEC

Installing the plugin creates an example spec (application_spec.js),
demonstrating some basic tests to help you get a feel for the
structure of the tests.

require(spec_helper.js);
require(../../public/javascripts/application.js);

Screw.Unit(function() {
  describe(Your application javascript, function() {
it(provides cliché example, function() {
  expect(hello).to(equal, hello);
});

it(accesses the DOM from fixtures/application.html, function
() {
  expect($('.select_me').length).to(equal, 2);
});
  });
});

This particular spec uses jQuery, but you can optionally configure
your spec to use Prototype.

And, no, we don’t actually encourage you to write tests for standard
libraries like jQuery and Prototype; it just happens to make for an
easy demo.

 ADDITIONAL RESOURCES

Check out the README [1] for detailed information on each of the
features described above and for tips and tricks for getting the most
out of Blue Ridge.

Explore the sample app [2] to see more specs and testing techniques in
action.

Use the project’s GitHub issue tracker [3] to let us know about any
issues or ideas for possible improvements. Even better, fork the repo
[1] and start hacking!  If you have patches, send us pull requests.

--

[1] Detailed README - http://github.com/relevance/blue-ridge
[2] Sample Application - http://github.com/relevance/blue-ridge-sample-app
[3] Issues - http://github.com/relevance/blue-ridge/issues

--

Cheers,
Jason

--

Jason Rudolph
http://thinkrelevance.com
http://jasonrudolph.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-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
-~--~~~~--~~--~--~---



[Rails] Re: application design : background process

2009-05-13 Thread Francesc Esplugas

I would use Workling + Starling, or the run_later plugin. You can find
all of them at Github.

On Wed, May 13, 2009 at 4:01 PM, Adam Akhtar
rails-mailing-l...@andreas-s.net wrote:
 Im looking at backgroundrb and have read a guide in Advanced Rails
 Recipe however thats for an older version of backgroundrb and the api
 has changed. So im a little confused - im also new to processes and
 threads.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Problem with mongrel server (FC8) :

2009-05-13 Thread aPpLe

Hi,

I have some problem with mongrel server.
While I am  trying access http://localhost:3000,
getting the following error message

 mongrel_rails start
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready.  TERM = stop.  USR2 = restart.  INT = stop (no
restart).
** Rails signals registered.  HUP = reload (without restart).  It
might not work well.
** Mongrel 1.1.5 available at 0.0.0.0:3000
** Use CTRL-C to stop.
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:
122: [BUG] Segmentation fault
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-linux]

Aborted


mongrel_rails --version
Mongrel Web Server 1.1.5
OS:Fedora 8



thank you

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Grouping in tables

2009-05-13 Thread John Small

I have an app which uses ActiveResource to get data from a non-Rails
client. One of the things it has to do is display that data in a
webpage, with subtotals by week. What's an easy way to break up a
collection of ARes instances by a column so I can then pump each group
into a partial. The partial then displays the lines for that group, and
a sub-total at the end.

The other way I could do it is to xml-ise the ARes records, generate the
table, with groups and subtotals using XSLT, and then feed that as text
into a render method. But that involves stepping outside Rails to format
stuff.

Anyone have any ideas?

Thanks

John Small
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: Selenium - tips for avoiding a hundred fixture files.

2009-05-13 Thread Marnen Laibow-Koser

Max Williams wrote:
 I've just started using Selenium with Rspec and it's working well so
 far.  However, i'm testing it against my local development version of
 the site (ie running in mongrel).  What i really need to do is run it in
 a test environment, so i can do destructive actions repeatedly.

Investigate Webrat (and ots Selenium bindings if you need them). 
Cucumber may also be nice here.

 
 Using fixtures seems like one obvious way to go

The obvious is not always the best. :)

[...]
   a) Generate fixtures, or some data (maybe even just an sql file) that
 is loaded into the db before every test.  This is going to be very slow
 as the data will be reloaded *a lot*.

Remember, Rspec already clears the test database before each test.

What you have here is a good use case for factories, I think.  Install 
Machinist or Factory Girl and just tell it what you need for each 
particular test.  It will take care of the dependencies.
[...]
 2) Generate a lot of fixtures somehow using some kind of system that
 basically makes it easier to have a lot of associated models.

This is sort of what factories do.  There's a Railscast on the subject.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: Selenium - tips for avoiding a hundred fixture files.

2009-05-13 Thread WJSimacek



On May 13, 9:18 am, Marnen Laibow-Koser rails-mailing-l...@andreas-
s.net wrote:
 Max Williams wrote:
  I've just started using Selenium with Rspec and it's working well so
  far.  However, i'm testing it against my local development version of
  the site (ie running in mongrel).  What i really need to do is run it in
  a test environment, so i can do destructive actions repeatedly.

 Investigate Webrat (and ots Selenium bindings if you need them).
 Cucumber may also be nice here.



  Using fixtures seems like one obvious way to go

 The obvious is not always the best. :)

 [...]

    a) Generate fixtures, or some data (maybe even just an sql file) that
  is loaded into the db before every test.  This is going to be very slow
  as the data will be reloaded *a lot*.

 Remember, Rspec already clears the test database before each test.

 What you have here is a good use case for factories, I think.  Install
 Machinist or Factory Girl and just tell it what you need for each
 particular test.  It will take care of the dependencies.
 [...]

  2) Generate a lot of fixtures somehow using some kind of system that
  basically makes it easier to have a lot of associated models.

 This is sort of what factories do.  There's a Railscast on the subject.

Check out this Railscast that uses two gems populator and faker to
create a rake that loads a database with fake data:

http://railscasts.com/episodes/126-populating-a-database



 Best,
 --
 Marnen Laibow-Koserhttp://www.marnen.org
 mar...@marnen.org
 --
 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-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
-~--~~~~--~~--~--~---



[Rails] Re: Implementing ruby-openid 2.1.6 using TDD

2009-05-13 Thread WJSimacek



On May 12, 7:55 am, wayne.sima...@gmail.com
wayne.sima...@gmail.com wrote:
 I'm trying to implement ruby-openid 2.1.6 using TDD. Many of the
 resources I've been using to research the plugin
 open_id_authentication and RESTful-authentication were written back in
 2007 and don't work, and also don't have a test-driven approach.

 Does anyone know where I can find some good resources that would
 explain and maybe have some examples with some tests and also how they
 are getting them to pass, that is also fairly current?
I found this I think I'll try and work through:

http://railsforum.com/viewtopic.php?id=14216p=1
Restful Authentication with all the bells and whistles (new 9/05/08)

This is a new restful authentication tutorial based the lastest
version of the plugin and edge rails as of 9/05/08. The original
tutorial can be found at http://railsforum.com/viewtopic.php?pid=74245#p74245

The source code is now available on github.com at 
http://github.com/activefx/restful_auth
… ree/master Since this new tutorial will be less of a step by step
instruction guide and more of an overview and description of the files
in the application, I suggest you grab the app from github to work
with.


 I know this is a lot to ask, but thanks for trying.
 Wayne
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: Using adobe contribute on a rails project

2009-05-13 Thread Colin Law
If the url of the root of your rails app is www.domain.com then
www.domain.com/filename.txt will look in the /public directory.  Try
accessing a file there from your browser to check this is working.
Colin

2009/5/13 Sergio Ruiz rails-mailing-l...@andreas-s.net


 we are currently trying to allow one of our clients to access and edit
 some html files on their site via adobe's contribute.

 the files live in the public directory of the rails site, and it seems
 like there is a problem with contribute connecting to the site. it
 looks like contribute is attempting to find a direct http connection
 to the file as in:

 http://www.domain.com/filename.txt

 it seems to want to find the file at the root of the site, but on a
 rails site, the files lives at:

 site/public/filename.txt

 i can't think of any other problem the connection  might be having..

 anyone have any ideas?
 --
 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-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
-~--~~~~--~~--~--~---



[Rails] Re: Using adobe contribute on a rails project

2009-05-13 Thread Colin Law
2009/5/13 Colin Law clan...@googlemail.com

 If the url of the root of your rails app is www.domain.com then
 www.domain.com/filename.txt will look in the /public directory.  Try
 accessing a file there from your browser to check this is working.
 Colin


On the other hand this may only be true when accessing from a browser, I
don't know how adobe contribute expects to read/write to a file.
Colin



 2009/5/13 Sergio Ruiz rails-mailing-l...@andreas-s.net


 we are currently trying to allow one of our clients to access and edit
 some html files on their site via adobe's contribute.

 the files live in the public directory of the rails site, and it seems
 like there is a problem with contribute connecting to the site. it
 looks like contribute is attempting to find a direct http connection
 to the file as in:

 http://www.domain.com/filename.txt

 it seems to want to find the file at the root of the site, but on a
 rails site, the files lives at:

 site/public/filename.txt

 i can't think of any other problem the connection  might be having..

 anyone have any ideas?
 --
 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-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
-~--~~~~--~~--~--~---



[Rails] Re: application design : background process

2009-05-13 Thread Adam Akhtar

can they perform tasks dynamically i.e. a task is initiated on a users 
mouse click. I thought i saw a railscast that said they were only good 
for prescheduled tasks.

-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: Implementing ruby-openid 2.1.6 using TDD

2009-05-13 Thread Colin Law
2009/5/13 WJSimacek wayne.sima...@gmail.com




 On May 12, 7:55 am, wayne.sima...@gmail.com
 wayne.sima...@gmail.com wrote:
  I'm trying to implement ruby-openid 2.1.6 using TDD. Many of the
  resources I've been using to research the plugin
  open_id_authentication and RESTful-authentication were written back in
  2007 and don't work, and also don't have a test-driven approach.
 
  Does anyone know where I can find some good resources that would
  explain and maybe have some examples with some tests and also how they
  are getting them to pass, that is also fairly current?
 I found this I think I'll try and work through:

 http://railsforum.com/viewtopic.php?id=14216p=1
 Restful Authentication with all the bells and whistles (new 9/05/08)


Is that 8th May 2009, 5th Sept 2008 or 9th May 2008?
Colin




 This is a new restful authentication tutorial based the lastest
 version of the plugin and edge rails as of 9/05/08. The original
 tutorial can be found at
 http://railsforum.com/viewtopic.php?pid=74245#p74245

 The source code is now available on github.com at
 http://github.com/activefx/restful_auth
 … ree/master Since this new tutorial will be less of a step by step
 instruction guide and more of an overview and description of the files
 in the application, I suggest you grab the app from github to work
 with.

 
  I know this is a lot to ask, but thanks for trying.
  Wayne
 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: SocketError (getaddrinfo: Name or service not known)

2009-05-13 Thread daociyiyou

hi Tom
My ftp directory setting is right.ftp api need port to be specified? I
got another error

###
Net::FTPPermError (500 Illegal PORT command. ):
###

My codes is

###
  Net::FTP.open('showreelfinder.com') do |ftp|
ftp.login('heywatch','JRnu4bNtXk')
ftp.chdir('thumbnail')
ftp.putbinaryfile('public/images/rails.png',encoded_video.title)
###

I have tried my best.My server forbids ftp access or my computer
occupied the 21 port?
Ftp really make me like a idiot.

 
===
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: Deleting Sessions with no logout

2009-05-13 Thread Shandy Nantz

Colin Law wrote:
 2009/5/12 Shandy Nantz rails-mailing-l...@andreas-s.net
 

 It has to do with the sessions which are holding id for the current
 users logged in. At most, there may be three session variables set - the
 two above and another called session[:admin]. An admin can move from
 profile to profile making modifications, but what I think is happening
 is that the admin are not logging like they should and are instead
 simply Xing out. This means that those sessions may be used to set up
 unwanted objects and show links, and other varous forms of undesired
 information.
 
 
 Do you mean another user is coming along to the pc that had the admin 
 user
 logged in and using it as admin? Or that someone is picking up the admin
 role on another PC when they should not? Or something else?

No, an admin logs in and they can view and edit other profiles (not 
other admin profiles), all from the same PC.
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: Deleting Sessions with no logout

2009-05-13 Thread Colin Law
I still do not understand the problem you are seeing.
Colin

2009/5/13 Shandy Nantz rails-mailing-l...@andreas-s.net


 Colin Law wrote:
  2009/5/12 Shandy Nantz rails-mailing-l...@andreas-s.net
 
 
  It has to do with the sessions which are holding id for the current
  users logged in. At most, there may be three session variables set - the
  two above and another called session[:admin]. An admin can move from
  profile to profile making modifications, but what I think is happening
  is that the admin are not logging like they should and are instead
  simply Xing out. This means that those sessions may be used to set up
  unwanted objects and show links, and other varous forms of undesired
  information.
 
 
  Do you mean another user is coming along to the pc that had the admin
  user
  logged in and using it as admin? Or that someone is picking up the admin
  role on another PC when they should not? Or something else?

 No, an admin logs in and they can view and edit other profiles (not
 other admin profiles), all from the same PC.
 --
 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-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
-~--~~~~--~~--~--~---



[Rails] Re: Using adobe contribute on a rails project

2009-05-13 Thread Sergio Ruiz

unfortunately, none of the files are accessible by the browser.. since 
they all live outside the of the area served by apache..


the app is served via apache.. through a proxy..

-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Getting and setting ruby tags in controller

2009-05-13 Thread Hamid Raza

I want to access the divs in the controller and want to change its
attributes , is it possible in ruby on rails.




plz help me out...
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Order numbers by value

2009-05-13 Thread Shandy Nantz

I have this drop-down that get populated with stuff. As I have
recently found out, this stuff will either be all string values or all
numerical values. I have the string values being ordered correctly but
the numerical values are not. For example, this sequence of numbers
7007, 7100, 70100, 7009, 70200 get order as 7007, 7009, 70100, 70200,
7100. Is there a way to treat these strings as numbers instead of
strings and order them as such?
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: Using adobe contribute on a rails project

2009-05-13 Thread Colin Law
The rails project public folder must be accessible, that is where all the
js, css files etc live

2009/5/13 Sergio Ruiz rails-mailing-l...@andreas-s.net


 unfortunately, none of the files are accessible by the browser.. since
 they all live outside the of the area served by apache..


 the app is served via apache.. through a proxy..

 --
 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-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
-~--~~~~--~~--~--~---



[Rails] Re: Order numbers by value

2009-05-13 Thread Colin Law
You could convert them to integer, sort and convert back to string.
There may well be a neater way as this is ruby, I don't know.

2009/5/13 Shandy Nantz rails-mailing-l...@andreas-s.net


 I have this drop-down that get populated with stuff. As I have
 recently found out, this stuff will either be all string values or all
 numerical values. I have the string values being ordered correctly but
 the numerical values are not. For example, this sequence of numbers
 7007, 7100, 70100, 7009, 70200 get order as 7007, 7009, 70100, 70200,
 7100. Is there a way to treat these strings as numbers instead of
 strings and order them as such?
 --
 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-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
-~--~~~~--~~--~--~---



[Rails] Re: Using adobe contribute on a rails project

2009-05-13 Thread Sergio Ruiz

Colin Law wrote:
 The rails project public folder must be accessible, that is where all 
 the
 js, css files etc live


accessible as in correct permissions?
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: Order numbers by value

2009-05-13 Thread Marnen Laibow-Koser

On May 13, 11:03 am, Shandy Nantz rails-mailing-l...@andreas-s.net
wrote:
 I have this drop-down that get populated with stuff. As I have
 recently found out, this stuff will either be all string values or all
 numerical values. I have the string values being ordered correctly but
 the numerical values are not. For example, this sequence of numbers
 7007, 7100, 70100, 7009, 70200 get order as 7007, 7009, 70100, 70200,
 7100. Is there a way to treat these strings as numbers instead of
 strings and order them as such?

Use a custom sort routine:

['10', '9', '8'].sort #= ['10', '8', '9']
['10', '9', '8'].sort_by{|x| x.to_i} #= ['8', '9', '10']
['10', '9', '8'].sort{|a, b| a.to_i = b.to_i} #= ['8', '9', '10']

Does that help?

Best,
--
Marnen Laibow-Koser
mar...@marnen.org
http://www.marnen.org
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: Using adobe contribute on a rails project

2009-05-13 Thread Colin Law
Accessible to the browser via http at the root of the domain for fetching
javascript css etc. Also the 404.html and 500.html error pages are normally
there. Also robots.txt etc.  Look in your rails project /public folder and
you will see what I mean.

All of this may have no relevance to adobe contribute however.
Colin

2009/5/13 Sergio Ruiz rails-mailing-l...@andreas-s.net


 Colin Law wrote:
  The rails project public folder must be accessible, that is where all
  the
  js, css files etc live


 accessible as in correct permissions?
 --
 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-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
-~--~~~~--~~--~--~---



[Rails] Re: Implementing ruby-openid 2.1.6 using TDD

2009-05-13 Thread WJSimacek



On May 13, 9:44 am, Colin Law clan...@googlemail.com wrote:
 2009/5/13 WJSimacek wayne.sima...@gmail.com





  On May 12, 7:55 am, wayne.sima...@gmail.com
  wayne.sima...@gmail.com wrote:
   I'm trying to implement ruby-openid 2.1.6 using TDD. Many of the
   resources I've been using to research the plugin
   open_id_authentication and RESTful-authentication were written back in
   2007 and don't work, and also don't have a test-driven approach.

   Does anyone know where I can find some good resources that would
   explain and maybe have some examples with some tests and also how they
   are getting them to pass, that is also fairly current?
  I found this I think I'll try and work through:

 http://railsforum.com/viewtopic.php?id=14216p=1
  Restful Authentication with all the bells and whistles (new 9/05/08)

 Is that 8th May 2009, 5th Sept 2008 or 9th May 2008?
Good point. ==I'm pretty sure it was May, 2008.

 Colin



  This is a new restful authentication tutorial based the lastest
  version of the plugin and edge rails as of 9/05/08. The original
  tutorial can be found at
 http://railsforum.com/viewtopic.php?pid=74245#p74245

  The source code is now available on github.com at
 http://github.com/activefx/restful_auth
  … ree/master Since this new tutorial will be less of a step by step
  instruction guide and more of an overview and description of the files
  in the application, I suggest you grab the app from github to work
  with.

   I know this is a lot to ask, but thanks for trying.
   Wayne
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] backgroundrb launched 8 workers via cron which I did not understand

2009-05-13 Thread wbsurf...@yahoo.com


I have a worker my_tree worker as shown in my backgroundrb.yml file
below.
I played around with the trigger_args setting which I had it calling
update_main_tree() every 1 minute.
This opens a tree structure in my db that I set and rebuilds it. After
it seemed to be working ok, I then
set the tree to be updated to be a larger tree and set the
trigger_args  to happen at 8:00 pm, and then went home.
I do not have reload_on_schedule set. When I came in the next day, my
machine was nearly hung as at 8:00 pm
according to my log file, 8 different workers got launched on
update_main_tree()

:schedules:
  :session_mgr_worker:
:expire_sessions:
  :trigger_args: 0 0 */6 * * * *
  :my_tree_worker:
:update_main_tree:
  :trigger_args: 0 0 20 * * * *
  #   :trigger_args: 0 */1 * * * * *

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: Implementing ruby-openid 2.1.6 using TDD

2009-05-13 Thread Colin Law
Wayne - sorry I misread your post, I thought you were announcing the
tutorial, but I realise now you were quoting someone else.
Colin

2009/5/13 WJSimacek wayne.sima...@gmail.com




 On May 13, 9:44 am, Colin Law clan...@googlemail.com wrote:
  2009/5/13 WJSimacek wayne.sima...@gmail.com
 
 
 
 
 
   On May 12, 7:55 am, wayne.sima...@gmail.com
   wayne.sima...@gmail.com wrote:
I'm trying to implement ruby-openid 2.1.6 using TDD. Many of the
resources I've been using to research the plugin
open_id_authentication and RESTful-authentication were written back
 in
2007 and don't work, and also don't have a test-driven approach.
 
Does anyone know where I can find some good resources that would
explain and maybe have some examples with some tests and also how
 they
are getting them to pass, that is also fairly current?
   I found this I think I'll try and work through:
 
  http://railsforum.com/viewtopic.php?id=14216p=1
   Restful Authentication with all the bells and whistles (new 9/05/08)
 
  Is that 8th May 2009, 5th Sept 2008 or 9th May 2008?
 Good point. ==I'm pretty sure it was May, 2008.

  Colin
 
 
 
   This is a new restful authentication tutorial based the lastest
   version of the plugin and edge rails as of 9/05/08. The original
   tutorial can be found at
  http://railsforum.com/viewtopic.php?pid=74245#p74245
 
   The source code is now available on github.com at
  http://github.com/activefx/restful_auth
   … ree/master Since this new tutorial will be less of a step by step
   instruction guide and more of an overview and description of the files
   in the application, I suggest you grab the app from github to work
   with.
 
I know this is a lot to ask, but thanks for trying.
Wayne
 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: SocketError (getaddrinfo: Name or service not known)

2009-05-13 Thread daociyiyou

can you help me?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: dynamic table names for AR models

2009-05-13 Thread Gabriel Saravia

 but for some reason that doesn't quite feel like a good solution.

that, overall, makes sense, and is very little code..combine it with a 
before callback or method_missing?

what about it seems like a poor solution?

I come back to asking, will all wheel classes have the same attributes 
and methods?




-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: SocketError (getaddrinfo: Name or service not known)

2009-05-13 Thread Tom Z Meinlschmidt

try to set passive mode

daociyiyou wrote:
 hi Tom
 My ftp directory setting is right.ftp api need port to be specified? I
 got another error
 
 ###
 Net::FTPPermError (500 Illegal PORT command. ):
 ###
 
 My codes is
 
 ###
   Net::FTP.open('showreelfinder.com') do |ftp|
 ftp.login('heywatch','JRnu4bNtXk')
 ftp.chdir('thumbnail')
 ftp.putbinaryfile('public/images/rails.png',encoded_video.title)
 ###
 
 I have tried my best.My server forbids ftp access or my computer
 occupied the 21 port?
 Ftp really make me like a idiot.
 
  
 ===
 

-- 
===
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache
  - experienced RoR/PHP freelancer, available for hire

   www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
===

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: backgroundrb launched 8 workers via cron which I did not understand

2009-05-13 Thread Larz


I noticed that the example in my book has an explicit exit() call at
the end of the worker create(). I think that might have something to
do with it as when I invoke other methods that
create workers, instances of packet_worker_runner seem to hang around.
I didn't have such an exit() call in my code.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: SocketError (getaddrinfo: Name or service not known)

2009-05-13 Thread daociyiyou
Thank you very much! After changed to passive mode,it works for normal
image file.But for thumbnail(binary data),i does not.The ftp api does
not support binary data writing? I got the error:No such file or
directory

On 5月14日, 上午12时13分, Tom Z Meinlschmidt to...@meinlschmidt.org wrote:
 try to set passive mode



 daociyiyou wrote:
  hi Tom
  My ftp directory setting is right.ftp api need port to be specified? I
  got another error

  ###
  Net::FTPPermError (500 Illegal PORT command. ):
  ###

  My codes is

  ###
Net::FTP.open('showreelfinder.com') do |ftp|
  ftp.login('heywatch','JRnu4bNtXk')
  ftp.chdir('thumbnail')
  ftp.putbinaryfile('public/images/rails.png',encoded_video.title)
  ###

  I have tried my best.My server forbids ftp access or my computer
  occupied the 21 port?
  Ftp really make me like a idiot.

  ===

 --
 ===
 Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache
   - experienced RoR/PHP freelancer, available for hire

www.meinlschmidt.com www.maxwellrender.cz www.lightgems.cz
 ===
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Tabbed Navigation with Secondary Nav and Auth

2009-05-13 Thread Mark A. Richman

Anyone know of a good tabbed navigation plugin that works with
secondary navigation? i.e. 
http://developer.yahoo.com/ypatterns/examples/tabs.html

Ideally, it will integrate with Authlogic.

Thanks,
Mark
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Sharing sessions across rails apps 2.3.2

2009-05-13 Thread Doug Livesey

I've done this in 2.2, but cannot figure it out for 2.3.2:

Basically, I want to be able to share session data across a couple of
apps.
The way I did this in 2.2 was to create a view called sessions in the
second app that read the sessions table of the first app.
This done, I could tell them both to use active record sessions, and,
lo! I had a shared session.
Once I'd written a little routine to swap between apps (to basically
clean out the session apart from user ids), I could then happily swap
back and forth between them.
The trouble is, rails has moved on to 2.3.2, and I'm having the very
devil of a time getting something like this working again.
I'm using the same view-as-sessions-table technique, and I have both
apps sessions set to the same key and secret in the initializers/
directory, but it just isn't working.
Can anyone offer any advice as to what I could try next?
Cheers,
   Doug.
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: Setting a boolean to false in a before_create callback

2009-05-13 Thread Matt Jones

Does the object pass validation? before_create callbacks won't run if
it doesn't.

I'd recommend changing the middle line to @assignment.save.should
be_true or equivalent to check if the record is getting saved at all.

--Matt Jones

On May 12, 8:14 pm, Gabriel Saravia rails-mailing-l...@andreas-s.net
wrote:
 Has anyone ever had trouble doing this?  Whenever I try to do so, it
 doesn't seem to work:

 in my model:
 [code]
   before_create :set_defaults

   def set_defaults
     self.submitted = false
   end
 [/code]

 in my rspec test:
 [code]
   it Should set 'submitted' to false before a create do
     @assignment = Assignment.new(:submitted = true)
     @assignment.save
     @assignment.submitted.should be_false
   end
 [/code]

 and the result:
 [code]
 Assignment Should set 'submitted' to false before a create' FAILED
 expected false, got true
 [/code]
 --
 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-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
-~--~~~~--~~--~--~---



[Rails] Re: MySQL Text type failure

2009-05-13 Thread Matt Jones

Never heard of that happening - can you post a stack track from the
log where it gets the 500?

--Matt Jones

On May 12, 2:09 pm, JannaB mistressja...@hotmail.com wrote:
 This is very peculiar --  I am using (I am using MySQL 5.0.27-
 community) If I create a table with the following schema.

 CREATE TABLE `associates` (
   `id` int(11) NOT NULL auto_increment,
   `username` varchar(16) NOT NULL default '',
  ...
  ...
   `tstamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update
 CURRENT_TIMESTAMP,
   PRIMARY KEY  (`id`),
 ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=27 ;

 things in AS work swimmingly. However, if I add a column (anywhere in
 the table, here I am just putting at the end) that is a text type,
 call it   `notes` (or even make, say varchar(500) ) as follows:

 CREATE TABLE `associates` (
   `id` int(11) NOT NULL auto_increment,
   `username` varchar(16) NOT NULL default '',
  ...
  ...
   `tstamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update
 CURRENT_TIMESTAMP,
   `notes` text NOT NULL,
   PRIMARY KEY  (`id`),
 ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=27 ;

 When I go to do an edit on the table, regardless of whether I add any
 data to the notes field or not, and I save it, It won't come back up
 when I go to edit it again (I get a 500 error). It saves the values
 into the db correctly when I go directly into the db and look at the
 changes -- but it wont come back up when I go to edit it without
 generating
 a 500 error.

 I am using the latest version of Rails (2.3) , Ruby and
 ActiveScaffold. Has anyone
 experienced anything like this trying to use a large text field with
 MySQL ?
 thank you, Janna B
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: has_many :through and scopes: how to mutate the set of associated objects?

2009-05-13 Thread Matt Jones

Try it in a named_scope, thus:

class Person  AR::Base
  named_scope :as, lambda { |role_name| { :joins = 'CROSS JOIN
role_types', :conditions = [(roles.role_type_id = role_types.id) AND
role_types.name = ?, role_name] } }
end

But I'm *almost* positive that that still won't be able to trigger the
named_scope :create_scope magic. The other thought would be to return
a custom subclass of AssociationCollection from your 'as' association
extension. You'd probably need to override a few methods (
especially) to take into account the source of the request (the
argument passed to as).

--Matt Jones


On May 12, 12:16 pm, Michael Schuerig mich...@schuerig.de wrote:
 On Tuesday 12 May 2009, Matt Jones wrote:

  Haven't tried it, but have you considered switching the association
  extension to a regular named_scope on Person? For simpler cases, I
  know that the named_scope code is smart enough to use the scope
  conditions to instantiate objects. Not sure if it will work here...

 If I understand you correctly, I've already considered that case.

 class Person  ActiveRecord::Base
   named_scope :actors, ... # add a condition picking out the actors
 end

 Then, with

 movie.participants.actors

 I'd get the people who are participating in movie and who are actors.
 However, what I want are the people participating in movie *as* actors.

 It might be possible to get this to work as intended, but I tend to
 think it's not. Dealing with the joins involved is already tricky.
 ActiveRecord (almost) doesn't have an abstract model of queries, it more
 or less concatenates strings. There's no support for expressing, on the
 one hand, that a specific join is needed (without duplicating it), and
 on the other, that you want another, independent join.

 Michael



  On May 11, 7:34 pm, Michael Schuerig mich...@schuerig.de wrote:
   I have a model layer containing Movie, Person, Role, and RoleType,
   making it possible to express facts such as Clint Easterbunny is
   director of the movie Gran Milano.

   The relevant model and associations look like this

   class Movie  ActiveRecord::Base
     has_many :roles, :include = :role_type, :dependent = :destroy

     has_many :participants, :through = :roles, :source = :person do
       def as(role_name)
         self.scoped(
           :joins = 'CROSS JOIN role_types',
           :conditions = [
             (roles.role_type_id = role_types.id) +
              AND role_types.name = ?,
             role_name
           ]
         )
       end
     end
     ...
   end

   Querying is easy:

   m = Movie.find_by_title('Gran Milano')
   m.participants.as('director')

   However, changing relations is painful. It's already bad with
   has_many

   :through associations when the intermediate model is not completely

   dumb, and my scope trickery doesn't make it any better.

   Now, let's assume for a moment that participants was a plain
   has_many association. Then it would be possible to write things
   like

   m.participants.clear
   m.participants  Person.find_by_name('Steve McKing')
   m.participant_ids = params[:movie][:participants]

   With the given has_many :through, none of these work, as Role
   object won't validate without a role type. Anyway, what I would
   like to write is

   m.participants.as('actor').clear
   m.participants.as('actor')  Person.find_by_name('Steve McKing')
   m.participants.as('actor') =
   Person.find(params[:movie][:participants])

   I'm not sure this is possible with ActiveRecord as it is, but I'm
   looking forward to suggestions.

   Michael

 --
 Michael Schuerig
 mailto:mich...@schuerig.dehttp://www.schuerig.de/michael/
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: Invalid authenticity token only in IE6

2009-05-13 Thread Andrew

Yes, with some parts of the site, but not at all with the forms I'm
having trouble with.

On May 12, 7:24 pm, ianneub iann...@gmail.com wrote:
 We are seeing the same issue, but we're not using the restful-
 authentication plugin. Are you using jQuery or Prototype at all?

 On May 3, 8:26 pm, Andrew luckyd...@gmail.com wrote:



  Hi guys, I just discovered that both logging in and signing up does
  not work in IE6 due to anInvalidAuthenticityTokenerror. I'm using
  the latest restful-authetntication plugin. What's weird though, is
  that I viewed the source before submitting and took note of the token.
  After submission, on the error page (in the parameters section) the
  token is the exact same. The forms work in every other browser. What
  the heck?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] free sms gateway in india

2009-05-13 Thread bramu...@gmail.com

Hi,

   I am Ramu from India, My rails application needs to have sms
feature I searched for couple of rails plugins like sms-fu and all.
But it seems that none of them has a support to india mobiles. Please
help me in finding out the free sms plugin for rails in india.

Thanks,
Ramu.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: Setting a boolean to false in a before_create callback

2009-05-13 Thread Gabriel Saravia

 Also, be careful as if a before_create evaluates to false (as your one
 does) the create won't actually happen.

a-ha! thanks to both of you!

I had no validations on submitted because I was trying to isolate the 
problem (but that doesn't mean i didn't want any), but indeed, it was 
the before_create evaluating to false.

final version:

before_validation_on_create :set_defaults

def set_defaults
  self.submitted = false
  return (self.submitted == false)
end


Also, is it just me because I'm too new, or is the 
before_validation_on_create callback not talked about enough?

Cheers,
-Gabe
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] MVC, best practice for hash that combines objects?

2009-05-13 Thread arcX

Hi,

I just wanted to see if I am on the right track, as I am new to MVC.

I have a model called Tasks, and another called Entries. Tasks has
many entries.

Each entry has a time. So I want to total up the time entries so that
I have a keyed array of task Ids = duration.

In the end, I want to then print it out as a table in the reports
view, doing things like filter by completed, by date, etc.

Where should this hash be constructed? A function in a Report model?

Thanks!
arcX

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Keep fix data in database table while deploying

2009-05-13 Thread Chris B.

Hi there,

I'm pretty new to rails, but so far it's fun!

But I couldn't find an answer to solve this problem the rails way:

I deploy a webapp using capistrano and everything works fine.

In my db I have a table that has some fix entries, like categories,
and I want them to move to the deployment server.

What's the best way to make the data of a table move with it, when
deploying?

Regards,

Chris
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: Setting a boolean to false in a before_create callback

2009-05-13 Thread Robert Walker

Gabriel Saravia wrote:
 Also, is it just me because I'm too new, or is the 
 before_validation_on_create callback not talked about enough?

As me for me, I set my defaults in the migration (and hence the 
database) rather than initializing attributes with callbacks. I don't 
know if that's exactly the right way to do it, but it seems to work well 
as far as I can tell.

...
...
  t.boolean :bool_value, :default = false
...
...
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: free sms gateway in india

2009-05-13 Thread Marnen Laibow-Koser

bramu...@gmail.com wrote:
 Hi,
 
I am Ramu from India, My rails application needs to have sms
 feature I searched for couple of rails plugins like sms-fu and all.
 But it seems that none of them has a support to india mobiles. Please
 help me in finding out the free sms plugin for rails in india.

I know that here in the US, all mobile phone companies assign an e-mail 
address to each phone, so that SMS messages can simply be sent by e-mail 
to the appropriate address.  Do they do the same in India?  If so, 
that's probably your best bet.

 
 Thanks,
 Ramu.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: dynamic table names for AR models

2009-05-13 Thread Marnen Laibow-Koser

Pete Hodgson wrote:
 Hi All,
 
 I have an interesting Active Record problem and I'm not quite sure what
 the cleanest solution is. The legacy database that I am integrating with
 has a strange wrinkle in its schema where one logical table has been
 'partitioned' into several physical tables. Each table has the same
 structure, but contains data about different items.
[...]

Why not create a wheels view which combines the data from all the 
wheels_for_* tables, then tie your Wheel model to that?

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: What is the sequential steps of installing RoR?

2009-05-13 Thread 7stud --

Sheru Thakuri wrote:
 Hi,
 I have installed ruby186-27_rc2 on windows xp for the developement.
 
 Now I have questions:
 
 - How do I know now the ruby installed successfully


Open a command window and at the prompt type:

ruby -v

and hit Enter/Return.  If ruby installed correctly, that command should 
output the version(-v) that was installed.


  where do I write
 coding?


You write your code in a text file and then you name the file with a .rb 
extension, for example:

myfirstprogram.rb

To make ruby execute your program, you open a command window and cd 
(change directory) to the directory that contains your program.  Then at 
the prompt you type:

ruby myfirstprogram.rb

 
 - Does package install rubygems automatically or need to do manually?


You can check that by opening up a command window and typing:

gem -v





-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: SocketError (getaddrinfo: Name or service not known)

2009-05-13 Thread Tom Z Meinlschmidt
I got the error:No such file or directory

it's not problem with binary mode, but with your file :)

tom

daociyiyou wrote:
 Thank you very much! After changed to passive mode,it works for normal
 image file.But for thumbnail(binary data),i does not.The ftp api does
 not support binary data writing? I got the error:No such file or
 directory
 
 On 5月14日, 上午12时13分, Tom Z Meinlschmidt to...@meinlschmidt.org wrote:
 try to set passive mode



 daociyiyou wrote:
 hi Tom
 My ftp directory setting is right.ftp api need port to be specified? I
 got another error
 ###
 Net::FTPPermError (500 Illegal PORT command. ):
 ###
 My codes is
 ###
   Net::FTP.open('showreelfinder.com') do |ftp|
 ftp.login('heywatch','JRnu4bNtXk')
 ftp.chdir('thumbnail')
 ftp.putbinaryfile('public/images/rails.png',encoded_video.title)
 ###
 I have tried my best.My server forbids ftp access or my computer
 occupied the 21 port?
 Ftp really make me like a idiot.
 ===
 --
 ===
 Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache
   - experienced RoR/PHP freelancer, available for hire

www.meinlschmidt.com www.maxwellrender.cz www.lightgems.cz
 ===
  


-- 
===
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache
 - experienced RoR/PHP freelancer, available for hire

  www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
===

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: dynamic table names for AR models

2009-05-13 Thread Pete Hodgson

Gabriel Saravia wrote:
 but for some reason that doesn't quite feel like a good solution.
 
 that, overall, makes sense, and is very little code..combine it with a 
 before callback or method_missing?
 
 what about it seems like a poor solution?
 
 I come back to asking, will all wheel classes have the same attributes 
 and methods?

Sorry, I neglected to answer your question. Yes, all the wheel models 
should have the same attributes and methods. So there would be an 
AbstractWheel class something like this which each dynamically created 
model would inherit from:

class AbstractWheel  ActiveRecord:Base
  abstract_class = true

  # common functionality here
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-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
-~--~~~~--~~--~--~---



[Rails] Re: Strange error when running rails 2.3 on ruby 1.9.1 on FreeBSD

2009-05-13 Thread Thomas Webb

If you really want to learn the latest features as a beginner (might not 
be a good idea just because the complications might leave a bad taste in 
your mouth when running with rails is generally a smooth process), then 
I'd suggest doing what I had to do - track edge. The problem you're 
having was fixed in edge (I had the same issue as you in FreeBSD and 
also Mac OS X before I bit the bullet and tracked edge).

I'm only tracking edge because I need features that are only in ruby 
1.9.1 in my rails app. It probably won't be too long before 1.9.* and 
2.3.* is stable, so I would recommend what the others did - play around 
with the stable stuff first. Edge has it's own issues. You can upgrade 
later when these new versions are stable.
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: dynamic table names for AR models

2009-05-13 Thread Pete Hodgson

Marnen Laibow-Koser wrote:

 
 Why not create a wheels view which combines the data from all the 
 wheels_for_* tables, then tie your Wheel model to that?
 
 Best,
 --
 Marnen Laibow-Koser
 http://www.marnen.org
 mar...@marnen.org

I think that would have some performance issues. If there were 20 
tables, but only 1 of them contained wheels for the car I was working on 
then all 20 tables would have to be checked during a join, no?
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: Sharing sessions across rails apps 2.3.2

2009-05-13 Thread Doug Livesey

That could well be part of it, but I'm afraid I'm not sure I follow you.
How would I go about doing that?
(I didn't need to with my old approach.)
Cheers,
   Doug.
-- 
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-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
-~--~~~~--~~--~--~---



[Rails] Re: Yet Another Time Zone Question

2009-05-13 Thread Randall

Thanks Jeremy!

On May 12, 6:31 pm, Jeremy Olliver jeremy.olli...@gmail.com wrote:
 Hi,

 The time zone is encoded in the string at the end e.g

 Mon, 11 May 2009 18:24:37 +1200
 Is in a time zone that's +12 (12 hours ahead of utc)
 DateTime.parse or Time.parse will read this correctly.

 So what you're doing is using a js date picker that gives you a string
 like Mon May 11 18:24:37 2009
 You just need to append the time zone difference to Mon May 11
 18:24:37 2009 +1200 etc before parsing.

 I handle storing dates in the db a little differently than you, but if
 you know what you're doing don't worry about changing that part.
 I usually store dates in the db in utc format (I think you can
 configure this in environment.rb from memory), and you can easily set
 the user's timezone in a filter in application controller
 Time.zone = user.time_zone
 which will handle all of the conversions for you.

 Cheers,
 Jeremy

 On May 12, 10:57 am, Randall callmenanner...@gmail.com wrote:



  Seems like there should be an easy solution to this problem, yet I
  can't seem to find one.

  Here is the issue:
  How do you assign a time zone to a Time object that results from a
  parsed date/time string?

  Example:
  - I receive a date time string from a date picker widget that does not
  include time zone info (i.e. Mon May 11 18:24:37 2009).
  - Time zone for this date is known and may be different than what's
  local to the user
  - date/time is stored in the DB as unix time (i.e. 1242075962)
  - time zone is stored in the DB in tz format i(i.e. 'America/
  New_York')
  - I would like to be able to take a given date with its known time
  zone and calculate the equivalent unix time value.

   now = Time.now

  = Mon May 11 18:24:37 -0400 2009 now.to_i

  = 1242080677

   parsed = DateTime.parse(Mon May 11 18:24:37 2009)

  = Mon, 11 May 2009 18:24:37 + parsed.to_time

  = Mon May 11 18:24:37 UTC 2009 parsed.to_time.to_i
  = 1242066277
   Time.at 1242066277

  = Mon May 11 14:24:37 -0400 2009

  It seems there should be a way to append the time zone to the string
  before it is parsed or to associate the parsed time with a time zone
  (without converting the time to the zone), however I can't seem to
  find an answer.

  Any help would be greatly appreciated
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Cucumber + Selenium: Programmatically Starting a Test Server

2009-05-13 Thread Aaron Carlton

Hi All,

I am trying to learn BDD using the Cucumber framework, and am
integrating Selenium for client side tests.  I've been playing with
refactoring my cucumber installation a bit, and have pulled the code
to start the selenium server out into a profile-configuration file,
similar to env.rb:

# start selenium
server
@@browser = Selenium::SeleniumDriver.new(localhost, , *chrome,
http://localhost;, 15000)
@@browser.start

# teardown - stop selenium
server
at_exit do
  @@browser.stop
end

I would like to do the same thing to start my rails application test
server that I can run browser tests against, but I've googled and
haven't been able to find a clearcut suggestion.  Does anyone know how
to start/stop a rails server in :test mode via ruby?  Will I have to
resort to system() calls?  Your help and time is appreciated!

Aaron

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: Keep fix data in database table while deploying

2009-05-13 Thread Chris

Hi Freddy,

thanks for the hint, I guess this helps me out. :)

At this point, I only set up the db structure in migrations, no data
at all.
So no data could be transfered to the server...


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] How to kill / abort rails on windows

2009-05-13 Thread guusz

Hi,

I have a number of rails servers running on windows as a single
service (written in C#) and would like to terminate all processes when
the service is stopped.

The windows C# way is to use Process.abort(), but it does not seem to
kill all processes.

Another way is to have a controller method perform a Kernel::exit(1)
or an abort(). These terminate the thread, but do not kill the server,
at least not mongrel or webrick.

Maybe the answer is obvious, but I am not really a windows person.

Any ideas?

Thanks,
Guus.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: Sharing sessions across rails apps 2.3.2

2009-05-13 Thread Frederick Cheung



On May 13, 7:56 pm, Doug Livesey rails-mailing-l...@andreas-s.net
wrote:
 That could well be part of it, but I'm afraid I'm not sure I follow you.
 How would I go about doing that?
 (I didn't need to with my old approach.)

Ah, we may not be talking about the same thing. Are these apps on
different subdomains (eg app1.example.com, app2.example.com),
different domains, or on the same domain (example.com/app1 
example.com/app2) ?

Fred
 Cheers,
    Doug.
 --
 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-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
-~--~~~~--~~--~--~---



[Rails] Canonical Way/Method to Add/Merge Query Parameters onto URL

2009-05-13 Thread Kendall

Hi, I've done some searching but haven't yet found if there is a
correct way to do this.

I have an existing URL (generated, for example, by a call to one of my
named-route's helpers: login_url). I may (or may not) have, as part of
this URL, a query string fragment (?test=true for example) as part
of the URL. I also have 1 (or more) name/value pairs I'd like to add,
as query parameters, to this URL, overwriting existing values if there
is a name collision.

I could write up a method to do this pretty easily. If, however, there
is already rails code and/or a recommended, official, or
canonical way to do this, I'd like to know.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: Sharing sessions across rails apps 2.3.2

2009-05-13 Thread Frederick Cheung



On May 13, 8:56 pm, Doug Livesey rails-mailing-l...@andreas-s.net
wrote:
 They're on the same machine, although I may want to move them at some
 point.

that doesn't quite answer the question - even though they are on the
same machine any of the 3 scenarios I mentioned could be in effect.
What it boils down to in the end is cookies: there is a cookie that
tells rails which row from the sessions table to use and if both apps
aren't getting the same value out of this cookie then although the
sessions are backed by the same table they will appear as different
users.

Fred
 --
 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-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
-~--~~~~--~~--~--~---



[Rails] Re: Canonical Way/Method to Add/Merge Query Parameters onto URL

2009-05-13 Thread Philip Hallstrom

Let's say that your controller gets run with params[:test] = 'true'...

Then in your controller or view you can do:

login_url(params.merge(:test = false, :foo = 'bar'))

and will end up with

/login?test=falsefoo=bar

Look at the merge and reverse_merge methods for more.

-philip



On May 13, 2009, at 1:11 PM, Kendall wrote:


 Hi, I've done some searching but haven't yet found if there is a
 correct way to do this.

 I have an existing URL (generated, for example, by a call to one of my
 named-route's helpers: login_url). I may (or may not) have, as part of
 this URL, a query string fragment (?test=true for example) as part
 of the URL. I also have 1 (or more) name/value pairs I'd like to add,
 as query parameters, to this URL, overwriting existing values if there
 is a name collision.

 I could write up a method to do this pretty easily. If, however, there
 is already rails code and/or a recommended, official, or
 canonical way to do this, I'd like to know.
 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Re: MVC, best practice for hash that combines objects?

2009-05-13 Thread Colin Law
Assuming you are developing in Rails then the convention would be for the
models to be Task and Entry, with the controllers tasks_controller and
entries_controller.

If I have understood the problem correctly I think the first thing I would
do is provide a method in model Task called duration that returns the total
duration for that task by summing task.entries.time.  Then all you need to
pass to the report view is @tasks containing the tasks you are interested in
and for each one task.duration is available to be displayed as desired.

Colin

2009/5/13 arcX arc...@gmail.com


 Hi,

 I just wanted to see if I am on the right track, as I am new to MVC.

 I have a model called Tasks, and another called Entries. Tasks has
 many entries.

 Each entry has a time. So I want to total up the time entries so that
 I have a keyed array of task Ids = duration.

 In the end, I want to then print it out as a table in the reports
 view, doing things like filter by completed, by date, etc.

 Where should this hash be constructed? A function in a Report model?

 Thanks!
 arcX

 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Rails] Setting flash notice via javascript?

2009-05-13 Thread nextpulse

I am using a javascript to redirect to another action. Is there a way
to set the flash [:notice] in the javascript?

So when the javascript redirects, the new action/view picks up the
flash[:notice]?

(I suspect I may have to do something like url?notice=.)

ideas?

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-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
-~--~~~~--~~--~--~---



[Rails] Re: dynamic table names for AR models

2009-05-13 Thread E. Litwin

Also, that view would not be updatable (updateable?)
Not sure if that is a requirement but something to be aware of.

On May 13, 11:46 am, Pete Hodgson rails-mailing-l...@andreas-s.net
wrote:
 Marnen Laibow-Koser wrote:

  Why not create a wheels view which combines the data from all the
  wheels_for_* tables, then tie your Wheel model to that?

  Best,
  --
  Marnen Laibow-Koser
 http://www.marnen.org
  mar...@marnen.org

 I think that would have some performance issues. If there were 20
 tables, but only 1 of them contained wheels for the car I was working on
 then all 20 tables would have to be checked during a join, no?
 --
 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-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
-~--~~~~--~~--~--~---



[Rails] Re: Canonical Way/Method to Add/Merge Query Parameters onto URL

2009-05-13 Thread Kendall

Thanks. Very helpful!

On May 13, 2:23 pm, Philip Hallstrom phi...@pjkh.com wrote:
 Let's say that your controller gets run with params[:test] = 'true'...

 Then in your controller or view you can do:

 login_url(params.merge(:test = false, :foo = 'bar'))

 and will end up with

 /login?test=falsefoo=bar

 Look at the merge and reverse_merge methods for more.

 -philip

 On May 13, 2009, at 1:11 PM,Kendallwrote:



  Hi, I've done some searching but haven't yet found if there is a
  correct way to do this.

  I have an existing URL (generated, for example, by a call to one of my
  named-route's helpers: login_url). I may (or may not) have, as part of
  this URL, a query string fragment (?test=true for example) as part
  of the URL. I also have 1 (or more) name/value pairs I'd like to add,
  as query parameters, to this URL, overwriting existing values if there
  is a name collision.

  I could write up a method to do this pretty easily. If, however, there
  is already rails code and/or a recommended, official, or
  canonical way to do this, I'd like to know.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



  1   2   >