[Rails] Re: Use of global variables...

2009-05-23 Thread Marnen Laibow-Koser

Mk 27 wrote:
> Marnen Laibow-Koser wrote:
> 
>> In this case, you should probably be using a local or @instance variable 
>> in the controller.
> 
> *There is no way to do that in rails*.  

Well, if you're so sure of that, why are you asking for help? :)

> The database I am working with 
> is not modifiable via the interface (there is no new or create method).

That is irrelevant.

> I would use an instance variable (populated by the list method), but 
> when I call another method referencing this variable, it is no longer 
> populated:

[...]
> Any suggestions?

Do I understand correctly that you'd like to cache a database query in 
the controller between requests?  If so, perhaps a @@class variable is 
the way to go here.  Or maybe Rails' built-in caching would do what you 
need.

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: Use of global variables...

2009-05-23 Thread Marnen Laibow-Koser

Mk 27 wrote:
[...]
> After all, if globals were *that* bad, I presume
> 
> $global
> 
> a syntax for them should not exist either?

Don't presume that.  Just because a language feature exists doesn't mean 
it's a good idea to use it.

(Globals have their uses in short scripts.  But...really...don't ever 
use them in an app of any complexity, or *your* code will be the 
dysfunctional part.)

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: how to pass parameters with remote_function

2009-05-23 Thread Mike Rose

Note: remove the where in the string, I was typing a bit too quickly
and that does not belong.

I should have said my preferred practice as well. But glad everything
worked out.

On May 23, 5:06 pm, Marnen Laibow-Koser  wrote:
> Mike Rose wrote:
> >> @albums=Album.find(:all, :conditions => [:artist_id =>
> >> params[:find_id]])
>
> > Good practice for it to read like this
>
> > @albums = Album.find(:all, :conditions => "where artist_id = '#{params
> > [:find_id}'")
>
> Nope.  Your "good practice" is in fact more typing and more literal SQL
> for what as far as I can see is no good reason at all.  Take advantage
> of Rails' syntactic sugar and stick with the first version.
>
> 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: sql Rand() returns same result

2009-05-23 Thread E. Litwin

First of all, I'm assuming you are calling rand() (lowercase).
rand() returns a value less than between 0 and 1.
Using this as the call to :order tells the database to use the column
reference (rather than a name).
In MySQL, if you pass a non-integer column value, it gets ignored.
(Not sure how other databases handle it).

I don't really understand what you are trying to randomize in your
order parameter.
You should probably get the count of the records in your table and
generate a random number between 1 and that count. Then use offset to
select that record.


On May 23, 10:35 am, jg  wrote:
> I have a method that calls Model.find(:first, :order => "RAND()")
> twice. I want it to return two different results but it always returns
> the same thing twice. Is there some kind of sql caching at work here?
> If so, can I disable for this method?
>
> thanks!
>
> Jason
--~--~-~--~~~---~--~~
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: opening database prompt based on database.yml

2009-05-23 Thread Stephan Wehner

Stephan Wehner wrote:
> Frederick Cheung wrote:
>> On May 17, 3:13�pm, Stephan Wehner 
>> wrote:
>>> Rails projects, each possibly having different migrations which are
>>> applied to different (mysql) databases.
>>>
>>> Opening a (mysql) prompt would require looking up the name of the
>>> database, and more -- which a script can do faster than me.
>>>
>> 
>> Don't want to piss on anyone's parade but Rails comes with a script
>> that does that eg
>> 
>> ruby script/dbconsole production
> 
> It looks to me that script/dbconsole doesn't hide the password for mysql 
> and postgresql on all platforms -- whereas rdb_prompt takes care of that 
> (for postgresql trivially by not supporting passwords).
> 
> So I'll put a patch together.

The patch is attached to this new ticket

 https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2707

Please review.

Stephan

-- 
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] Stoobie Noobie Roobie version ques tions redux …

2009-05-23 Thread Simon Whelan
‘Fossil fuels are
for facile fools …’. 
 
As  Dr. Nick of the Simpsons Sez : 
Hi Everybody ! 
A couple of months ago (actually, around March 12th I asked
a bunch of questions about what were the then most current versions of Ruby,
Ruby on Rails and ancillary tools that are intended to work with Ruby and Ruby
on Rails.
Unfortunately, I was unable to begin my 1st Rails project
at that time as other areas of my life demanded my immediate attention (among
other things, I buy and sell gold, silver, platinum & palladium bullion. In
case you haven’t noticed the US dollar has most likely begun its terminal swan
dive into that dark, necrotic night of All-American fiduciary oblivion and,
consequently both gold & silver are poised to shortly go through the roof).
So, once again, I’m about to start my 1st Ruby on Rails (Rails)
development project. 
But before I start asking a whole bunch of new questions I’d like to
belatedly thank everyone who responded to my last series of questions.
Specifically, I’d like to thank :
•
Frederick Cheung of Cambridge
•
Adam Fields
•
Scott Trudeau
•
Michael Nutt
•
Jonathan S. Katz
•
Dean Holdren
I’d like to thank you one and all for taking the time to reply to my
questions. 
I’d also like to apologize to you one and all for taking so long to
get back to you and acknowledge your kindness and consideration in replying to
my questions.
It’s been 2 months since I asked my questions (and, I might add, got
your very helpful and informative responses) so I figure, given that things
seem to be moving fairly rapidly forward in the Ruby and the Ruby on Rails
world, I need to ask the same set of questions again.
But, this time I’ll incorporate the helpful information the above
mentioned folks supplied me the last time I asked this set of questions.
So, enough with all the preliminary blather and palaver, and let’s
move on to the questions.
The development platform I’ll be using is a Mac running 10.5 (i.e. :
“Leopard”). 
So, here was the 1st question :
1. What is the most recent, stable version of Ruby ? 
According to my set of respondents, as of the middle of March (beware
the Ides of March, noble Caesar) the most current version of Ruby was :
Ruby
– 1.9.1 .
Is this still true or has 1.9.1 been supplanted by a more recent
version ?
 
And, the next question :
1. What is the most recent, stable version of Ruby on Rails ? 
As of March 15th,
the most stable recent version of Rails was 2.2.2 although 2.3 was expected
imminently.
Is this still true
?
 
And 3 :
1. Do the 2 versions work together comfortably or are there 

compatibility issues that I need to be aware of ? 
Back then the
answer was :
Ruby 1.8.7 works
with Rails 2.2.2 and Ruby 1.9.1 works with Rails 2.3 .
Is this still true
or has the situation changed yet again ?
 
And 4 :
1. What is the best version of MySQL I should be using bearing in mind 
the answers to questions 1,2 & 3 above ? 
The consensus was
that either MySQL 5.0.x or 5.1.x would work although both versions have some
issues but the issues in each case are not precisely the same.
Has this situation changed
since the middle of March ?
 
And 5.
1. What Application Server would you recommend I use for this project ?
Different people
had different preferences. Among those mentioned were :
 
  • Mongrel
  • thin
  • Apache with
Passenger (aka mod Rails)
  • mod rails
So, I guess my
question here is has anyone’s suggestions/preferences regarding which 
application
server they prefer changed ? Are there any new ones that you might feel are
better or easier to work with  than
the ones mentioned above?
 
And 6 :
1. What source code editor do you recommend I use ? By the way, I’ve 

been using TextWrangler from Bare Bones Software (version 2.2.1 (186 - 
20070214) and I’ve been pretty happy with it. 
Most people here seemed to be pretty happy with
TextMate.
Myself, I’m using TextWrangler, mainly because I’m pretty short on
cash these days.  I should also
mention that it’s pretty good. And, the price (i.e. : free) sure can’t be beat,
unless you started giving me money.
And, finally, I have an additional question.
I’m working on a Macintosh running Leopard (i.e. : Mac OSX 10.5.7).
This means that I’ve got to install a whole bunch of stuff
on my machine. And, what’s more I have to make sure that all the versions of
each one of these tools is the correct one and can work together with all the
other pieces of the development environment.
The folks that sent me advice and suggestions included 2 separate
suggestions on the best way to go about installing all this stuff.
One guy wrote and suggested that I use the Hive Logic article. In case
you’re wondering that’s the article entitled :
Installing Ruby, Rubygems,
Rails, and Mongrel on Mac OS X 10.5 (Leopard)
The earl for that article is :
http://hivelogic.com/articles/view/ruby-rails-leopar

[Rails] Re: Use of global variables...

2009-05-23 Thread Mk 27

Marnen Laibow-Koser wrote:

> In this case, you should probably be using a local or @instance variable 
> in the controller.

*There is no way to do that in rails*.  The database I am working with 
is not modifiable via the interface (there is no new or create method). 
I would use an instance variable (populated by the list method), but 
when I call another method referencing this variable, it is no longer 
populated:

class SomeController
  def list
  @array = Some.find(:all)
  end
  def another_method
  [don't bother referring to @array, it is empty]
  end
end

Since there are actually a variety of methods here that could have been 
responsible for the last @array, I cannot simply repeat the block in 
list and hope that @array will be what is it currently is/was when last 
applied in  a view.

Any suggestions?
-- 
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: Use of global variables...

2009-05-23 Thread Mk 27

Marnen Laibow-Koser wrote:

> Don't ever do that.  Forget that globals exist.  They cause problems 
> with maintainability and (I think) concurrency.

Yes, that is the CS Doctrine, and generally I agree.

However, it seems dysfunctional to me that it would not be possible (I 
promise you will never be asked to maintain my project ;).  This could 
be some kind of ruby object issue, I am as new to that as I am to rails.

After all, if globals were *that* bad, I presume

$global

a syntax for them should not exist either?

-- 
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: Use of global variables...

2009-05-23 Thread Marnen Laibow-Koser

Mk 27 wrote:
> I am using a global array to accumulate controller output as it is added
> to the display, eg, when the user adds more items to a list, I add them
> to the global.

Don't ever do that.  Forget that globals exist.  They cause problems 
with maintainability and (I think) concurrency.

In this case, you should probably be using a local or @instance variable 
in the controller.

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] Use of global variables...

2009-05-23 Thread Mk 27

I am using a global array to accumulate controller output as it is added
to the display, eg, when the user adds more items to a list, I add them
to the global.

However, something strange is going on when I then try and use that
global array in a controller method.  In a nutshell:

@selected = Array.new
$shown.each { |thing| puts "->#{thing}<-"; @selected.push thing; }

@selected is the array I want to produce (for simplicity, in the example
here it should be identical to $shown).  When this runs, the puts
statement output is correct, and .each iterates thru the array.

But debugging with the next line:

@selected.each { |x| puts "XXX:"+x }

@selected is nil; it is not even an Array now!  There is output from
WEBrick mentioning an "authenticity_token", altho it doesn't appear to
be an error and I don't know if it is relevent, I have not been using
this for long:

Processing MainController#bysize (for 127.0.0.1 at 2009-05-23 20:36:27)
[POST]
  Parameters: {"authenticity_token"=>"5KvBJEMB3I

Anyone know why, and if there is a work around?
-- 
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: how to pass parameters with remote_function

2009-05-23 Thread Marnen Laibow-Koser

Mike Rose wrote:
>> @albums=Album.find(:all, :conditions => [:artist_id =>
>> params[:find_id]])
> 
> Good practice for it to read like this
> 
> @albums = Album.find(:all, :conditions => "where artist_id = '#{params
> [:find_id}'")

Nope.  Your "good practice" is in fact more typing and more literal SQL 
for what as far as I can see is no good reason at all.  Take advantage 
of Rails' syntactic sugar and stick with the first version.

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] Searching/Sorting an Array of Hashes

2009-05-23 Thread Robert Scott

I have an array of hashes that contains several fields, including
first_name and last_name. Unfortunately, since its the result of an API
call, I have no other ways to work with it. Regardless, I'm trying to
build a basic search function where a user can enter a name and it will
display the results from a newly created array.

I'm guessing that sort_by will be the best route to go, but I've been
unsuccessful in finding out how to use it with multiple fields. Any
guesses?

The second part to the question is how you structure the sort_by, if
that is the best way, to find objects that are similar to the requested
query. It's not so much that a user would mispell a name (although that
would be helpful) but if they put in a firstname + lastname pair, it
wouldn't technically match with either field on its own.

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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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: [ANN] Looking for more guinea pigs, new icalendar gem

2009-05-23 Thread Rick DeNatale

On Sat, May 23, 2009 at 7:23 PM, Rick DeNatale  wrote:
> I recently made the new icalendar library for Ruby which I've been
> working on for the past six months available on github

I should have mentioned this in the first post, but another design
goal of ri_cal is to work well with the time zone support in Rails >
2.2, but not to require it.

It does need an implementation of tzinfo, but is happy to use either
the tzinfo gem or the implementation in ActiveSupport, the application
is free to satisfy the requirement by requiring one or the other
before requiring ri_cal.

-- 
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

--~--~-~--~~~---~--~~
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: how to pass parameters with remote_function

2009-05-23 Thread Mk 27

Mike Rose wrote:

> and let me know if that solved the issue. It's really bad/wasteful to
> pull down all of your artists. Also, shorthand

Yeah, that is what I meant by "long winded".

*Why is there this issue with the name of a local, temporary variable?*
If the scope is only a few lines, I might as well call it "x" (which is 
why I think tmp is *unambiguous*: it indicates this variable is just 
that, and nothing more than that)...Is this just the normal "pick 
informative names" caveat, or is there more to it?  Rails is slightly 
scary...

Your "where =" line did not work -- I may have mistyped it, but this 
seems to do:

@albums = Album.find(:all, :conditions => { :artist_id => 
params[:find_id].to_i })


Most of all: Your help is much appreciated dude, THANKS!

ps.  If you have a minute, here's a little question about what I am 
about to try: I have a list on one side with all the artists.  A click 
on a list entry will put all the artist's albums in a div box on the 
other side.  Now, I want to add a menu up top with entries like "Sort 
albums by size", but I want that to apply only to the albums that are 
currently displayed.  I don't want to produce the list again and sort it 
(since I have some more complicated plans, like allowing the user to 
build a custom list in the div box); I want to try and keep a global 
variable ($shown) and process that back in the album controller. 
Hopefully this is possible -- any related tips brought to mind?




-- 
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] Looking for more guinea pigs, new icalendar gem

2009-05-23 Thread Rick DeNatale

I recently made the new icalendar library for Ruby which I've been
working on for the past six months available on github

http://github.com/rubyredrick/ri_cal/tree/master

I plan to also put this on rubyforge (the project has been created
already), but I want it to get a little more grilling from users
before really pushing it out into the world, and I figure that github
users might be a little more willing and understanding to work with
slightly less mature code.

This is a completely new library, it's based on neither the icalendar
nor vpim gems, which both do a very good job of parsing icalendar
data, but don't try to do things like understanding icalendar time
zones and recurring events.  In ri_cal, I took those tasks as the main
goals.

I've made some low-key announcements about ri_cal on my blog:

http://talklikeaduck.denhaven2.com/tag/rical

It's gotten some interest, there are currently 79 folks watching it on
github.  But I'd like some more bug reports!

There is a google group for discussion at
http://groups.google.com/group/rical_gem  anyone is welcome to join.
I've set it up so that initial postings are moderated to avoid it
becoming a spam trap.

There is also a lighthouse project for bug tickets:
http://rick_denatale.lighthouseapp.com/projects/30941-ri_cal/overview

-- 
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

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

2009-05-23 Thread Maurício Linhares

Which box?

It it's meant to be readonly, why don't you just "show" it instead of
using a form field tag?

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



On Sat, May 23, 2009 at 1:37 PM, omar  wrote:
>
> I have a readonly field in a form. Is there a way not to show the box
> around that field?
> Thanks for your help
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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] forms

2009-05-23 Thread omar

I have a readonly field in a form. Is there a way not to show the box
around that field?
Thanks for your help


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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: Pair Programming (WAS: Have opening for ROR engineers)

2009-05-23 Thread Mike Rose

I fully agree with WJS. There are different expectations in pairing,
between developers and non-developers. My post was related to
developer pairing, but I find it helpful to have a marketing guy next
to me at times (like when working on an Interface that I am not
familiar with).

Also, one of the reasons I love Ruby is how readable the code is if
you follow the conventions. Same for rails, since it builds off of
Ruby. Naming conventions in this framework have made the quality of
code so much better and it is amazing to see a community of RoR
developers tightly bound to following conventions. Cheers.

On May 23, 2:15 pm, WJSimacek  wrote:
> On May 23, 2:32 pm, Mike Rose  wrote:
>
>
>
> > Statistics on this may be quite variable as I know of a few companies
> > local to me that are on and off with pair programming. I have done
> > pair programming at one job and seen it very successful at a friends
> > job. I use it when I teach RoR workshops, and I find it is quite
> > helpful but does present some requirements: a base line of education
> > and problem solving abilities.
>
> > Overall I think it is a far superior way to develop software
> > (especially web software) because I do believe more heads yield better
> > code. But again, it requires those heads to have that base line
> > education (a B.S. in Computer Science... or some other marker for a
> > starting place) otherwise you will end up with a Sr. developer and a
> > Jr. developer who never achieve one of the most beneficial goals of
> > PP-- shared wisdom and an increase in skill. If the individuals in the
> > pair are too far apart one will get left behind or one could
> > potentially feel frustrated far too often.
>
> I'd like to weigh into this one, even though it may be straying a
> little off topic for a Ruby on Rails group, as I believe pair-
> programming benefits always far outweigh any frustrations. Even with a
> non-developer project manager background, I've paired with my
> developers on small projects and have been able to add value and keep
> the code flowing. The values I may add, such as SQL knowledge or just
> spelling consistency, formatting, etc. really help, not to mention
> just plain brainstorming an idea as to an approach to get it something
> that is "stuck" moving forward.
>
> In fact, geniuses like Martin Fowler have written that really good
> code is readable by anyone, without much commenting.
> --my $.02 --Wayne
>
>
>
> > I've tried working with people far above me, far below me, and right
> > around the same grounds. Really is fascinating what you can teach/
> > learn from pairing though.
>
> > On May 23, 8:32 am, Hassan Schroeder 
> > wrote:
>
> > > On Sat, May 23, 2009 at 7:42 AM, Phlip  wrote:
> > > > (Y'all _do_ practice Pair Programming, don't you??)
>
> > > Nope. Never had the opportunity.  You?  :-)
>
> > > It's an interesting idea, with at least one major practical drawback,
> > > but I wonder what percentage of Rails development is *actually*
> > > being done in a Pair Programming environment.
>
> > > --
> > > Hassan Schroeder  hassan.schroe...@gmail.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: how to pass parameters with remote_function

2009-05-23 Thread Mike Rose

Furthermore, naming conventions in rails/ruby say you should not have
a variable called tmp, temp, temporary, or any of that ambiguous
naming.

Also, now that you know you should be casting to_i from params, try
using the original method I suggested

@albums = Album.find(:all, :conditions => "where artist_id = '#{params
[:find_id].to_i}'")

and let me know if that solved the issue. It's really bad/wasteful to
pull down all of your artists. Also, shorthand

@collection = Model.find(:all) is the same as @collection = Model.all

likewise, you can do Model.first and Model.last to get the first and
low entry of a table!

Good luck.

On May 23, 1:24 pm, Mk 27  wrote:
> Hassan Schroeder wrote:
> > Nope, nothing to do with Ruby -- HTTP request parameters are
> > *always* strings.
>
> That makes sense.
>
> Thanks much everyone!
>
> --
> 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: Pair Programming (WAS: Have opening for ROR engineers)

2009-05-23 Thread WJSimacek



On May 23, 2:32 pm, Mike Rose  wrote:
> Statistics on this may be quite variable as I know of a few companies
> local to me that are on and off with pair programming. I have done
> pair programming at one job and seen it very successful at a friends
> job. I use it when I teach RoR workshops, and I find it is quite
> helpful but does present some requirements: a base line of education
> and problem solving abilities.
>
> Overall I think it is a far superior way to develop software
> (especially web software) because I do believe more heads yield better
> code. But again, it requires those heads to have that base line
> education (a B.S. in Computer Science... or some other marker for a
> starting place) otherwise you will end up with a Sr. developer and a
> Jr. developer who never achieve one of the most beneficial goals of
> PP-- shared wisdom and an increase in skill. If the individuals in the
> pair are too far apart one will get left behind or one could
> potentially feel frustrated far too often.

I'd like to weigh into this one, even though it may be straying a
little off topic for a Ruby on Rails group, as I believe pair-
programming benefits always far outweigh any frustrations. Even with a
non-developer project manager background, I've paired with my
developers on small projects and have been able to add value and keep
the code flowing. The values I may add, such as SQL knowledge or just
spelling consistency, formatting, etc. really help, not to mention
just plain brainstorming an idea as to an approach to get it something
that is "stuck" moving forward.

In fact, geniuses like Martin Fowler have written that really good
code is readable by anyone, without much commenting.
--my $.02 --Wayne

>
> I've tried working with people far above me, far below me, and right
> around the same grounds. Really is fascinating what you can teach/
> learn from pairing though.
>
> On May 23, 8:32 am, Hassan Schroeder 
> wrote:
>
> > On Sat, May 23, 2009 at 7:42 AM, Phlip  wrote:
> > > (Y'all _do_ practice Pair Programming, don't you??)
>
> > Nope. Never had the opportunity.  You?  :-)
>
> > It's an interesting idea, with at least one major practical drawback,
> > but I wonder what percentage of Rails development is *actually*
> > being done in a Pair Programming environment.
>
> > --
> > Hassan Schroeder  hassan.schroe...@gmail.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: could not find activerecord-sqlserver-adapter locally or

2009-05-23 Thread Stephen Anderson

Milan Jaric wrote:
> Dejan Dimic wrote:
>> Use
>> 
>> gem install activerecord-sqlserver-adapter --source=http://
>> gems.rubyonrails.org
> 
> http://gems.rubyonrails.org
> 
> Forbidden
> 
> any sugestions?

It appears that browser connections are forbidden.  The gem install 
command works fine.
-- 
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: Is there any collabrative community content managemnt product available in ruby On Rails?

2009-05-23 Thread Walter McGinnis

Hi,

We just released Kete 1.2. It has many of the more advanced module  
features built in that you might find in those platforms. It is  
squarely aimed at community collaboration on content.

Check out Kete at http://kete.net.nz/ or http:// 
horowhenua.kete.net.nz/ for an example.



On May 23, 2009, at 7:30 PM, gundestrup  wrote:

>
> what about insoshi?
> http://github.com/insoshi/insoshi/tree/master
>
> On May 23, 8:41 am, Marnen Laibow-Koser  s.net> wrote:
>> Phlip wrote:
>>
>> [...]
>>
>>> I just started with Community Engine, but it has shown no signs of
>>> sucking yet...
>>
>> Good to know.  There's also lovdby-less and (if you want to go that
>> route) Ning
>>
>> Adva-cms is a promising newcomer -- might be worth a look once it
>> matures a bit
>>
>>
>>
>>> --
>>>Phlip
>>
>> 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: Is there any collabrative community content managemnt product available in ruby On Rails?

2009-05-23 Thread Sazima

Guys,

I did some research 2 weeks ago (interesting links: 
http://www.rubymatters.com/ruby-cms/
& http://www.ajaxlines.com/ajax/stuff/article/top_ruby_cms.php) and
found some options worth giving a try:

- http://www.browsercms.org/
- http://radiantcms.org/
- http://rubricks.org/index_en.html

Cheers, Sazima


On May 23, 4:30 am, gundestrup  wrote:
> what about insoshi?http://github.com/insoshi/insoshi/tree/master
>
> On May 23, 8:41 am, Marnen Laibow-Koser 
> s.net> wrote:
> > Phlip wrote:
>
> > [...]
>
> > > I just started with Community Engine, but it has shown no signs of
> > > sucking yet...
>
> > Good to know.  There's also lovdby-less and (if you want to go that
> > route) Ning
>
> > Adva-cms is a promising newcomer -- might be worth a look once it
> > matures a bit
>
> > > --
> > >    Phlip
>
> > 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: how to pass parameters with remote_function

2009-05-23 Thread Mk 27

Hassan Schroeder wrote:

> Nope, nothing to do with Ruby -- HTTP request parameters are
> *always* strings.

That makes sense.

Thanks much everyone!

-- 
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: Methodology question

2009-05-23 Thread Mk 27

Mike Rose wrote:
> [quote]:action => "atwo/list"[/quote]
> 
> that should should :controller => 'atwo', :action => 'list'
> 
> -Mike

Thanks!
-- 
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: problem with fetching of data.

2009-05-23 Thread Hassan Schroeder

On Sat, May 23, 2009 at 12:49 PM, Santosh Turamari
 wrote:

>  Thanks for the reply.. Here my main problem is I want to have only
> space between two words. Here if I use only company.downcase.strip, then
> it is taking '+'sign such as "abc+xyz".. I want it to be"abc xyz". Can I
> get the condition to produce the output of that kind.!

Look at your gsub; if you want a space instead of '-', it should be
pretty obvious what to do :-)

Open up irb and play with it a bit until you get the result you want:

irb(main):001:0> ("abc
xyz".gsub(/[^[:alnum:]'&''.''!']/,'-')).squeeze("-").chomp("-")
=> "abc-xyz"

-- 
Hassan Schroeder  hassan.schroe...@gmail.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: Methodology question

2009-05-23 Thread Colin Law
2009/5/23 Mike Rose 

>
> [quote]:action => "atwo/list"[/quote]
>
> that should should :controller => 'atwo', :action => 'list'
>
> -Mike
> On May 23, 11:01 am, Mk 27  wrote:
> > Colin Law wrote:
> > > Not sure I follow you here, you can certainly link to a different
> > > controller
> > > from a view, what is that you are trying to do?
> >
> > > Colin
> >
> > That is what I am trying to do, perhaps this is a syntax problem.
> >
> > If I have three controllers under app/, "aone", "atwo", "athree", all of
> > them have a method "list", in the view for aone I want to call the list
> > method from atwo, so I tried
> >
> > :action => "atwo/list"
> >
> > This is a no go -- what's the proper syntax?
> >
> > Also (another sort of related syntax question), how can I use a
> > parameter with the methods?  Here's a line which works in a view:
> >
> >  > => { :action => "list_albums" }) %>">
> >
> > and here is one which returns "undefined local variable or method
> > `url'", the only difference being I tried to pass a parameter via the
> > action
>

There is a clue in the error message that says that it does not like url.
The reason is that it should be :url.  I don't know whether the rest of it
is correct or not.

Colin


>
> >
> >  > => { :action => "list_albums(#{artist.id})" }) %>">
> > ^ oh no!
> >
> > I tried this a few different ways and am about to try a few more ;) Is
> > it just the quoting, or what?
> >
> > --
> > 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: how to pass parameters with remote_function

2009-05-23 Thread Hassan Schroeder

On Sat, May 23, 2009 at 1:01 PM, Mk 27  wrote:

> ->67 != 67
>
> WHAT THE HECK?  I'm new to ruby, this seems an odd feature...I would
> guess this is about data types??!!?  Both numbers are sourced from an
> sqlite INTEGER.

Nope, nothing to do with Ruby -- HTTP request parameters are
*always* strings.

If you need to compare to an integer, use params[:whatever].to_i

-- 
Hassan Schroeder  hassan.schroe...@gmail.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: how to pass parameters with remote_function

2009-05-23 Thread Mk 27

Hmmm, I seem to be uncovering a more basic layer to my miscomprehension.
Thanks people, I think your input will come in handy, but bear with me 
for a minute:

Here's where I got to in trying to debug (just noticed stdout in the 
controller is the server stdout, handy).  Hence its long winded style:

[in controller method]
all=Album.find(:all)
@albums = Array.new
tmp=params[:find_id]
all.each { |rec|
  if rec.artist_id == tmp
@albums.push rec
  else puts "->#{rec.artist_id} != #{tmp}"
  end
}

Now, what I find mind boggling is some of the output:

->67 != 67
->67 != 67
->67 != 67
->67 != 67
->67 != 67
->67 != 67
->67 != 67

WHAT THE HECK?  I'm new to ruby, this seems an odd feature...I would 
guess this is about data types??!!?  Both numbers are sourced from an 
sqlite INTEGER.
-- 
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: problem with fetching of data.

2009-05-23 Thread Santosh Turamari

Hassan Schroeder wrote:
> On Sat, May 23, 2009 at 11:09 AM, Santosh Turamari
>  wrote:
> 
>> I am using this code.
>> In application_helper
>>
>> return url_for :only_path => false,:controller => 'community', :action
>> => 'search_route',:company =>((company.downcase.strip.squeeze("
>> ")).gsub(/[^[:alnum:]'&''.''!']/,'-')).squeeze("-").chomp("-"), :id =>
>> id
> 
> Uh, you're telling it to substitute a '-' for white-space in the name; 
> if
> that's not what you want, don't do it :-)
> 
> --
> Hassan Schroeder  hassan.schroe...@gmail.com


Hi,
  Thanks for the reply.. Here my main problem is I want to have only 
space between two words. Here if I use only company.downcase.strip, then 
it is taking '+'sign such as "abc+xyz".. I want it to be"abc xyz". Can I 
get the condition to produce the output of that kind.!
-- 
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: uninitialized constant RenameIssuedCodes error

2009-05-23 Thread Louise Rains

Never mind, I found the problem.  I had an empty migration called 
xxx_rename_issued_codes.rb.  Don't know where it came from, but when I 
deleted it, the migrations worked just fine.

LG
-- 
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] uninitialized constant RenameIssuedCodes error

2009-05-23 Thread Louise Rains

I have a series of migrations which I have used over the last 4 months
without any problems.  I have followed the pattern of deleting and
recreating the tables, doing the migrations and then loading fixtures.
This has all worked successfully until yesterday, when I started to get
an "uninitialized constat" error.

Here's the error and the stack trace:

c:\mick>rake db:migrate --trace
(in c:/mick)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
uninitialized constant RenameIssuedCodes
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependenci
es.rb:278:in `load_missing_constant'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependenci
es.rb:467:in `const_missing'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependenci
es.rb:479:in `const_missing'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/inflector.
rb:283:in `constantize'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/s
tring/inflections.rb:143:in `constantize'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/migration.rb
:456:in `migrations'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_a
dapters/mysql_adapter.rb:15:in `inject'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/migration.rb
:440:in `each'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/migration.rb
:440:in `inject'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/migration.rb
:440:in `migrations'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/migration.rb
:406:in `migrate'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/migration.rb
:357:in `up'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/migration.rb
:340:in `migrate'
c:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/tasks/databases.rake:99
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `call'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `execute'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `each'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `execute'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:578:in
`invoke_with_call_c
hain'
c:/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in
`invoke_with_call_c
hain'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:564:in `invoke'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2019:in
`invoke_task'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in
`top_level'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `each'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in
`top_level'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in
`standard_exceptio
n_handling'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1991:in
`top_level'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1970:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in
`standard_exceptio
n_handling'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1967:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/bin/rake:31
c:/ruby/bin/rake:16:in `load'
c:/ruby/bin/rake:16

I have a model called issued_code.rb which looks like this:

class IssuedCode < ActiveRecord::Base
  belongs_to :CodeRequest
end

The migration 002_create_issued_codes.rb:

class CreateIssuedCodes < ActiveRecord::Migration
  def self.up
create_table :issued_codes do |t|
  t.integer :code_request_id
  t.text :file_text
  t.datetime :date_issued

  t.timestamps
end
  end

  def self.down
drop_table :issued_codes
  end
end

I'm baffled - any ideas on how to fix this?

TIA
LG Rains
-- 
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: how to pass parameters with remote_function

2009-05-23 Thread Mike Rose

> @albums=Album.find(:all, :conditions => [:artist_id =>
> params[:find_id]])

Good practice for it to read like this

@albums = Album.find(:all, :conditions => "where artist_id = '#{params
[:find_id}'")

On May 23, 12:34 pm, Mk 27  wrote:
> Okay, I got the WEBbrick output to agree with me.  Here's the line in
> the controller now, which is still wrong:
>
> @albums=Album.find(:all, :conditions => [:artist_id =>
> params[:find_id]])
>
> NoMethodError in MainController#list_albums
> undefined method `%' for {:artist_id=>"67"}:Hash
>
> --
> 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: how to pass parameters with remote_function

2009-05-23 Thread Mike Rose

Well, to be honest your first post looks correct by inspection. If you
are just posting the id though you do not necessarily need to
use :with. You can group all the items you want within the :url block.

Also, by saying 'throw', I mean that in your action in the controller
have 'throw params' as the first line and then when you try to access
that action it will output, to the screen, a trace that shows you what
parameters are coming across from the view. Very helpful. You can keep
throwing until you get the correct params coming across and then focus
on fixing or writing your action code.

On May 23, 12:28 pm, Mk 27  wrote:
> Mike Rose wrote:
> > First off, have you 'thrown' the params hash that you get in the
> > controller?
>
> > You can paste it back here if this did not help you solve your
> > problem.
>
> > -Mike
>
> Where, like "out the window"? ;)  I do not understand what you mean by
> thrown.
>
> Here's something (else) strange (to me):  I am trying to work this out
> now with link_remote, since that's simpler until I get the nitty gritty.
>
> <%=link_to artist.name, :action => "list_albums", :find_id =>
> artist.id %>
>
> I notice that WEBbrick output sez:
>
> Parameters: {"artist_id"=>"65"}
>
> Shouldn't this be passed as "find_id"  I guess I could have this
> backward, will test.  Maybe I'll also try to log output to a file in the
> controller, if rails will allow me to debug that way...
>
> Anyway, really the best thing for me would be an example paralleling the
> OP request.
> --
> 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: how to pass parameters with remote_function

2009-05-23 Thread Mk 27

Okay, I got the WEBbrick output to agree with me.  Here's the line in 
the controller now, which is still wrong:

@albums=Album.find(:all, :conditions => [:artist_id => 
params[:find_id]])

NoMethodError in MainController#list_albums
undefined method `%' for {:artist_id=>"67"}:Hash

-- 
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: Pair Programming (WAS: Have opening for ROR engineers)

2009-05-23 Thread Mike Rose

Statistics on this may be quite variable as I know of a few companies
local to me that are on and off with pair programming. I have done
pair programming at one job and seen it very successful at a friends
job. I use it when I teach RoR workshops, and I find it is quite
helpful but does present some requirements: a base line of education
and problem solving abilities.

Overall I think it is a far superior way to develop software
(especially web software) because I do believe more heads yield better
code. But again, it requires those heads to have that base line
education (a B.S. in Computer Science... or some other marker for a
starting place) otherwise you will end up with a Sr. developer and a
Jr. developer who never achieve one of the most beneficial goals of
PP-- shared wisdom and an increase in skill. If the individuals in the
pair are too far apart one will get left behind or one could
potentially feel frustrated far too often.

I've tried working with people far above me, far below me, and right
around the same grounds. Really is fascinating what you can teach/
learn from pairing though.

On May 23, 8:32 am, Hassan Schroeder 
wrote:
> On Sat, May 23, 2009 at 7:42 AM, Phlip  wrote:
> > (Y'all _do_ practice Pair Programming, don't you??)
>
> Nope. Never had the opportunity.  You?  :-)
>
> It's an interesting idea, with at least one major practical drawback,
> but I wonder what percentage of Rails development is *actually*
> being done in a Pair Programming environment.
>
> --
> Hassan Schroeder  hassan.schroe...@gmail.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: how to pass parameters with remote_function

2009-05-23 Thread Mk 27

Mike Rose wrote:
> First off, have you 'thrown' the params hash that you get in the
> controller?
> 
> You can paste it back here if this did not help you solve your
> problem.
> 
> -Mike

Where, like "out the window"? ;)  I do not understand what you mean by 
thrown.

Here's something (else) strange (to me):  I am trying to work this out 
now with link_remote, since that's simpler until I get the nitty gritty.

<%=link_to artist.name, :action => "list_albums", :find_id => 
artist.id %>

I notice that WEBbrick output sez:

Parameters: {"artist_id"=>"65"}

Shouldn't this be passed as "find_id"  I guess I could have this 
backward, will test.  Maybe I'll also try to log output to a file in the 
controller, if rails will allow me to debug that way...

Anyway, really the best thing for me would be an example paralleling the 
OP request.
-- 
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: Methodology question

2009-05-23 Thread Mike Rose

[quote]:action => "atwo/list"[/quote]

that should should :controller => 'atwo', :action => 'list'

-Mike
On May 23, 11:01 am, Mk 27  wrote:
> Colin Law wrote:
> > Not sure I follow you here, you can certainly link to a different
> > controller
> > from a view, what is that you are trying to do?
>
> > Colin
>
> That is what I am trying to do, perhaps this is a syntax problem.
>
> If I have three controllers under app/, "aone", "atwo", "athree", all of
> them have a method "list", in the view for aone I want to call the list
> method from atwo, so I tried
>
> :action => "atwo/list"
>
> This is a no go -- what's the proper syntax?
>
> Also (another sort of related syntax question), how can I use a
> parameter with the methods?  Here's a line which works in a view:
>
>  => { :action => "list_albums" }) %>">
>
> and here is one which returns "undefined local variable or method
> `url'", the only difference being I tried to pass a parameter via the
> action
>
>  => { :action => "list_albums(#{artist.id})" }) %>">
>                         ^ oh no!
>
> I tried this a few different ways and am about to try a few more ;) Is
> it just the quoting, or what?
>
> --
> 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: how to pass parameters with remote_function

2009-05-23 Thread Mike Rose

First off, have you 'thrown' the params hash that you get in the
controller?

You can paste it back here if this did not help you solve your
problem.

-Mike

On May 23, 12:01 pm, Mk 27  wrote:
> I cannot find a complete example of this on the web.
>
> Here's what I'm trying to do:  In a view I have a remote_function call
> that right now looks like this:
>
> <% @artists.each do |artist| %>
>    :url => { :action => :list_albums }, :with => "id=#{artist.id}") %>">
>   <%=artist.name%>
> <%end%>
>
> and in the corresponding controller:
>
> def list_albums
>         �...@albums=album.find(params[:id])
>         �...@albu...@albums.sort { |a,b| a.title <=> b.title }
> end
>
> Either or both of these is wrong, since in the end I get a "Can't find
> an album without id".  There is a complicating issue, too, since if I
> change the parameter name, I get "undefined local variable".
>
> Anyone got a quick example of the syntax for what *must* be a very
> common and simple task???
> --
> 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: Two destroy methods with different behavior for the model

2009-05-23 Thread Mike Rose

Denis,

I did this sort of thing with user accounts a while ago.. I had set up
a site that needed to mark users as 'inactive' if they ever decided to
close their account.

Your issue with web crawlers seeing the Move to Trash link makes me
think this page is public and not member-only accessible? If so, I
can't think of any way to tell a spider to not look at particular
parts of the text (maybe there is a way, i've always done a
traditional approach and told the spider to leave my whole page
alone). Either way, on to a possible solution:

The two actions I would have are:
(already in your code) desotry - this action houses the traditional
rails destroy method that will remove the record from the table and
any dependencies.
(need to add) move_to_trash - the new action that will call the
move_to_tash method we will create on the object in view

Explanation:
You should not modify the destroy action and following rails
conventions and good programming practice I would not pass a parameter
into a destroy action and then decide what kind of 'destroy' to
execute. Rather, let's create a second action called move_to_trash
with the same access privileges as the destroy. The reason we do this
is because logically our two actions are doing very different things,
one is destroying a sql record and the other is changing an attribute
on an object.

So we add a move_to_trash method to the model and subsequently we will
want a new column on our model moved_to_trash (boolean). Now the
move_to_trash action will call the model.move_to_trash and then that
method will called a self.update_attribute(:moved_to_trash, true).

[[Alternatively, this is where I like to encourage using enums in your
database and have your model have states. It could be very clean to
have a column "status" and then you
have :moved_to_trash, :inbox, :other_cool_states ]]

Hopefully you find this helpful. If you provide more details about
your particular situation we can work out a solution that fits.

On May 22, 1:54 am, Denis Kokin  wrote:
> Thank you, Frederick.
>
> Can you give me more details? Some sample code would be useful for 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] how to pass parameters with remote_function

2009-05-23 Thread Mk 27

I cannot find a complete example of this on the web.

Here's what I'm trying to do:  In a view I have a remote_function call
that right now looks like this:

<% @artists.each do |artist| %>
   { :action => :list_albums }, :with => "id=#{artist.id}") %>">
  <%=artist.name%>
<%end%>

and in the corresponding controller:

def list_albums
 @albums=Album.find(params[:id])
 @albu...@albums.sort { |a,b| a.title <=> b.title }
end

Either or both of these is wrong, since in the end I get a "Can't find
an album without id".  There is a complicating issue, too, since if I
change the parameter name, I get "undefined local variable".

Anyone got a quick example of the syntax for what *must* be a very
common and simple task???
-- 
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: enforce an application constraint

2009-05-23 Thread Roderick van Domburg

Cathal O'Riordan wrote:
> Could you provide an example of how this would work?

Take a look at :counter_cache at 
http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html.

Wrap everything up in a transaction, fetch the registration count, 
administer the new registration and update the counter cache. Any 
concurrent registrations will be rolled back by the database -- don't 
forget to catch that exception and deal with it.

--
Roderick van Domburg
http://www.nedforce.com
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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: problem with fetching of data.

2009-05-23 Thread Hassan Schroeder

On Sat, May 23, 2009 at 11:09 AM, Santosh Turamari
 wrote:

> I am using this code.
> In application_helper
>
> return url_for :only_path => false,:controller => 'community', :action
> => 'search_route',:company =>((company.downcase.strip.squeeze("
> ")).gsub(/[^[:alnum:]'&''.''!']/,'-')).squeeze("-").chomp("-"), :id =>
> id

Uh, you're telling it to substitute a '-' for white-space in the name; if
that's not what you want, don't do it :-)

-- 
Hassan Schroeder  hassan.schroe...@gmail.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: Methodology question

2009-05-23 Thread Mk 27

Colin Law wrote:

> Not sure I follow you here, you can certainly link to a different 
> controller
> from a view, what is that you are trying to do?
> 
> Colin

That is what I am trying to do, perhaps this is a syntax problem.

If I have three controllers under app/, "aone", "atwo", "athree", all of 
them have a method "list", in the view for aone I want to call the list 
method from atwo, so I tried

:action => "atwo/list"


This is a no go -- what's the proper syntax?

Also (another sort of related syntax question), how can I use a 
parameter with the methods?  Here's a line which works in a view:

 { :action => "list_albums" }) %>">

and here is one which returns "undefined local variable or method 
`url'", the only difference being I tried to pass a parameter via the 
action

 { :action => "list_albums(#{artist.id})" }) %>">
^ oh no!

I tried this a few different ways and am about to try a few more ;) Is 
it just the quoting, or what?

-- 
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: problem with fetching of data.

2009-05-23 Thread Santosh Turamari

Colin Law wrote:
> I think you need to provide more information for us to understand the
> problem (for me to understand it anyway). Can you post the code you are
> using to search for name "abc xyz" which is being turned into a query
> "abc-xyz" as that is very odd.  If you could post an extract from the 
> code,
> an extract from the log showing the query, and the table structure then
> someone may be able to work out what the problem is.
> 
> Colin
> 
> 2009/5/23 Santosh Turamari 

I am using this code.

***
In application_helper

return url_for :only_path => false,:controller => 'community', :action 
=> 'search_route',:company =>((company.downcase.strip.squeeze(" 
")).gsub(/[^[:alnum:]'&''.''!']/,'-')).squeeze("-").chomp("-"), :id => 
id



***
In controller

def search_route
  @query = " "
  if params[:company] != nil and params[:company] != ""
 @query = params[:company].strip
 #...@query = "'\"#...@query}*\"'"

 @community = Community.find_by_name(@query)

 .


here @community is fetching wrong information.
-- 
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] Models, mixins, and acts_as

2009-05-23 Thread Joe Cairns
I'm having a little trouble with a mixin.  Here is the long and short, I am
using a technique I found here:

http://redcorundum.blogspot.com/2006/06/mixing-in-class-methods.html

To be able to mixin class and instance methods in the same module (works
great btw).  I'm using it to make a quick exporter for my models, where I
can just mixin the module for the models where I need it.  Here's the brief
version of the code:

# Class methods are declared in the "define_class_methods" method
> # the export function
> require 'mixin_class_methods'
>
> module Exporter
>
>   mixin_class_methods { |klass|
>   }
>
>   define_class_methods {


> def export(division, columns_to_exclude)
>   rows_to_export.to_csv
> end
>
> def rows_to_export
>   # must export someting declared in the division
>   # ie division.courses division.students
>   division.send(export_object_name)
> end
>
> def export_object_name
>   self.to_s.downcase.pluralize
> end
>
> def export_column_names(columns_to_exclude=nil)
>self.column_names
> end
>   }
>  end



class Course < ActiveRecord::Base
>   include Exporter
>   acts_as_csv_exportable :default, self.export_column_names
> end


When I have it setup like this, it runs as expected.  However, I want to DRY
things up and move all the export functionality into the module.  If I
comment out the  "acts_as_csv_exportable :default,
self.export_column_names"  line and move it to the mixin I get an undefined
method name for "export_column_names".

Anyone have any ideas how to get around this?

--~--~-~--~~~---~--~~
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: Methodology question

2009-05-23 Thread Mk 27

Just to clarify, artist.id would be defined in the context (since the 
text content of the  is artist.name).

I suppose I should order a book on this stuff ASAP...
-- 
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] sql Rand() returns same result

2009-05-23 Thread jg

I have a method that calls Model.find(:first, :order => "RAND()")
twice. I want it to return two different results but it always returns
the same thing twice. Is there some kind of sql caching at work here?
If so, can I disable for this method?

thanks!

Jason
--~--~-~--~~~---~--~~
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: Methodology question

2009-05-23 Thread Colin Law
2009/5/23 Mk 27 

>
> I notice you cannot access another controller method from a view, eg.
>
> :action => "othersec/list"
>
> is no good; the action must belong to the corresponding controller


Not sure I follow you here, you can certainly link to a different controller
from a view, what is that you are trying to do?

Colin


>
>
> That being the case, I might as well just have one controller, "main",
> with methods like "list_that" and "list_this", ie, there is not much
> point in defining a controller for each table -- all that is needed is
> class definition in models/
>
> However "what seems to be the case" to me is not necessarily the way
> that it is -- I'm worried I may diverge too much from anything
> resembling *Best Practices* here, particularly since this means going
>
> script/generate controller this
> then erasing everything but the model definition (I tried erasing those
> two, and creating one "main.rb" with all the classes in, but then there
> is an error).
>
> Anyone have any thoughts on this?  After a bit of googling I found some
> stuff about inheritance governing this -- does that mean I should put
> the methods I want globally accessible in
> app/controllers/application_controller.rb?
>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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 edit a pluggin? (acts_as_taggable_on)

2009-05-23 Thread aupayo

Hello,

I'm trying to modificate the acts_as_taggable_on pluggin, so when you
search various tags (Eg: User.tagged_with("fish, cat", :on
=> :animals), it looks for users with BOTH tags, not just one of them.

I have edited the file acts_as_taggable_on.rb and I have changed the
line:
"conditions << tags.map { |t| sanitize_sql(["#{tags_alias}.name
LIKE ?", t]) }.join(" OR ")"
with
""conditions << tags.map { |t| sanitize_sql(["#{tags_alias}.name
LIKE ?", t]) }.join(" AND ")".
but when I execute the search, the sql sentence that is executed is
the same than before.

I just restarted the console after doing the changes, do I have to do
something else so the changes take effect? (I installed the plugin
through GemPlugins)

Or maybe I'm editing the wrong line?...if someone has done this before
please correct me if I'm wrong!

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: JOBS - Have opening for ROR engineers

2009-05-23 Thread Colin Law
2009/5/23 Phlip 

>
> Erwin wrote:
>
> > that's OK .. but was not clearly stated  ;-)  got few friends there ,
> > will relay it
>
> Tip to Doris: When the local Railsters run thin, hire folks who have
> learned
> other web technologies, and train them on the job via Pair Programming.
> Trust
> me: You lose zero time with them like that!
>
> (Y'all _do_ practice Pair Programming, don't you??)


Unfortunately there is only me, so it is a little tricky.

Colin


>
>
> --
>   Phlip
>   http://twitter.com/Pen_Bird
>
>
> >
>

--~--~-~--~~~---~--~~
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: problem with fetching of data.

2009-05-23 Thread Colin Law
I think you need to provide more information for us to understand the
problem (for me to understand it anyway). Can you post the code you are
using to search for name "abc xyz" which is being turned into a query
"abc-xyz" as that is very odd.  If you could post an extract from the code,
an extract from the log showing the query, and the table structure then
someone may be able to work out what the problem is.

Colin

2009/5/23 Santosh Turamari 

>
> I want to know the number of ways in which I can fetch the data on a
> particular name from database, because I am getting invalid data, for
> the name with space such as "abc xyz".. It uses select *from names where
> name="abc-xyz", whch is fetching wrong information, so please help
> me.And essentially I want to search on name itself rather than ID.
> --
> 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: enforce an application constraint

2009-05-23 Thread Marnen Laibow-Koser

Cathal O'Riordan wrote:
> Don't check constrainsts just ensure that data is a certain format?

No.  They check anything you like -- format, value, whatever.  They 
actually work a lot like Rails validators.

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] Conditional Validation: only if a record can be found

2009-05-23 Thread Scott Holland

Hello!

I have a guestlist page which lists tickets and a user can attache a
guest to each ticket by using an auto complete form.

If each ticket has a guest attached, then the guestlist is 'full'

I have this rule in my controller and I want to turn it into a
validation in the model. Any ideas?

(sudo code)

if Ticket.find(first, condition => guestlist_id = ? and guest_id IS
NILL)
attach guest
else
display 'guestlist is full'
end

Thanks for your help

Scott
-- 
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: Help with text replacement plugin

2009-05-23 Thread Fernando Perez

> If someone would like to help with this small but handy plugin, please
> let me know. I'll put my stuff on github then.

A well crafted gsub can do that easily.
-- 
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: help from Routing guru ...

2009-05-23 Thread Kad Kerforn


> edit_hub_settings_general GET
>  /hubs/:hub_id/settings/general/edit(.:format)
> {:action=>"edit", :controller=>"hub/settings/general"}
> 
> which is fine...
> 
> I have a general.rb  in   app/controllers/hub/settings
> however, when executing I get the following error :
> 
> uninitialized constant Hub::Settings::GeneralController
> 
> how should I name my class ?
> 
> erwin

GOT IT...
I used:   class Hub::Settings::GeneralController < ApplicationController
but I did a mistake
I should use  a general_controller.rb  , not  general.rb

thanks for your tip !

-- 
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: where are the plugins installed through gems??

2009-05-23 Thread aupayo

solved: /usr/local/lib/ruby/gems/1.8/gems/

On 23 mayo, 18:00, aupayo  wrote:
> Hello,
>
> I installed a plugin as a GemPlugin and now I want to modify it, but I
> am unable to find it!
> Its somewhere in the system (not in vendor/plugins of my rails app),
> but I don't remember where!!
>
> Thanks for your help!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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: help from Routing guru ...

2009-05-23 Thread Kad Kerforn

Freddy Andersen wrote:
> Well you have a namespace for hubs thats why there is no id for the
> hubs
> 
> map.resources :hubs do |hub|
>   hub.resources :settings, :collection => { :general => :get }
> end
> 
> That will give you this:
> 
> /hubs/:hub_id/settings/general

Thanks Fred...
 ( I was reading the most recent doc 'Rails Routing from the Outside In' 
but I just started few minutes ago... )
this is fine but general should be a resource ( action will be standard 
'edit')  I'll have also permissions, profile and personal..(and one 
setting per hub)
so I wrote

  map.resources :hubs do |hub|
hub.resource :settings do |setting|
  setting.resource :general, :controller => "hub/settings/general"
end
  end

this gives me :

edit_hub_settings_general GET
 /hubs/:hub_id/settings/general/edit(.:format)
{:action=>"edit", :controller=>"hub/settings/general"}

which is fine...

I have a general.rb  in   app/controllers/hub/settings
however, when executing I get the following error :

uninitialized constant Hub::Settings::GeneralController

how should I name my class ?

erwin



-- 
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: Methodology question

2009-05-23 Thread Mk 27

I notice you cannot access another controller method from a view, eg.

:action => "othersec/list"

is no good; the action must belong to the corresponding controller

That being the case, I might as well just have one controller, "main", 
with methods like "list_that" and "list_this", ie, there is not much 
point in defining a controller for each table -- all that is needed is 
class definition in models/

However "what seems to be the case" to me is not necessarily the way 
that it is -- I'm worried I may diverge too much from anything 
resembling *Best Practices* here, particularly since this means going

script/generate controller this
then erasing everything but the model definition (I tried erasing those 
two, and creating one "main.rb" with all the classes in, but then there 
is an error).

Anyone have any thoughts on this?  After a bit of googling I found some 
stuff about inheritance governing this -- does that mean I should put 
the methods I want globally accessible in 
app/controllers/application_controller.rb?

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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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: help from Routing guru ...

2009-05-23 Thread Freddy Andersen

Well you have a namespace for hubs thats why there is no id for the
hubs

map.resources :hubs do |hub|
  hub.resources :settings, :collection => { :general => :get }
end

That will give you this:

/hubs/:hub_id/settings/general
--~--~-~--~~~---~--~~
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] where are the plugins installed through gems??

2009-05-23 Thread aupayo

Hello,

I installed a plugin as a GemPlugin and now I want to modify it, but I
am unable to find it!
Its somewhere in the system (not in vendor/plugins of my rails app),
but I don't remember where!!

Thanks for your help!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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: Pair Programming (WAS: Have opening for ROR engineers)

2009-05-23 Thread Hassan Schroeder

On Sat, May 23, 2009 at 7:42 AM, Phlip  wrote:

> (Y'all _do_ practice Pair Programming, don't you??)

Nope. Never had the opportunity.  You?  :-)

It's an interesting idea, with at least one major practical drawback,
but I wonder what percentage of Rails development is *actually*
being done in a Pair Programming environment.

-- 
Hassan Schroeder  hassan.schroe...@gmail.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: Help with text replacement plugin

2009-05-23 Thread Patrick Heneise

solved.

http://github.com/pathe/replacr/tree/master
-- 
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] Methodology question

2009-05-23 Thread Mk 27

Still learning, but it is getting easier by the minute ;)

I have a bunch of controllers (that correspond to db tables) and
corresponding views.  However, I want to use the views with
link_to_remote into divs on a page that is created as a "base" that is
loaded WITHOUT making any calls on the db.  To this end I created a dud
controller, main, with a single empty method

def load
end

and a corresponding view that is the html "base".  This works fine, but
I wanted to check and see if there are any caveats against doing this
(using a seperate dud controller) or if there is a more "conventional"
way to go.

I could put the empty method into a real, existing controller, I just
figured "main/load" would be tidier...
-- 
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: JOBS - Have opening for ROR engineers

2009-05-23 Thread Phlip

Erwin wrote:

> that's OK .. but was not clearly stated  ;-)  got few friends there ,
> will relay it

Tip to Doris: When the local Railsters run thin, hire folks who have learned 
other web technologies, and train them on the job via Pair Programming. Trust 
me: You lose zero time with them like that!

(Y'all _do_ practice Pair Programming, don't you??)

-- 
   Phlip
   http://twitter.com/Pen_Bird


--~--~-~--~~~---~--~~
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] help from Routing guru ...

2009-05-23 Thread Erwin

using such route  :

  map.namespace(:hubs) do |hub|
hub.resources :settings,
  :member => { :general => :get }
  end

I get :

general_hubs_setting
 /hubs/settings/:id/general
 {:action=>"general", :controller=>"hubs/settings"}

but I would like to get
/hubs/:id/settings/general
 {:action=>"general", :controller=>"hubs/settings"  with params[:id] =
1

what kind of route I should use ?

thanks for your help
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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: enforce an application constraint

2009-05-23 Thread coriordan

Hi Roderick,

Could you provide an example of how this would work?

regards,
C.

On May 23, 11:58 am, Roderick van Domburg  wrote:
> Marnen Laibow-Koser wrote:
> > Cathal O'Riordan wrote:
> > [...]
> >> My concern is that my code won't guard against a race condition where
> >> 2 or more users try to register for a course that is near it capacity
> >> limit. My first thought was to wrap the registration code in a
> >> transaction and rollback if the capacity of registrations on a course
> >> has been exceeded.
> > [...]
>
> > Use check constraints in the DB and let *it*, not your app, worry about
> > concurrency issues!
>
> That's one approach. Wrapping it up in a transaction with read isolation
> would work fine too. Alternatively (and better for concurrency), keep a
> counter cache on the registration_count and use the default isolation
> level.
>
> --
> Roderick van Domburg
> --
> 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: enforce an application constraint

2009-05-23 Thread coriordan

Don't check constrainsts just ensure that data is a certain format?

On May 23, 12:21 am, Marnen Laibow-Koser  wrote:
> Cathal O'Riordan wrote:
>
> [...]> My concern is that my code won't guard against a race condition where
> > 2 or more users try to register for a course that is near it capacity
> > limit. My first thought was to wrap the registration code in a
> > transaction and rollback if the capacity of registrations on a course
> > has been exceeded.
>
> [...]
>
> Use check constraints in the DB and let *it*, not your app, worry about
> concurrency issues!
>
> If your DB server can't handle check constraints, get one that can.
>
> 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] help from Routing guru ...

2009-05-23 Thread Erwin

using such route  :

  map.namespace(:hubs) do |hub|
hub.resources :settings,
  :member => { :general => :get }
  end

I get :

general_hubs_setting
 /hubs/settings/:id/general
 {:action=>"general", :controller=>"hubs/settings"}

but I would like to get
/hubs/:id/settings/general
 {:action=>"general", :controller=>"hubs/settings"  with params[:id] =
1

what kind of route I should use ?

thanks for your help
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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: MMORPG in Rails

2009-05-23 Thread Jason Roelofs
You are going down the WRONG path. This shouldn't even be a question for
you. Build your game, then if/when you need it, look into making multiple
servers.
Jason

On Sat, May 23, 2009 at 12:35 AM, Jeremy  wrote:

>
> Hi I'm trying to make a simple browser based MMORPG in Rails for fun.
>
> One of the issues that I cannot resolve is how to architect several
> universes. For example, go to www.ogame.org and you will see that the
> user can sign up to multiple universes to play in. Or kind of like WoW
> where you can sign in to separate worlds. However for my game the
> player is only allowed to ever play in the world he signed up in.
>
> Would the best way to achieve this "partitioning" to create several
> databases? Or is there a more effective way? I don't want to do it in
> such a way that maintenance becomes a nightmare.
>
> 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: JOBS - Have opening for ROR engineers

2009-05-23 Thread Erwin

that's OK .. but was not clearly stated  ;-)  got few friends there ,
will relay it
Erwin

On 23 mai, 15:10, Phlip  wrote:
> Erwin wrote:
> > I thought they were many talented Indian software developers looking
> > for jobs over there ... why not hiring them first ?
>
> I suspect, in terms of some few of them just might have access to this
> newsgroup, they were Doris's target...
>
> --
>    Phlip
--~--~-~--~~~---~--~~
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: JOBS - Have opening for ROR engineers

2009-05-23 Thread Phlip

Erwin wrote:

> I thought they were many talented Indian software developers looking
> for jobs over there ... why not hiring them first ?

I suspect, in terms of some few of them just might have access to this 
newsgroup, they were Doris's target...

-- 
   Phlip


--~--~-~--~~~---~--~~
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] Help with text replacement plugin

2009-05-23 Thread Patrick Heneise

Hi guys,

I thought of having a plugin which replaces text with the tag of an
image (f.e. 'read' => '') would be great.

I started with to create this plugin, but I didn't get far. Is there
anyone who can help me with this? My idea is to have all 'translations'
in a *.yml file. But I don't know how to load this file from the plugin
and how to store the values in an array.

If someone would like to help with this small but handy plugin, please
let me know. I'll put my stuff on github then.

Thanks a lot in advance.

-patrick
-- 
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: How well does Rails handle brownfield data in a greenfield application?

2009-05-23 Thread Conrad Taylor
On Fri, May 22, 2009 at 10:32 AM, Wayne Molina wrote:

>
> The SKU would be a separate field in and of itself, what I'm saying is
> the numeric ID (what Rails would set as an autoincrement) is pre-
> assigned from the data instead of being assigned automatically from
> Rails.
>
>
Again, I would leave the Rails ID intact to not invalidate the conventions
set forth and create
others fields that are needed for your application.  The ID used by Rails is
used as record
identifier and shouldn't be used for other purposes like an actual product
ID, order ID, and so on.

Good luck,

-Conrad

--~--~-~--~~~---~--~~
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: AJAX based chat plugin (beta)

2009-05-23 Thread Gerda Gorter

I have launched the website with a demo of the chat.

the chat is still in beta please report when it goes wrong


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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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] STI Problem

2009-05-23 Thread nico

Hi,

I'm having trouble with some STI Classes in a test.

When I create a new Class of an STI derived base class
the type column is not set.

If I do

object = DerivedClass.create!(params)

then object[:type] == nil for some reason.

Any ideas why this is so? I assumed rails takes
care of setting the type column in STI (that's what I read).

Nico
--~--~-~--~~~---~--~~
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: How well does Rails handle brownfield data in a greenfie

2009-05-23 Thread Roderick van Domburg

Brendon Whateley wrote:
> Be very careful doing this.  When you change assumed Rails conventions
> and behavior, it tends to bite you in unexpected ways.  While you can
> override the ID column, I'd suggest not doing it.
> 
> I'd seriously just let Rails add an extra ID column and put the big
> table in other columns.  The cost is small and you are not potentially
> breaking future Rails stuff.

+1. Mapping legacy IDs onto default Rails IDs will bite.

--
Roderick van Domburg
http://www.nedforce.com
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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: enforce an application constraint

2009-05-23 Thread Roderick van Domburg

Marnen Laibow-Koser wrote:
> Cathal O'Riordan wrote:
> [...]
>> My concern is that my code won't guard against a race condition where
>> 2 or more users try to register for a course that is near it capacity
>> limit. My first thought was to wrap the registration code in a
>> transaction and rollback if the capacity of registrations on a course
>> has been exceeded.
> [...]
> 
> Use check constraints in the DB and let *it*, not your app, worry about 
> concurrency issues!

That's one approach. Wrapping it up in a transaction with read isolation 
would work fine too. Alternatively (and better for concurrency), keep a 
counter cache on the registration_count and use the default isolation 
level.

--
Roderick van Domburg
-- 
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] who is using firebird 2.1.2?

2009-05-23 Thread Mariarosaria Trovato

Have you problem with fb_adapter on rails 2.3.2 + firebird2.1.2.18118 ?
-- 
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] Standard Way for Upload without Page Reload (aka Ajax Upload)

2009-05-23 Thread Lailson Bandeira

I've just entered to this group and this is my first message. Hello
everybody!

I know this seems to be a recurrent discussion, but as I couldn't find
any relevant discussion before 2007, I'm asking again: there is some
"standard way" (I mean, directly supported or provided from RoR) to
make file uploads without page reloading (aka Ajax Upload -- I know,
this is not _really_ Ajax)?
The best material I found about it is very descriptive indeed (http://
kpumuk.info/ruby-on-rails/in-place-file-upload-with-ruby-on-rails/),
but it is from 2006! So, I refuse to believe there is not something
new about it.
So, what do you say guys (and girls too =P)?

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] MMORPG in Rails

2009-05-23 Thread Jeremy

Hi I'm trying to make a simple browser based MMORPG in Rails for fun.

One of the issues that I cannot resolve is how to architect several
universes. For example, go to www.ogame.org and you will see that the
user can sign up to multiple universes to play in. Or kind of like WoW
where you can sign in to separate worlds. However for my game the
player is only allowed to ever play in the world he signed up in.

Would the best way to achieve this "partitioning" to create several
databases? Or is there a more effective way? I don't want to do it in
such a way that maintenance becomes a nightmare.

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] using image as input type in submit_to_remote

2009-05-23 Thread gautam chekuri

Hi all,

After searching for a way to set the input type of a submit tag to
image when using submit_to_remote I realized that the method call
given below, while seemingly valid, wasn't working since the method
button_to_function in actionpack/lib/action_view/helpers/
javascript_helper.rb was forcing the type to button.

1. The method call in the view:
<%=
   submit_to_remote(
 'update_resource_img',
 'Update Resource 2',
 :url => { :controller => 'hello', :action => 'update' },
 :before => "$('loading').style.display = 'block'",
 :after => "return false",
 :html => { :src => '/images/button.gif', :type => 'image' }
   )
%>

2. def button_to_function in action_view/helpers/javascript_helper.rb
does the following(note the :type => 'button') :
tag(:input, html_options.merge(:type => 'button', :value =>
name, :onclick => onclick))

3. It is my opinion (finally :p) that the def button_to_remote should
allow the input type to be either a button or an image since the w3c
page on form input control types states that the input type image
"Creates a graphical submit button."
http://www.w3.org/TR/html401/interact/forms.html#h-17.4.1

4. Hence, to ensure that button_to_remote allows me to set the type of
either of button or image, I place the following in a file in
$RAILS_ROOT/lib and require it at the end of $RAILS_ROOT/config/
environment.rb

module ActionView
  module Helpers
module JavaScriptHelper

  def button_to_function(name, *args, &block)
html_options = args.extract_options!.symbolize_keys

function = block_given? ? update_page(&block) : args[0] || ''
onclick = "#{"#{html_options[:onclick]}; " if html_options
[:onclick]}#{function};"

html_options[:type] = 'button' if( !html_options[:type] ||
html_options[:type] !~ /^image|button$/i )

tag(:input, html_options.merge(:value => name, :onclick =>
onclick))
  end

end
  end
end

5. Hope you guys have an opinion to share.

- Gautam
  Programmer @ Azri

--~--~-~--~~~---~--~~
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: Getting bleeding edge rails

2009-05-23 Thread Frederick Cheung



> Hi Frederick,
>
> I've just realised I can't use symlink on windows. What is the
> environment variables for ruby library path? I tried RUBYPATH and it
> doesn't work. Thank you very much for helping.

in that case put your rails checkout from github in your_app/vendor/
rails

Fred
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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 fetching of data.

2009-05-23 Thread Santosh Turamari

I want to know the number of ways in which I can fetch the data on a
particular name from database, because I am getting invalid data, for
the name with space such as "abc xyz".. It uses select *from names where
name="abc-xyz", whch is fetching wrong information, so please help
me.And essentially I want to search on name itself rather than ID.
-- 
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: Is there any collabrative community content managemnt product available in ruby On Rails?

2009-05-23 Thread gundestrup

what about insoshi?
http://github.com/insoshi/insoshi/tree/master

On May 23, 8:41 am, Marnen Laibow-Koser  wrote:
> Phlip wrote:
>
> [...]
>
> > I just started with Community Engine, but it has shown no signs of
> > sucking yet...
>
> Good to know.  There's also lovdby-less and (if you want to go that
> route) Ning
>
> Adva-cms is a promising newcomer -- might be worth a look once it
> matures a bit
>
>
>
> > --
> >    Phlip
>
> 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] [ANN] gettext-2.0.4, gettext_activerecord-2.0.4, gettext_rails-2.0.4

2009-05-23 Thread Masao Mutoh

Hi,

Ruby-GetText-Package-2.0.4 and the families
(gettext-2.0.4, gettext_activerecord-2.0.4 and gettext_rails-2.0.4)
are now available.

Ruby-GetText-Package is the library/tools for message localization.

  * gettext - Message localization libraries and tools for all kind of 
apps/libs.
  * gettext_activerecord - ActiveRecord Localization
  * gettext_rails - Rails support with gettext.

Changes
---
== gettext-2.0.4
 * Fix String#% return nil when the string have no place holders. [by okkez]
 * Update pofiles and remove old messages.
 * suppress some warnings on Ruby 1.9.x. [by Nobuhiro IMAI]
 * Fix not to run tests on Win32, JRuby.

== gettext_activerecord-2.0.4, gettext_rails-2.0.4
   * Update dependencies.

(NOTE)
  * Rails-2.3.1 or earlier aren't supported.

Website
---
* homepage
   http://www.yotabanana.com/hiki/ruby-gettext.html
* rubyforge
   http://rubyforge.org/projects/gettext
* github
  http://github.com/mutoh/gettext/tree/master
  http://github.com/mutoh/gettext_activerecord/tree/master
  http://github.com/mutoh/gettext_rails/tree/master

* Download
  http://rubyforge.org/frs/?group_id=1997&release_id=32471

* Ruby-GetText-Package HOWTOs
  http://www.yotabanana.com/hiki/ruby-gettext-howto.html
* Ruby-GetText-Package HOWTO for Ruby on Rails 
  http://www.yotabanana.com/hiki/ruby-gettext-rails.html
* HOWTO Migrate rails-2.1.x(gettext-1.93.0) to rails-2.3.2(gettext-2.0.0)
  http://www.yotabanana.com/hiki/ruby-gettext-rails-migration.html
* Ruby-GetText-Package documents for Translators
  http://www.yotabanana.com/hiki/ruby-gettext-translate.html

ScreenShots
---
Screenshots in 23 languages (Sample Rails blog) are:
http://www.yotabanana.com/hiki/?ruby-gettext-screenshot

-- 
Masao Mutoh 

--~--~-~--~~~---~--~~
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] locale-2.0.4, locale_rails-2.0.4

2009-05-23 Thread Masao Mutoh

Hi,

Ruby-Locale(locale-2.0.4) and 
Ruby-Locale for Ruby on Rails(locale_rails-2.0.4)
are now available.

Ruby-Locale is the library to manage/detect various format
of locale IDs(language tags), and provide ISO 639-3,
ISO-3166 data.

* locale - Manage Locale IDs, Auto-detect locales. ISO-639-3, 3166 data.
* locale_rails - Rails support

Changes
---
== locale-2.0.4
 * Enhance Win32 support. [Reported by Dice]
 * Enhance JRuby support
 * Fixed a waring with ruby -d option.

== locale_rails-2.0.4
 * Fixed that localized views are not working correctly. [Reported by Dan Coutu]
 * Add tests

Website
---
* homepage
   http://www.yotabanana.com/hiki/ruby-locale.html
* rubyforge
   http://rubyforge.org/projects/locale
* github
  http://github.com/mutoh/locale/tree/master
  http://github.com/mutoh/locale_rails/tree/master

* Download
  http://rubyforge.org/frs/?group_id=855&release_id=2856

* Ruby-Locale HOWTOs
  http://www.yotabanana.com/hiki/ruby-locale-howto.html

* Ruby-Locale for Ruby on Rails HOWTOs
  http://www.yotabanana.com/hiki/ruby-locale-rails-howto.html

-- 
Masao Mutoh 

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