[Rails] rubyzip install error

2010-12-21 Thread Reza Adinata
Hi,

I am trying to install a rubyzip ( http://rubyzip.sourceforge.net/ )in
windows. I put the rubyzip extracted folder under my project,
and try this :

C:\project\drawing\rails\rubyzip-0.9.3\ruby install.rb

and I receive errors of these

install.rb:21: in 'install' wrong number of arguments(4 for 3) Argumment
error

from install.rb:21
from install.rb:18 in 'each'
from install.rb:18

Can anyone help me to install rubyzip usign the source?

Thank you for your kindness help

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] rubyzip install error

2010-12-21 Thread Dhruva Sagar
Hi,

May I ask you why you are not installing the rubyzip gem directly from
rubygems as it suggests ?
Is there a specific reason why you are trying to install from source ? If
not, then I would suggest you to take the approach recommended by the gem
itself, and install it from rubygems using a command like gem install
rubyzip. If for some reason you wish to install the latest from source, I
would suggest you to contact the developer or check the source directly...

--
Thanks  Regards,
Dhruva Sagar.



On Tue, Dec 21, 2010 at 16:33, Reza Adinata li...@ruby-forum.com wrote:

 Hi,

 I am trying to install a rubyzip ( http://rubyzip.sourceforge.net/ )in
 windows. I put the rubyzip extracted folder under my project,
 and try this :

 C:\project\drawing\rails\rubyzip-0.9.3\ruby install.rb

 and I receive errors of these

 install.rb:21: in 'install' wrong number of arguments(4 for 3) Argumment
 error

 from install.rb:21
 from install.rb:18 in 'each'
 from install.rb:18

 Can anyone help me to install rubyzip usign the source?

 Thank you for your kindness help

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

 --
 You received this message because you are subscribed to the Google Groups
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.



-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] jruby here?

2010-12-21 Thread Fidel Viegas
On 12/19/10, Mauro mrsan...@gmail.com wrote:
 On 18 December 2010 21:30, Fidel Viegas fidel.vie...@gmail.com wrote:
 You use grails too?
 I'd like to have some opinions about grails and RoR.
 I use both, but lately I prefer grails to develop my applications.
 With RoR you have to think about tables, create foreign key, and so
 on, with you have to create your domain classes and that's all.

Yes, I do use Grails as well, and at this precise moment I am working
on a project that required me to use it.

Before jumping into Rails as my primary development framework, I used
to use mainly Grails, and J2EE before that. Groovy is so much like
Java that I just picked it quickly. I also learned Ruby quickly as it
is pretty similar in syntax to Python, which I have and still use it
quite a lot for System Administration.

I think both frameworks are pretty similar and pretty good, and Grails
has the advantage of allowing you to make use of existing Java
frameworks and tons of libraries available. Specially when you need a
reporting solution or support for a certain RDBMS, which does not
happen with Active Record. I haven't really tried DataMapper or
another ORM framework.

I often decide on what framework to use based on the target platform,
RDBMS and reporting solution. For instance, if the target platform is
Windows, there is no doubt that I will use Grails, since Rails is not
very Windows friendly. If I don't need any special RDBMS, advanced
reporting capabilities, or Windows, then I go for Rails. In fact I
only develop with Grails on the Windows platform. Other than that, I
use Rails.

In the beginning I used Rails only for websites, but now we are using
it even for developing financial and accounting software.

Now with regards to thinking in tables terms, I prefer it over letting
a framework do everything for me. Contrary to what many people can
say, Object-Oriented programming and the Relational model are
compatible to a certain extent. There are certain OO concepts that are
hard to implement in a Relational model. Take inheritance for
instance. How many approaches do you have for that? They all have
their pros and cons, but none is a perfect match for the real concept.
So, to a certain degree you need to think in terms of tables or use an
ORDBMS, which is easier to map.

The relational model is here to stay for a very long time.

All the best,

Fidel.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Bundler behind a proxy

2010-12-21 Thread Raphael de Almeida
Check the environment variable http_proxy
$ echo $http_proxy

To set it
$ export http_proxy=user:p...@host:port

-- 
[]ão,

Raphael de Almeida

http://raphaeldealmeida.wordpress.com
http://www.twitter.com/raph_almeida
http://rubyonrio.org

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: rails code to sql

2010-12-21 Thread manivannan time is now
wats the code for add combobox in ruby on rails

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Trainee in ruby on rails need some help

2010-12-21 Thread kp
hi... i am MCA student and pursuing training from software company
which uses this technology ruby on rails.

i m new to thisso please suggest me some books or site for online
study to clear concepts.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Trainee in ruby on rails need some help

2010-12-21 Thread Ahmy Yulrizka
see http://guides.rubyonrails.org/
best book i ever read
http://pragprog.com/titles/rails2/agile-web-development-with-rails


On Tue, Dec 21, 2010 at 5:34 PM, kp pariharkirt...@gmail.com wrote:

 hi... i am MCA student and pursuing training from software company
 which uses this technology ruby on rails.

 i m new to thisso please suggest me some books or site for online
 study to clear concepts.

 --
 You received this message because you are subscribed to the Google Groups
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.



-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Trainee in ruby on rails need some help

2010-12-21 Thread kirti parihar
hey...thanks for your kind help. :-)

On Tue, Dec 21, 2010 at 5:40 PM, Ahmy Yulrizka ahmy...@gmail.com wrote:

 see http://guides.rubyonrails.org/
 best book i ever read
 http://pragprog.com/titles/rails2/agile-web-development-with-rails


 On Tue, Dec 21, 2010 at 5:34 PM, kp pariharkirt...@gmail.com wrote:

 hi... i am MCA student and pursuing training from software company
 which uses this technology ruby on rails.

 i m new to thisso please suggest me some books or site for online
 study to clear concepts.

 --
 You received this message because you are subscribed to the Google Groups
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.


-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] jruby here?

2010-12-21 Thread Mauro
On 21 December 2010 12:27, Fidel Viegas fidel.vie...@gmail.com wrote:

 I often decide on what framework to use based on the target platform,
 RDBMS and reporting solution. For instance, if the target platform is
 Windows, there is no doubt that I will use Grails, since Rails is not
 very Windows friendly. If I don't need any special RDBMS, advanced
 reporting capabilities, or Windows, then I go for Rails. In fact I
 only develop with Grails on the Windows platform. Other than that, I
 use Rails.

So if rails works as well as grails in Windows your final choice can be rails?


 In the beginning I used Rails only for websites, but now we are using
 it even for developing financial and accounting software.

I develop only web applications for now, I'm using both grails and
rails with jruby because I prefer to deploy under a servlet container
like tomcat.
I love both, I cannot decide which one prefer.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Trainee in ruby on rails need some help

2010-12-21 Thread rajeevsharma86
above two are best for newbies

Check out this

http://railsnotes.com/rails-training/

http://tonycode.com/wiki/index.php?title=Ruby_on_Rails_Notes

On Tue, Dec 21, 2010 at 5:42 PM, kirti parihar pariharkirt...@gmail.comwrote:

 hey...thanks for your kind help. :-)


 On Tue, Dec 21, 2010 at 5:40 PM, Ahmy Yulrizka ahmy...@gmail.com wrote:

 see http://guides.rubyonrails.org/
 best book i ever read
 http://pragprog.com/titles/rails2/agile-web-development-with-rails


 On Tue, Dec 21, 2010 at 5:34 PM, kp pariharkirt...@gmail.com wrote:

 hi... i am MCA student and pursuing training from software company
 which uses this technology ruby on rails.

 i m new to thisso please suggest me some books or site for online
 study to clear concepts.

 --
 You received this message because you are subscribed to the Google Groups
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.




-- 
Thanks:
Rajeev sharma
+919013155133

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] jruby here?

2010-12-21 Thread Fidel Viegas
On 12/21/10, Mauro mrsan...@gmail.com wrote:
 On 21 December 2010 12:27, Fidel Viegas fidel.vie...@gmail.com wrote:

 So if rails works as well as grails in Windows your final choice can be
 rails?

Rails is always my first choice when I begin a new project. I only
resort to Grails when I face situations that require me to use it.
Such as the ones I have described in my previous post. As for Windows,
I only use it if it is one of the client's requirements. Otherwise, a
use a Unix-based system.

 I develop only web applications for now, I'm using both grails and
 rails with jruby because I prefer to deploy under a servlet container
 like tomcat.
 I love both, I cannot decide which one prefer.

I also don't have a favourite framework, but I do favour Ruby over
Groovy, and that is what leads me to go for Rails. I think that either
framework can do the job, and in the end it comes down to language
preference, at least for me.

Regards,

Fidel.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Subselection by URL

2010-12-21 Thread Simon Baumgartner
Have a look at https://github.com/jamesgolick/resource_controller
It won't solve all your problems, but some.

On Dec 21, 8:32 am, Jo Bu li...@ruby-forum.com wrote:
 Marnen Laibow-Koser wrote in post #969567:

  You want nested resources.  Read the routing docs.

 Well yes, I could do that, but it would become very confusing. But I
 would more like a solution like (in pseudocode)
 if (URL matches /a/:a_id/!(create|new|show|edit).*)
        set @a=A.find_by_id(:a_id)
 Is that possible?
 And then I would have to rewrite link_to to prefix with the given
 values, right?

 --
 Posted viahttp://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] difference between attr_accesor and attr_accesible

2010-12-21 Thread kp
I m new to ruby language. difference between att_accesor and
attr_accessible is not clear to me.

thanks for your kind help.
kp
(india)

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] associations / json and doing things right

2010-12-21 Thread bingo bob
I'm doing stuff with Apps in the App Store. Apps belong to a price tier.
Such that.

App
  belongs_to :tier

Tier
  has_many :apps

All good so far.

I want to monitor when an app changes tier amongst other thing, don't
need a history, but need to record the previous tier.

My plan was to store attributes on the App for tier_code and
previous_tier_code, but this strikes me as wrong because an App belongs
to a Tier at a point in time so I don't need to store the tier code
twice (and I shouldn't).

The main reason I've stuck the tier_code attribute on the App is I wish
to serve up JSON from the AppController's index action. With all the
attributes I need on the App directly I can just format.json { render
:json = @apps } or the like.

What could/should I do, ideally I'd like to remove the tier_code
attribute on the App, and incorporate it in the json via the association
- looked into this and it made my head spin.

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: difference between attr_accesor and attr_accesible

2010-12-21 Thread Frederick Cheung


On Dec 21, 12:20 pm, kp pariharkirt...@gmail.com wrote:
 I m new to ruby language. difference between att_accesor and
 attr_accessible is not clear to me.


They're almost completely unrelated. attr_accessor is part of ruby
itself and is equivalent to calling attr_writer and attr_reader for
the same argument(s), ie it creates accessor methods for you

attr_accessible is a rails thing and is part of rails' mass assignment
protection (along with attr_protected). It allows you to setup a
whitelist of attributes that can be mass-assigned (as opposed to
attr_protected, which sets up a blacklist) so that users can't set
important attributes they're not supposed to be able to set just by
manipulating the form data that is posted

Fred
 thanks for your kind help.
 kp
 (india)

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: unpacking ruby-odbc

2010-12-21 Thread pepe
 Bundler might help here.

I don't know bundler but for what I read in the web site it would only
help with the list of gems not with unpacking ruby-odbc.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Problem with validates uniqueness and accented characters

2010-12-21 Thread Victor Cisneiros
I have a table 'client' with a unique index on column 'nome'
I have also set validates :uniqueness = true on column 'nome'

There is a record 'João Victor Santos' on my clients table. When I try
to insert another 'João Victor Santos' Rails executes the following
command to check if a record with this name already exists:

SELECT `clients`.`id` FROM `clients` WHERE (`clients`.`nome` = BINARY
'João Victor Santos') LIMIT 1

Unfortunately this query returns 0 rows and validation passes and I
receive this stack trace

Mysql::Error: Duplicate entry 'João Victor Santos' for key 2

If I execute this query in phpMyAdmin it correctly returns 1 result

SELECT `clients`.`id` FROM `clients` WHERE (`clients`.`nome` = 'João
Victor Santos') LIMIT 1

I'm using Rails 3.0.3, Ruby 1.8.7 and the mysql gem. I can't switch to
mysql2 gem because I'm running on Windows and this application will also
run on Windows in production

Has anyone faced this problem?

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: unpacking ruby-odbc

2010-12-21 Thread Marnen Laibow-Koser
pepe wrote in post #969780:
 Bundler might help here.

 I don't know bundler but for what I read in the web site it would only
 help with the list of gems not with unpacking ruby-odbc.

It won't help with unpacking as such, but it will help with automating 
the installation process on the host.

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

Sent from my iPhone

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: associations / json and doing things right

2010-12-21 Thread Marnen Laibow-Koser
bingo bob wrote in post #969776:
 I'm doing stuff with Apps in the App Store. Apps belong to a price tier.
 Such that.

 App
   belongs_to :tier

 Tier
   has_many :apps

 All good so far.

 I want to monitor when an app changes tier amongst other thing, don't
 need a history, but need to record the previous tier.

Then you probably want one of the version plugins such as 
vestal_versions.

[...]
 The main reason I've stuck the tier_code attribute on the App is I wish
 to serve up JSON from the AppController's index action. With all the
 attributes I need on the App directly I can just format.json { render
 :json = @apps } or the like.

The tier_code definitely belongs on the App -- it's a property of the 
App, after all.  You should have no misgivings about putting it there.


 What could/should I do, ideally I'd like to remove the tier_code
 attribute on the App, and incorporate it in the json via the association
 - looked into this and it made my head spin.

Uh, what?  You've already got it there as an association.  What do you 
think you want to do differently?  And what made your head spin -- 
that is, what didn't you understand?  Statements such as this are 
completely unhelpful without more detail.

Or are you saying that App has both a tier_id and a tier_code ?  If so, 
then you're right; that's terrible.

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

Sent from my iPhone

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Problem with validates uniqueness and accented characters

2010-12-21 Thread Marnen Laibow-Koser
Victor Cisneiros wrote in post #969792:
 I have a table 'client' with a unique index on column 'nome'
 I have also set validates :uniqueness = true on column 'nome'

 There is a record 'João Victor Santos' on my clients table. When I try
 to insert another 'João Victor Santos' Rails executes the following
 command to check if a record with this name already exists:

 SELECT `clients`.`id` FROM `clients` WHERE (`clients`.`nome` = BINARY
 'João Victor Santos') LIMIT 1

 Unfortunately this query returns 0 rows and validation passes and I
 receive this stack trace

 Mysql::Error: Duplicate entry 'João Victor Santos' for key 2

 If I execute this query in phpMyAdmin it correctly returns 1 result

 SELECT `clients`.`id` FROM `clients` WHERE (`clients`.`nome` = 'João
 Victor Santos') LIMIT 1

Perhaps you've got an encoding issue.


 I'm using Rails 3.0.3, Ruby 1.8.7 and the mysql gem. I can't switch to
 mysql2 gem because I'm running on Windows and this application will also
 run on Windows in production

You should absolutely not be running Rails applications on Windows in 
production.  Find a way to host the app on *nix if at all possible.


 Has anyone faced this problem?

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

Sent from my iPhone

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: associations / json and doing things right

2010-12-21 Thread bingo bob
 Or are you saying that App has both a tier_id and a tier_code ?  If so,
 then you're right; that's terrible.

oops - yes, that's what I'd doing at the moment - and I'd like to change 
that I realise it's terrible. The question I have is if I remove the 
tier_code then how do I serve up json from my index action in the 
controller together with the apps associated tier_code.

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: associations / json and doing things right

2010-12-21 Thread Marnen Laibow-Koser
bingo bob wrote in post #969803:
 Or are you saying that App has both a tier_id and a tier_code ?  If so,
 then you're right; that's terrible.

 oops - yes, that's what I'd doing at the moment - and I'd like to change
 that I realise it's terrible. The question I have is if I remove the
 tier_code then how do I serve up json from my index action in the
 controller together with the apps associated tier_code.

Go read the docs for to_json ; this is explained clearly.  Pay special 
attention to the :include option.

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

Sent from my iPhone

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Using sequences in factory_girl_rails - can you not have a sequence call in different factories?

2010-12-21 Thread ppgeng...@prevailhs.com
On Dec 20, 4:38 pm, daze dmonopol...@gmail.com wrote:

 Wait what if you wanted to do this?

 t.title {|x| #{x.section.name}Article#{Factory.next(:count)} }

 So would this be a scenario in which it's better to have a separate
 sequence for something that is more complex - so like a sequence
 called :article_title?

The tricky part there is that you want both the sequence and the
handle to the object that you're creating.  I think that means you
can't use the shortcut syntax I had (or at least I don't see how), but
it also means you can't use a Factory.sequence :foobar do ... end,
because that won't know your x object and it doesn't look like you can
pass in a context like you can with the other Factory objects.

It seems like you have three options which are:
1) Do something like what you're doing, although if you need to share
part of it you could make a sequence :article_title for
article_#{n} and then do

t.title {|x| #{x.section.name}_#{Factory.next(:article_title)}}

2) You could not put the x.section.name in the title; that'd be my
first inclination as it'd seem odd if the name you have is required to
be that, since its just for testing purposes.

3) You could patch factory_girl's sequence to take a context like the
object factories.  Look at 
https://github.com/thoughtbot/factory_girl/blob/master/lib/factory_girl/sequence.rb;
basically you want to override the next method to take options and
pass them into the call in there.  I'm not sure exactly how the object
part does it, but in theory one should be able to look at that and
emulate the appropriate stuff.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Where put require

2010-12-21 Thread Paul Bergstrom
Where do I put e g require 'will_paginate' in Rails 3 environment?

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Where put require

2010-12-21 Thread David Kahn
On Tue, Dec 21, 2010 at 9:51 AM, Paul Bergstrom li...@ruby-forum.comwrote:

 Where do I put e g require 'will_paginate' in Rails 3 environment?


Are you using the gem? If the gem, just include it in the gemfile and you
should be good:

gem 'will_paginate', :git = 'git://github.com/mislav/will_paginate.git',
:branch = 'rails3'




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

 --
 You received this message because you are subscribed to the Google Groups
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.



-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Where put require

2010-12-21 Thread Paul Bergstrom
David Kahn wrote in post #969813:
 On Tue, Dec 21, 2010 at 9:51 AM, Paul Bergstrom

 Are you using the gem? If the gem, just include it in the gemfile and
 you
 should be good:

 gem 'will_paginate', :git =
 'git://github.com/mislav/will_paginate.git',
 :branch = 'rails3'

Even if it's already installed?

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Where put require

2010-12-21 Thread David Kahn
On Tue, Dec 21, 2010 at 10:13 AM, Paul Bergstrom li...@ruby-forum.comwrote:

 David Kahn wrote in post #969813:
  On Tue, Dec 21, 2010 at 9:51 AM, Paul Bergstrom

  Are you using the gem? If the gem, just include it in the gemfile and
  you
  should be good:
 
  gem 'will_paginate', :git =
  'git://github.com/mislav/will_paginate.git',
  :branch = 'rails3'

 Even if it's already installed?


Right... you want all your dependencies in the gemfile. I am not an expert
but through experience it seems that if a gem is included there then I do
not have to place 'requires'. Try yourself.

Also, I would recommend that you try RVM and use gemsets. I create a new
gemset for each app, that way I have a clean start for that app and fresh
install of the gems. And you can also delete the gemset and start over if
you run into any problems and want to round out the possibility that the
issue was in your gems.



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

 --
 You received this message because you are subscribed to the Google Groups
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.



-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] liquid include error please help

2010-12-21 Thread Sameera Gayan
Hi All,

I have been trying to get my following code working for almost 4 days
and glad if you could help me.

Basically what I want to do is to use liquid 'include' tag

I'm getting this error

Liquid error: No such template 'test'

my code is as follows

in my app/views/page/index.erb

%
file_system = Liquid::LocalFileSystem.new(/page/)
full_file_path = file_system.full_path(test)
Liquid::Template.file_system =
Liquid::LocalFileSystem.new(full_file_path)
%
%...@template = Liquid::Template.parse(@page) %
%= raw @template.render(@liquid_snippets)  %

So let me explain above code,

I have a liquid partial at /app/views/page/_test.liquid

@page contains the code from the database and it includes the following
tag

{% include 'test' %}

@liquid_snippets is a hash map which has other liquid variables Ex :
'name' = 'jhon'

I'm using rails 3.0.0
Liquid 2.2.2
and on ubuntu

What am I missing here, can any one help please, thanks in advance

cheers

sameera

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: jruby here?

2010-12-21 Thread Siva Kilaru
I am using Jruby with Rails. Heard that jruby is much faster than ruby 
with rails. But I dont know how fast its going...I didn't experience any 
difference.

But I prefer going with Ruby on Rails where deployment is much easier 
and we can model our own linking and stuff other than working with 
glassfish with war files.

When I run on development with Webrick its fine but when I deploy it on 
glassfish it shows me a lot of errors and as it is my first app with 
jruby and rails on glassfish, it took me a lot of time to figure out 
what exact prblm is which I didnt not experience on my 1st app with ruby 
on rails

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: jruby here?

2010-12-21 Thread Nick Sieger
Make sure you're using the latest Glassfish gem, 1.0.3. The latest release 
fixes a number of issues that have cropped up over the year since the previous 
release.

/Nick
On Dec 21, 2010, at 10:37 , Siva Kilaru wrote:

 I am using Jruby with Rails. Heard that jruby is much faster than ruby 
 with rails. But I dont know how fast its going...I didn't experience any 
 difference.
 
 But I prefer going with Ruby on Rails where deployment is much easier 
 and we can model our own linking and stuff other than working with 
 glassfish with war files.
 
 When I run on development with Webrick its fine but when I deploy it on 
 glassfish it shows me a lot of errors and as it is my first app with 
 jruby and rails on glassfish, it took me a lot of time to figure out 
 what exact prblm is which I didnt not experience on my 1st app with ruby 
 on rails
 
 -- 
 Posted via http://www.ruby-forum.com/.
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to 
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/rubyonrails-talk?hl=en.
 

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Where put require

2010-12-21 Thread Robert Walker
Paul Bergstrom wrote in post #969811:
 Where do I put e g require 'will_paginate' in Rails 3 environment?

http://gembundler.com/rails3.html

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Need suggestion

2010-12-21 Thread Siva Kilaru
Hey guys,

Can you please suggest me a gem that audits my app other than
acts_as_audited.

I am on Rails 3.0.3 with JRuby 1.5.6 and Oracle 11g

When I use acts_as_audited on my model, it gives me an undefined method
'acts_as_audited' error.

So, I just want to find out whether there exists any other gems that
audits.

Thank you

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: jruby here?

2010-12-21 Thread Mauro
On 21 December 2010 17:37, Siva Kilaru li...@ruby-forum.com wrote:
 I am using Jruby with Rails. Heard that jruby is much faster than ruby
 with rails. But I dont know how fast its going...I didn't experience any
 difference.

 But I prefer going with Ruby on Rails where deployment is much easier
 and we can model our own linking and stuff other than working with
 glassfish with war files.

 When I run on development with Webrick its fine but when I deploy it on
 glassfish it shows me a lot of errors and as it is my first app with
 jruby and rails on glassfish, it took me a lot of time to figure out
 what exact prblm is which I didnt not experience on my 1st app with ruby
 on rails


I'm using tomcat for a long time in a linux debian xen virtual
machine, with grails applications and jruby on rails applications
without any problem.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: difference between attr_accesor and attr_accesible

2010-12-21 Thread kirti parihar
hey...thanks for help.

On Tue, Dec 21, 2010 at 7:07 PM, Frederick Cheung 
frederick.che...@gmail.com wrote:



 On Dec 21, 12:20 pm, kp pariharkirt...@gmail.com wrote:
  I m new to ruby language. difference between att_accesor and
  attr_accessible is not clear to me.
 

 They're almost completely unrelated. attr_accessor is part of ruby
 itself and is equivalent to calling attr_writer and attr_reader for
 the same argument(s), ie it creates accessor methods for you

 attr_accessible is a rails thing and is part of rails' mass assignment
 protection (along with attr_protected). It allows you to setup a
 whitelist of attributes that can be mass-assigned (as opposed to
 attr_protected, which sets up a blacklist) so that users can't set
 important attributes they're not supposed to be able to set just by
 manipulating the form data that is posted

 Fred
  thanks for your kind help.
  kp
  (india)

 --
 You received this message because you are subscribed to the Google Groups
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.



-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Need suggestion

2010-12-21 Thread Marnen Laibow-Koser
Siva Kilaru wrote in post #969828:
 Hey guys,

 Can you please suggest me a gem that audits my app other than
 acts_as_audited.

 I am on Rails 3.0.3 with JRuby 1.5.6 and Oracle 11g

 When I use acts_as_audited on my model, it gives me an undefined method
 'acts_as_audited' error.

Sounds like you haven't installed the gem properly.  Perhaps if you 
provide more information, we can help.


 So, I just want to find out whether there exists any other gems that
 audits.

Yes.


 Thank you

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

Sent from my iPhone

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Rails, Ruby, haml, metaprogramming problem

2010-12-21 Thread Ralph Shnelvar
In HAML I have hundreds of lines like the following:

  - xyz = someFuncThatReturnsString('xyz')

and elsewhere

  %div{'id' = xyz}

The above lines work fine.

- - -

Attempting to keep things DRY (Don't repeat yourself) I want to do
something like

  - eval(otherFuncThatReturnsString('xyz'))

where

  otherFuncThatReturnsString('xyz')

returns

  xyz = someFuncThatReturnsString('xyz')

When I do this, HAML no longer sees xyz as being defined when it
attempts to interpret

  %div{'id' = xyz}

What am I doing wrong

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] ActiveRecord relationship ID change

2010-12-21 Thread Leonardo Mateo
Hi guys,
I'm having a problem with a belongs_to relationship.
The thing is:
class Banner  ActiveRecord::Base
  belongs_to :campaign
  ...
end
---
class Campaign  ActiveRecord::Base
  has_one :banner, :dependent = :destroy
  accepts_nested_attributes_for :banner
  ...
end
---
If I do:
campaign.update_attribute(:banner_attributes, {:content = Changed})
campaign.banner.id is incremented by one, asi if a new instance is
being created.

Also, if I do:
campaign.update_attributes({:banner_attributes, {:content = Changed}})

campaign.banner.id is nil.


Any ideas?

This is my rspec.
---
  it should not change banner id when banner updated do
Advertiser = mock
advertiser = mock

Advertiser.stub!(:find).and_return(advertiser)
advertiser.stub!(:id).and_return(1)
advertiser.stub!(:new_record?).and_return(false)
advertiser.stub!(:destroyed?).and_return(false)

banner = Banner.create(:content = Some content, :deep_link =
http://test.com;)
banner.should be_valid

campaign = Campaign.create(:advertiser_id = advertiser.id,
:banner_id = banner.id, :website_code = test)
campaign.banner = banner

campaign.banner.id.should == banner.id

campaign.update_attribute(:banner_attributes, {:content = Changed})

campaign.banner.content.should == Changed
campaign.banner.id.should == banner.id

  end


This is the output for the update_attribute case:
[leona...@anarchie app_core]$ rspec spec/campaign_spec.rb  -d
..F

Failures:
  1) Campaign should not change banner id when banner updated
 Failure/Error: campaign.banner.id.should == banner.id
 expected: 36,
  got: 37 (using ==)
 # ./spec/campaign_spec.rb:93

Finished in 0.23597 seconds
7 examples, 1 failure
---
And this is the output for the update_attributes case:
[leona...@anarchie app_core]$ rspec spec/campaign_spec.rb  -d
..F

Failures:
  1) Campaign should not change banner id when banner updated
 Failure/Error: campaign.banner.id.should == banner.id
 expected: 38,
  got: nil (using ==)
 # ./spec/campaign_spec.rb:93

Finished in 0.20556 seconds
7 examples, 1 failure


Any thoughts?

Thanks a lot in advance!


-- 
Leonardo Mateo.
There's no place like ~

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Rails, Ruby, haml, metaprogramming problem

2010-12-21 Thread Leonardo Mateo
On Tue, Dec 21, 2010 at 3:05 PM, Ralph Shnelvar li...@ruby-forum.com wrote:
 In HAML I have hundreds of lines like the following:

  - xyz = someFuncThatReturnsString('xyz')

 and elsewhere

  %div{'id' = xyz}

 The above lines work fine.

 - - -

 Attempting to keep things DRY (Don't repeat yourself) I want to do
 something like

  - eval(otherFuncThatReturnsString('xyz'))

 where

  otherFuncThatReturnsString('xyz')

 returns

  xyz = someFuncThatReturnsString('xyz')

 When I do this, HAML no longer sees xyz as being defined when it
 attempts to interpret

  %div{'id' = xyz}

 What am I doing wrong
Defining variables on the views.
You should define those variables in the controllers and then have
them in the views or partials passing them as locals if necessary.

-- 
Leonardo Mateo.
There's no place like ~

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Rails, Ruby, haml, metaprogramming problem

2010-12-21 Thread Marnen Laibow-Koser
Ralph Shnelvar wrote in post #969835:
 In HAML I have hundreds of lines like the following:

   - xyz = someFuncThatReturnsString('xyz')

 and elsewhere

   %div{'id' = xyz}

 The above lines work fine.

 - - -

 Attempting to keep things DRY (Don't repeat yourself) I want to do
 something like

   - eval(otherFuncThatReturnsString('xyz'))

 where

   otherFuncThatReturnsString('xyz')

 returns

   xyz = someFuncThatReturnsString('xyz')

 When I do this, HAML no longer sees xyz as being defined when it
 attempts to interpret

   %div{'id' = xyz}

 What am I doing wrong

Almost everything. You're using eval (almost never necessary in Ruby -- 
send is usually what you want).  You're using eval in the view (breaking 
MVC).  You're using dynamic element IDs (questionable but sometimes 
necessary).  You're using camelCase (poor style for Ruby).

And most importantly, you're asking a question that is so abstract that 
it has little to do with your actual goal.

So...what are you actually trying to achieve here?  What's your *actual* 
code like?  What errors or unexpected behavior are you getting?

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

Sent from my iPhone

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Rails, Ruby, haml, metaprogramming problem

2010-12-21 Thread Curtis j Schofield
On Tue, Dec 21, 2010 at 10:05 AM, Ralph Shnelvar li...@ruby-forum.com wrote:
 In HAML I have hundreds of lines like the following:

  - xyz = someFuncThatReturnsString('xyz')

 and elsewhere

  %div{'id' = xyz}

 The above lines work fine.


it will help if you can post a 'gist'

https://gist.github.com



-- 
make haste slowly \
festina lente  \
-
mobile  +1_415_632_6001
cur...@robotarmyma.de
http://robotarmyma.de

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] rails 3 routes

2010-12-21 Thread Curtis j Schofield
On Sun, Dec 19, 2010 at 5:03 PM, Mike C snib...@gmail.com wrote:
 I'm a little confused about custom routes in rails 3. I have a
 variable that I had a default value for in rails 2, and changing it to
 rails 3 version gives this:

 match 'stories/list/:story_list/:search' = 'stories#index', :as =
 'story_list', :story_list = 'popular', :search = nil

 When I use the route, I just call story_list_path(:story_list =
 'search', :search = 'something')

 this worked in rails 2, but I'm getting this error in rails 3:

 No route matches {:story_list=search, :controller=stories}

 I can't find out how to fix this as tutorials on the web just go over
 basic changes and what not.


what is your output of :
% rake routes | grep stories

-- 
make haste slowly \
festina lente  \
-
mobile  +1_415_632_6001
cur...@robotarmyma.de
http://robotarmyma.de

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: rails 3 routes

2010-12-21 Thread Mike C
After a few days of experimenting I think I got it fixed. All I did
was make the search variable optional, and removing it also does the
trick.

On Dec 20, 10:58 pm, daze dmonopol...@gmail.com wrote:
 On Dec 20, 9:13 pm, Marnen Laibow-Koser li...@ruby-forum.com wrote:

  Well, you didn't quote the lines you were replying to, and you didn't
  state what you were wondering...so I'm left wondering how to read your
  mind. :D

  In future, please just ask what you need to ask.

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

 Fine...http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/...

 wondering about how to use match with a route in an admin namespace

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rails 3 cleaning sub menu html

2010-12-21 Thread Mike C
I have some code to allow pages to define sub menus within their
respective html files. Here's the method I have in the application
helper:

  def sub_menu(block)
links ||= []
links  capture(block)
@sub_menu ||= 

links.each do |link|
  @sub_menu += content_tag(:li, link)
end

@sub_menu = content_tag(:ul, @sub_menu, :class = side_menu)
@sub_menu = content_tag(:div, @sub_menu, :class =
side_menu_wrapper)

# concat @sub_menu
  end

In an html file, I can define sub menus like this:

% content_for :sub_menu do %
% sub_menu do %
a href=%= new_story_path % class=side_buttonimg src=/
images/new_story_button.png class=centered alt=New story! //a
% end %
% end %

This worked in Rails 2, but in Rails 3 it just displays the HTML
instead of parsing it, and when I look in the source the HTML is
cleaned. Here's an example:

lt;ligt;  lt;a href=quot;/stories/newquot;
class=quot;side_buttonquot;gt;lt;img src=quot;/images/
new_story_button.pngquot; class=quot;centeredquot; alt=quot;New
story!quot; /gt;lt;/agt;
lt;/ligt;

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



[Rails] Re: rails 3 cleaning sub menu html

2010-12-21 Thread Garrett Lancaster
Sounds like you need to call .html_safe on the return value of your
helper.  In Rails 3, everything is automatically scrubbed.

On Dec 21, 12:50 pm, Mike C snib...@gmail.com wrote:
 I have some code to allow pages to define sub menus within their
 respective html files. Here's the method I have in the application
 helper:

   def sub_menu(block)
     links ||= []
     links  capture(block)
     @sub_menu ||= 

     links.each do |link|
       @sub_menu += content_tag(:li, link)
     end

     @sub_menu = content_tag(:ul, @sub_menu, :class = side_menu)
     @sub_menu = content_tag(:div, @sub_menu, :class =
 side_menu_wrapper)

     # concat @sub_menu
   end

 In an html file, I can define sub menus like this:

 % content_for :sub_menu do %
         % sub_menu do %
                 a href=%= new_story_path % class=side_buttonimg 
 src=/
 images/new_story_button.png class=centered alt=New story! //a
         % end %
 % end %

 This worked in Rails 2, but in Rails 3 it just displays the HTML
 instead of parsing it, and when I look in the source the HTML is
 cleaned. Here's an example:

 lt;ligt;              lt;a href=quot;/stories/newquot;
 class=quot;side_buttonquot;gt;lt;img src=quot;/images/
 new_story_button.pngquot; class=quot;centeredquot; alt=quot;New
 story!quot; /gt;lt;/agt;
 lt;/ligt;

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



Re: [Rails] Re: rails 3 cleaning sub menu html

2010-12-21 Thread Garrett Lancaster
fyi, you can also pass the content into the raw() function.


On Dec 21, 2010, at 1:04 PM, Garrett Lancaster wrote:

 Sounds like you need to call .html_safe on the return value of your
 helper.  In Rails 3, everything is automatically scrubbed.
 
 On Dec 21, 12:50 pm, Mike C snib...@gmail.com wrote:
 I have some code to allow pages to define sub menus within their
 respective html files. Here's the method I have in the application
 helper:
 
   def sub_menu(block)
 links ||= []
 links  capture(block)
 @sub_menu ||= 
 
 links.each do |link|
   @sub_menu += content_tag(:li, link)
 end
 
 @sub_menu = content_tag(:ul, @sub_menu, :class = side_menu)
 @sub_menu = content_tag(:div, @sub_menu, :class =
 side_menu_wrapper)
 
 # concat @sub_menu
   end
 
 In an html file, I can define sub menus like this:
 
 % content_for :sub_menu do %
 % sub_menu do %
 a href=%= new_story_path % class=side_buttonimg 
 src=/
 images/new_story_button.png class=centered alt=New story! //a
 % end %
 % end %
 
 This worked in Rails 2, but in Rails 3 it just displays the HTML
 instead of parsing it, and when I look in the source the HTML is
 cleaned. Here's an example:
 
 lt;ligt;  lt;a href=quot;/stories/newquot;
 class=quot;side_buttonquot;gt;lt;img src=quot;/images/
 new_story_button.pngquot; class=quot;centeredquot; alt=quot;New
 story!quot; /gt;lt;/agt;
 lt;/ligt;
 
 How do I 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-t...@googlegroups.com.
 To unsubscribe from this group, send email to 
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/rubyonrails-talk?hl=en.
 

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object

2010-12-21 Thread John Merlino
 That's one common way of doing it.

Yet, it worked. Basically, visitor makes a request URL, which Rails 
translates into a controller/action sequence. In order to determine fate 
of URL request, we create a rule that matches the URL path of the 
request and determine where to direct that request. It maps requests to 
action methods inside the controllers. The mapper method parses the 
query string as a hash. So when login is part of query string action 
based on user clicking link, a URL request is made, the mapper method in 
turn is called, and points the request to the login method of the users 
class:

  map.login login, :controller = users, :action = login

Since we are using named routing, Rails builds a helper method:


  %= link_to login, login_path %

login method is called of UsersController class:

def login
@user = User.new
if request.post?
  if session[:user] = User.authenticate(params[:user][:login], 
params[:user][:password])
flash[:message]  = Login successful
redirect_to :root
  else
flash[:warning] = Username or password does not exist
  end
end

  end

We instantiate User class and assign the new instance to  instance 
variable @user. Hence, we have a @user object and since during 
instantiation, our new instance inherits from ActiveRecord, the blank 
instance in reality inherits getter setter methods translated from users 
table in database. Hence, we accept parameters in the query string that 
will translate to the data we need (e.g. login and password). Since the 
instance variable inherits from ActiveRecord, it has access to some of 
the built in rails helper methods like label, text_field, 
password_field, submit:

% content_for :login do %
   % form_for @user, :url = { :action = login } do |f|  %
%= error_messages_for 'user' %br/
%= f.label(:user_login, Username)%
 %= f.text_field(:login) %br/
 %= f.label(:user_password, User Password)%
%= f.password_field(:password) %br/
%= f.submit(Login) %

%= link_to 'Register', :action = 'signup' % |
  %= link_to 'Forgot my password', :action = 'forgot_password' %
  % end %
 % end %

The helper methods render html output. User inserts value and gets 
converted to a hash with key/value pairs corresponding to field in table 
to its value. Hence, we do the following in controller:

if request.post?
  if session[:user] = User.authenticate(params[:user][:login], 
params[:user][:password])

When the form is submitted a POST HTTP request is made, and we call the 
class method authenticate on the User class object. We pass in the 
relevant query string information using the params hash.

The authenticate method in turn is called:

  def self.authenticate(login, pass)
   u=find(:first, :conditions=[login = ?, login])
   return nil if u.nil?
   return u if User.encrypt(pass, u.salt)==u.hashed_password
   nil
 end

We use special syntax self to indicate this is a class method and not an 
instance method and therefore can only be called on the class itself. We 
pass our query string arguments into the authenticate argument 
definition as parameters (local variables) login and pass. We perform a 
sql query to our mysql database, searching first record of login field 
that matches value passed. We assign result to local variabnle u. If u 
is nil, we return nil, and the if statement's argument will be converted 
to BOOLEAN false (which I believe is object not a primitive in ruby?):

if session[:user] = User.authenticate(params[:user][:login], 
params[:user][:password])

Hence, else statement is invoked:

flash[:warning] = Username or password does not exist

Otherwise, we return u (the data set of current user):

   return u if User.encrypt(pass, u.salt)==u.hashed_password

We do this if the encrupt method returns a value equal to what the 
hashed_password method's value is.

So returning u will convert the if booleon to true and if statement 
returns immediate block:

flash[:message]  = Login successful
redirect_to :root

The user is logged in successful.

One thing I forgot to mention is we assign the local variable u to the 
session :user:

  if session[:user] = User.authenticate(params[:user][:login], 
params[:user][:password])

Hence, the session has this user stored.

THis is a little unclear to me though:
 session[:user]

We are storing a symbol called :user in sesion associative array. So 
:user is initiaized with vaue of u (whcih is dataset we returned). 
What's the purpose of using symbol here? Why can't we use something else 
like a variable?

THanks for response.

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group 

[Rails] Re: Where put require

2010-12-21 Thread Paul Bergstrom
Can I still use require somewhere without bundler? It's overkill for 
my situation with a few apps of my own. I just want to get started with 
Rails 3, which hasn't been easy.

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Where put require

2010-12-21 Thread David Kahn
On Tue, Dec 21, 2010 at 1:26 PM, Paul Bergstrom li...@ruby-forum.comwrote:

 Can I still use require somewhere without bundler? It's overkill for
 my situation with a few apps of my own. I just want to get started with
 Rails 3, which hasn't been easy.


Fighting Rails will only make Rails 3 harder, oh have I learned not to do
this when not necessary. Bundler was made a first class part of Rails
starting in 3, so if you are going to use Rails 3 you should use it. Its
really not a big deal different than Rails 2 where you declared your gems in
environment.rb. Just include your gems in bundler and run 'bundle install'
in the terminal...


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

 --
 You received this message because you are subscribed to the Google Groups
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.



-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] story based Integration test

2010-12-21 Thread Amador Antonio Cuenca
Hi all, I've been working with *Beginning Rails 3 book, *I'm in the Test
Chapter, and I'm trying to extend the story based integration test.

I've the following:

class UserStoriesTest  ActionDispatch::IntegrationTest

  fixtures :all


  test should emulate articles life-cicle do

admin = registered_user

guest = registered_user


admin.logs_in sphi0...@gmail.com, secret

guest.logs_in gu...@mail.com, secret


admin.creates_article :title = Admin creates an article, :body =
Lorem ipsum dolor sit amet...

guest.creates_article :title = Guest creates an article, :body =
Lorem ipsum dolor sit amet...


admin.comment_article(Article.find_by_title(Admin creates an article))

guest.comment_article(Article.find_by_title(Guest creates an article))



admin.logs_out

guest.logs_out

  end


  private

  def registered_user

open_session do |user|

  def user.logs_in(email, password)

get login_path


assert_response :success

assert_template 'new'


post session_path, :email = email, :password = password


assert_response :redirect

assert_redirected_to root_path


follow_redirect!


assert_response :success

assert_template :index

assert session[:user_id]

  end


  def user.logs_out

get logout_path


assert_response :redirect

assert_redirected_to root_path

assert_nil session[:user]


follow_redirect!


assert_template 'index'

  end


  def user.creates_article(article_hash)

get new_article_path


assert_response :success

assert_template 'new'


post articles_path, :article = article_hash


assert assigns(:article).valid?

assert_response :redirect

assert_redirected_to article_path(assigns(:article))


follow_redirect!


assert_response :success

assert_template 'show'

  end

end

  end

end

So, I want to create another method with the following signature

   def user.comment_article(article)

get new_article_comment_path(article)


 assert_response :success

assert_template 'create'


 post article_comment_path, :comment = {

  :name = Guest,

  :email = gu...@mail.com,

  :body = Lorem ipsum dolor sit amet... }


 assert assigns(:comment).valid?

  end


But, it doesn't work. Can you tell me guys, how to create that method to
test when the user comment an related article.

Regards,
-- 
TSU. Amador Cuenca

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Re: Where put require

2010-12-21 Thread Paul Bergstrom
David Kahn wrote in post #969854:
 On Tue, Dec 21, 2010 at 1:26 PM, Paul Bergstrom
 li...@ruby-forum.comwrote:



 Fighting Rails will only make Rails 3 harder, oh have I learned not to
 do
 this when not necessary. Bundler was made a first class part of Rails
 starting in 3, so if you are going to use Rails 3 you should use it. Its
 really not a big deal different than Rails 2 where you declared your
 gems in
 environment.rb. Just include your gems in bundler and run 'bundle
 install'
 in the terminal...

Maybe it's necessary :-)

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Request for comment on post on SEO QuickStart for Rails

2010-12-21 Thread Michal Burak
Hi,

http://programmers-blog.com/2010/12/21/quick-start-to-seo-for-ruby-on-rails

What do you think about this guys?

I looked through the whole Internet ;) and found nothing simple that
would suit my simple needs. So I did these things on my own and wrote
about the process.

Thanks for any comments!

Regards,
MW.

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: ActiveRecord relationship ID change

2010-12-21 Thread Tim Shaffer
I'm pretty sure you need to pass the ID along with the attributes, otherwise 
Rails creates a new instance:

campaign.update_attribute(:banner_attributes, {:id = banner.id, :content = 
Changed})

instead of 

campaign.update_attribute(:banner_attributes, {:content = Changed})

The other option would be to just update the banner directly:

campaign.banner.content = Changed

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Request for comment on post on SEO QuickStart for Rails

2010-12-21 Thread Philip Hallstrom
 Hi,
 
 http://programmers-blog.com/2010/12/21/quick-start-to-seo-for-ruby-on-rails
 
 What do you think about this guys?
 
 I looked through the whole Internet ;) and found nothing simple that
 would suit my simple needs. So I did these things on my own and wrote
 about the process.

You might add a section on Canonicalization alongside the redirect section you 
have now.

http://www.google.com/support/webmasters/bin/answer.py?hl=enanswer=139066

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Re: Where put require

2010-12-21 Thread David Kahn
On Tue, Dec 21, 2010 at 1:41 PM, Paul Bergstrom li...@ruby-forum.comwrote:

 David Kahn wrote in post #969854:
  On Tue, Dec 21, 2010 at 1:26 PM, Paul Bergstrom
  li...@ruby-forum.comwrote:
 

 
  Fighting Rails will only make Rails 3 harder, oh have I learned not to
  do
  this when not necessary. Bundler was made a first class part of Rails
  starting in 3, so if you are going to use Rails 3 you should use it. Its
  really not a big deal different than Rails 2 where you declared your
  gems in
  environment.rb. Just include your gems in bundler and run 'bundle
  install'
  in the terminal...

 Maybe it's necessary :-)


Just give a try--- I am usually pretty vocal if something really it
troublesome but I have not found such with Bundler, actually I do feel like
it makes my life easier -- just having clarity what is and what is not in
the project.



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

 --
 You received this message because you are subscribed to the Google Groups
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.



-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Where put require

2010-12-21 Thread Marnen Laibow-Koser
Paul Bergstrom wrote in post #969853:
 Can I still use require somewhere without bundler? It's overkill for
 my situation with a few apps of my own. I just want to get started with
 Rails 3, which hasn't been easy.

It hasn't been easy for you because you're trying to fight Rails! 
So...stop fighting Rails.  Stop fighting Bundler.  Learn to do things 
the Rails way.  If you think you can improve on the Rails way, please do 
so -- but do so from a position of knowledge, not a position of 
ignorance.

If you're not willing to do that, then find another Web framework that 
better suits your needs.

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

Sent from my iPhone

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: story based Integration test

2010-12-21 Thread Marnen Laibow-Koser
Amador Antonio Cuenca wrote in post #969855:
 Hi all, I've been working with *Beginning Rails 3 book, *I'm in the Test
 Chapter, and I'm trying to extend the story based integration test.


The best tool for story-based tests is Cucumber.  I highly recommend 
using it instead of Test::Unit's story framework.

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

Sent from my iPhone

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: ActiveRecord relationship ID change

2010-12-21 Thread Leonardo Mateo
On Tue, Dec 21, 2010 at 4:44 PM, Tim Shaffer timshaf...@me.com wrote:
 I'm pretty sure you need to pass the ID along with the attributes, otherwise
 Rails creates a new instance:
Yes, that's pretty much what's happening.
I, actually, was a moron, since I should have see the code in first place.
The update_attributes method in ActiveRecord::Base is stupidly simple
and it's really clear what it does:

2666   def update_attributes(attributes)
2667 
with_transaction_returning_status(:update_attributes_inside_transaction,
attributes)
2668   end
2669
2670   def update_attributes_inside_transaction(attributes)
#:nodoc:
2671 self.attributes = attributes
2672 save
2673   end

Duh! Sorry guys. My bad.
Thanks anyway for your time, Tim.

-- 
Leonardo Mateo.
There's no place like ~

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Errors on installing Rails on windows 7 (32 bit)

2010-12-21 Thread Yngvar Kristiansen
Hi, I'm trying to install Rails, but when installing the Rails package
using Gem, I get some errors. See error log in bottom of this post.

I'm new to Rails as well as Ruby, and was trying to do the steps
described in the official Rails web page at http://rubyonrails.org/community

I'm using Windows 7 (32 bit), and have just installed Ruby 1.8.7 (as
there is curently a bug that prevents me from installing the Gem
package manager on 1.9.2, as described here:
http://rubyforge.org/tracker/index.php?func=detailaid=28744group_id=126atid=575)
and the Gem package manager.

I just want to get Rails running, can anyone help?

-

Command line log:

c:\Tempgem install rails
Successfully installed activesupport-3.0.3
Successfully installed builder-2.1.2
Successfully installed i18n-0.5.0
Successfully installed activemodel-3.0.3
Successfully installed rack-1.2.1
Successfully installed rack-test-0.5.6
Successfully installed rack-mount-0.6.13
Successfully installed tzinfo-0.3.23
Successfully installed abstract-1.0.0
Successfully installed erubis-2.6.6
Successfully installed actionpack-3.0.3
Successfully installed arel-2.0.6
Successfully installed activerecord-3.0.3
Successfully installed activeresource-3.0.3
Successfully installed mime-types-1.16
Successfully installed polyglot-0.3.1
Successfully installed treetop-1.4.9
Successfully installed mail-2.2.12
Successfully installed actionmailer-3.0.3
Successfully installed rake-0.8.7
Successfully installed thor-0.14.6
Successfully installed railties-3.0.3
Successfully installed bundler-1.0.7
Successfully installed rails-3.0.3
24 gems installed
Installing ri documentation for activesupport-3.0.3...
Installing ri documentation for builder-2.1.2...
ERROR:  While generating documentation for builder-2.1.2
... MESSAGE:   Unhandled special: Special: type=17, text=!-- HI --
... RDOC args: --ri --op C:/Ruby187/lib/ruby/gems/1.8/doc/
builder-2.1.2/ri --tit
le Builder -- Easy XML Building --main README --line-numbers --quiet
lib CHANGES
 Rakefile README doc/releases/builder-1.2.4.rdoc doc/releases/
builder-2.0.0.rdoc
 doc/releases/builder-2.1.1.rdoc --title builder-2.1.2 Documentation
(continuing with the rest of the installation)
Installing ri documentation for i18n-0.5.0...
Installing ri documentation for activemodel-3.0.3...
Installing ri documentation for rack-1.2.1...
Installing ri documentation for rack-test-0.5.6...
Installing ri documentation for rack-mount-0.6.13...
Installing ri documentation for tzinfo-0.3.23...
Installing ri documentation for abstract-1.0.0...
Installing ri documentation for erubis-2.6.6...
Installing ri documentation for actionpack-3.0.3...
Installing ri documentation for arel-2.0.6...
Installing ri documentation for activerecord-3.0.3...
ERROR:  While executing gem ... (Errno::EINVAL)
Invalid argument - .//cdesc-.yaml

c:\Tempmd rubysrv

c:\Temprails new rubysrv
   exist
  create  README
  create  Rakefile
  create  config.ru
  create  .gitignore
  create  Gemfile
  create  app
  create  app/controllers/application_controller.rb
  create  app/helpers/application_helper.rb
  create  app/mailers
  create  app/models
  create  app/views/layouts/application.html.erb
  create  config
  create  config/routes.rb
  create  config/application.rb
  create  config/environment.rb
  create  config/environments
  create  config/environments/development.rb
  create  config/environments/production.rb
  create  config/environments/test.rb
  create  config/initializers
  create  config/initializers/backtrace_silencers.rb
  create  config/initializers/inflections.rb
  create  config/initializers/mime_types.rb
  create  config/initializers/secret_token.rb
  create  config/initializers/session_store.rb
  create  config/locales
  create  config/locales/en.yml
  create  config/boot.rb
  create  config/database.yml
  create  db
  create  db/seeds.rb
  create  doc
  create  doc/README_FOR_APP
  create  lib
  create  lib/tasks
  create  lib/tasks/.gitkeep
  create  log
  create  log/server.log
  create  log/production.log
  create  log/development.log
  create  log/test.log
  create  public
  create  public/404.html
  create  public/422.html
  create  public/500.html
  create  public/favicon.ico
  create  public/index.html
  create  public/robots.txt
  create  public/images
  create  public/images/rails.png
  create  public/stylesheets
  create  public/stylesheets/.gitkeep
  create  public/javascripts
  create  public/javascripts/application.js
  create  public/javascripts/controls.js
  create  public/javascripts/dragdrop.js
  create  public/javascripts/effects.js
  create  public/javascripts/prototype.js
  create  public/javascripts/rails.js
  create  script
  create  script/rails
  create  test
  create  

[Rails] Duration

2010-12-21 Thread Jack Waugh
It looks as though if you ask a DateTime to add something to itself,
it looks at the something, and if it's an integer, it interprets it as
a duration in seconds, but if it's a Rational, it interprets it as a
duration in days.

It's inconsistent.  Why didn't the designers settle on one type for
durations and one way to interpret them?  What should one store in a
database for a duration?  What rules should one follow to avoid being
tripped up by numbers being interpreted as different measures
depending on accidental features such as the numbers'
representations?  This is very disappointing; engineering designs
should make logical sense.

 x = DateTime.now
= Tue, 21 Dec 2010 12:10:14 -0500
 d1 = 1.second
= 1 second
 y = x + d1
= Tue, 21 Dec 2010 12:10:15 -0500
 y.class
= DateTime
 y - x
= Rational(1, 86400)
 d2 = y - x
= Rational(1, 86400)
 d1.class
= Fixnum
 d1
= 1 second
 0 + d1
= 1
 d1 == d2
= false
 (x + d1) == (x + d2)
= true

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Issues doing an insert into mysql

2010-12-21 Thread juhi
Everything looks ok, I can not see errors, I do not see anything in
the table.

This is my environment settings.

Ruby version1.8.6 (i386-linux)
RubyGems version1.3.7
Rack version1.0
Rails version   2.3.4
Active Record version   2.3.4
Active Resource version 2.3.4
Action Mailer version   2.3.4
Active Support version  2.3.4
Application root/home/stud/fun_facts
Environment development
Database adaptermysql
Database schema version 20101120032325

Out put from server:

= Booting Mongrel
= Rails 2.3.4 application starting on http://0.0.0.0:3000
= Call with -d to detach
= Ctrl-C to shutdown server
  SQL (309.9ms)   SET NAMES 'utf8'
  SQL (0.4ms)   SET SQL_AUTO_IS_NULL=0


Processing FactController#add (for 127.0.0.1 at 2010-12-21 13:45:06)
[GET]
  Fact Columns (714.5ms)   SHOW FIELDS FROM `facts`
  SQL (3.3ms)   BEGIN
  SQL (1.5ms)   ROLLBACK
Rendering fact/add

Processing FactController#add (for 127.0.0.1 at 2010-12-21 13:45:50)
[POST]
  Parameters: {commit=Add Fact,
authenticity_token=O9D0iM9ouiEZdU+98pkDh6BGunEltXuaoUNTVU2ezRs=,
fact={fact=This is a fun fact 4., screen_name=Denter,
email=den...@email.com}}
  Fact Columns (3.5ms)   SHOW FIELDS FROM `facts`
  SQL (0.2ms)   BEGIN
  SQL (0.3ms)   ROLLBACK
Rendering fact/add

I am not sure why we are getting the rollback.

The debug setting on the page show that I am submitting the data.

--- !map:HashWithIndifferentAccess
commit: Add Fact
authenticity_token: O9D0iM9ouiEZdU+98pkDh6BGunEltXuaoUNTVU2ezRs=
action: add
fact: !map:HashWithIndifferentAccess
  fact: This is a fun fact 4.
  screen_name: Denter
  email: den...@email.com
controller: fact

I am not sure what is going wrong.

My controller .

class FactController  ApplicationController
  def index
 @title = Index
  end

  def add
 @title = Add Facts

  @fact = Fact.new(params[:screen_name])

  respond_to do |format|
  if @fact.save
format.html {flash[:notice] = 'Fact was successfully added.',
redirect_to(@fact) }
format.xml  { render :xml = @fact, :status
= :created, :location = @fact }
  else
format.html { render :action = add }
format.xml  { render :xml = @fact.errors, :status
= :unprocessable_entity }
  end
end
  end

end


Thanks for the help!

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Rails - escape_javascript without all the \n\n\n\n\n

2010-12-21 Thread CuriousNewbie
Hello, I'm using escape_javascript to return a partial to the browser
via ajax.

Something like:

$(#inject).html(%=escape_javascript(render :partial =feed/
index)%);

Problem is escape_javascript ends up outputing all kinds of wasted
space like

\n\n\n\n\n\n

Is there anyway in Rails to escape_javascript more efficiently? No
need for \n or long gaps of spaces?

Thanks

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Duration

2010-12-21 Thread Frederick Cheung


On Dec 21, 5:17 pm, Jack Waugh 7aq3z2h...@gmail.com wrote:
 It looks as though if you ask a DateTime to add something to itself,
 it looks at the something, and if it's an integer, it interprets it as
 a duration in seconds, but if it's a Rational, it interprets it as a
 duration in days.

That's not actually the whole store - If you did DateTime.now + 1 then
you would get 1 day after now.
The key is that 1.second (and similarly 3.days, 2.hours + 6.minutes
etc) aren't integers - they're ActiveSupport::Duration objects.
They quite often pretend to be integers (the number of seconds
represented by the duration - although this is obviously dodgy if the
duration is something like 1 month), largely because that's quite
convenient when dealing with Time objects and I suspect because of
backwards compatibility (at one point in Rails' history
the .second/.day... methods were just convenience methods that
returned the corresponding number of seconds)


 It's inconsistent.  Why didn't the designers settle on one type for
 durations and one way to interpret them?  What should one store in a
 database for a duration?  What rules should one follow to avoid being
 tripped up by numbers being interpreted as different measures
 depending on accidental features such as the numbers'
 representations?  This is very disappointing; engineering designs
 should make logical sense.

It depends on what the duration represents. Sometimes you really do
just mean some fixed length of time, so storing a integer number of
seconds is good enough. It's often more complicated though, for
example if a duration is 1 month then your users might expect the 3rd
october to be followed by 3rd november and then by the 3rd of december
even though those are actually different numbers of seconds. Similarly
users will often expect that things that are 1 day long will end/start
on the same time every day, even though when clocks go back/forward a
day in local time is actually 23/25 hours long.

Fred




  x = DateTime.now

 = Tue, 21 Dec 2010 12:10:14 -0500 d1 = 1.second
 = 1 second
  y = x + d1

 = Tue, 21 Dec 2010 12:10:15 -0500 y.class
 = DateTime
  y - x

 = Rational(1, 86400) d2 = y - x

 = Rational(1, 86400) d1.class
 = Fixnum
  d1
 = 1 second
  0 + d1
 = 1
  d1 == d2
 = false
  (x + d1) == (x + d2)

 = true

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Issues doing an insert into mysql

2010-12-21 Thread Philip Hallstrom

On Dec 21, 2010, at 12:05 PM, juhi wrote:

 Everything looks ok, I can not see errors, I do not see anything in
 the table.
 
 This is my environment settings.
 
 Ruby version  1.8.6 (i386-linux)
 RubyGems version  1.3.7
 Rack version  1.0
 Rails version 2.3.4
 Active Record version 2.3.4
 Active Resource version   2.3.4
 Action Mailer version 2.3.4
 Active Support version2.3.4
 Application root  /home/stud/fun_facts
 Environment   development
 Database adapter  mysql
 Database schema version   20101120032325
 
 Out put from server:
 
 = Booting Mongrel
 = Rails 2.3.4 application starting on http://0.0.0.0:3000
 = Call with -d to detach
 = Ctrl-C to shutdown server
  SQL (309.9ms)   SET NAMES 'utf8'
  SQL (0.4ms)   SET SQL_AUTO_IS_NULL=0
 
 
 Processing FactController#add (for 127.0.0.1 at 2010-12-21 13:45:06)
 [GET]
  Fact Columns (714.5ms)   SHOW FIELDS FROM `facts`
  SQL (3.3ms)   BEGIN
  SQL (1.5ms)   ROLLBACK
 Rendering fact/add
 
 Processing FactController#add (for 127.0.0.1 at 2010-12-21 13:45:50)
 [POST]
  Parameters: {commit=Add Fact,
 authenticity_token=O9D0iM9ouiEZdU+98pkDh6BGunEltXuaoUNTVU2ezRs=,
 fact={fact=This is a fun fact 4., screen_name=Denter,
 email=den...@email.com}}
  Fact Columns (3.5ms)   SHOW FIELDS FROM `facts`
  SQL (0.2ms)   BEGIN
  SQL (0.3ms)   ROLLBACK
 Rendering fact/add
 
 I am not sure why we are getting the rollback.
 
 The debug setting on the page show that I am submitting the data.
 
 --- !map:HashWithIndifferentAccess
 commit: Add Fact
 authenticity_token: O9D0iM9ouiEZdU+98pkDh6BGunEltXuaoUNTVU2ezRs=
 action: add
 fact: !map:HashWithIndifferentAccess
  fact: This is a fun fact 4.
  screen_name: Denter
  email: den...@email.com
 controller: fact
 
 I am not sure what is going wrong.
 
 My controller .
 
 class FactController  ApplicationController
  def index
 @title = Index
  end
 
  def add
 @title = Add Facts
 
 @fact = Fact.new(params[:screen_name])

params[:screen_name] doesn't exist.  I think you want params[:fact]



  respond_to do |format|
  if @fact.save
format.html {flash[:notice] = 'Fact was successfully added.',
 redirect_to(@fact) }
format.xml  { render :xml = @fact, :status
 = :created, :location = @fact }
  else
format.html { render :action = add }
format.xml  { render :xml = @fact.errors, :status
 = :unprocessable_entity }
  end
end
  end
 
 end
 
 
 Thanks for the help!
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to 
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/rubyonrails-talk?hl=en.
 

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Rails - escape_javascript without all the \n\n\n\n\n

2010-12-21 Thread Frederick Cheung


On Dec 21, 8:19 pm, CuriousNewbie bhellm...@gmail.com wrote:
 Hello, I'm using escape_javascript to return a partial to the browser
 via ajax.

 Something like:

     $(#inject).html(%=escape_javascript(render :partial =feed/
 index)%);

 Problem is escape_javascript ends up outputing all kinds of wasted
 space like

     \n\n\n\n\n                \n

 Is there anyway in Rails to escape_javascript more efficiently? No
 need for \n or long gaps of spaces?

I think you should be looking at your template rather than
escape_javascript - escape_javascript is just faithfully reproducing
what has been given to it.  You can use -% instead of % in some
constructs to avoid blank lines

Fred



 Thanks

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] ArgumentError database.yml

2010-12-21 Thread Barb
Hi,

I have a new install of rails 3.0.3 on Snow Leopard.   When I first
power up the rails server and hit a page I get the following error.  A
subsequent hit to the same page results in a rendered page with no
error.   I've tried various adapters with the same result.

Thanks


ArgumentError

syntax error on line 3, col 9: `adapter: postgresql'

Rails.root: /Users/steve/Dropbox/Prototypes/Rails/first



database.yml:

# SQLite version 3.x
#   gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
adapter: postgresql
encoding: utf8
host: localhost
username: postgres
password:
template: template0
database: mydb

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: ArgumentError database.yml

2010-12-21 Thread Frederick Cheung


On Dec 21, 8:17 pm, Barb barbaris...@gmail.com wrote:
 Hi,

 I have a new install of rails 3.0.3 on Snow Leopard.   When I first
 power up the rails server and hit a page I get the following error.  A
 subsequent hit to the same page results in a rendered page with no
 error.   I've tried various adapters with the same result.

There's a syntax error in your yaml file. Make sure you are using
spaces rather than tabs and that there aren't any nasty invisible
characters hanging around

Fred

 Thanks

 ArgumentError

 syntax error on line 3, col 9: `        adapter: postgresql'

 Rails.root: /Users/steve/Dropbox/Prototypes/Rails/first

 database.yml:

 # SQLite version 3.x
 #   gem install sqlite3-ruby (not necessary on OS X Leopard)
 development:
         adapter: postgresql
         encoding: utf8
         host: localhost
         username: postgres
         password:
         template: template0
         database: mydb

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: How to start application from cmd.exe at windows startup ???

2010-12-21 Thread Maxime
Hello and thanks to all for your answers, I couldn't expect so many
answers after a single day !

I need to run this application on Windows because it's not on a server
but in a desktop computer in office used as workstation.

I finally found a file in the instantrail root folder (d'ont know
why not before...) : use_ruby.cmd which loads PATH as you told me

So from this i created a batch file loaded at windows startup with
this PATH and commands to start my ruby application.

I know there is a strong active RoR community which could help me in
the future if needed.

Best,

Max

On 20 déc, 14:16, Maxime Calay maxime.ca...@gmail.com wrote:
 Hello,

 I searched three hours how to start my RoR application automatically as
 windows starts. No information about this on internet. Maybe it's too easy.
 Not for me !

 I have installed InstantRails2.0 and i know there is a menu to start command
 prompt with ruby, but how to access this command prompt in command line from
 cmd.exe ???

 If i run cmd.exe, then go to rails app directory and type ruby
 script/server it doesn't work because ruby command is not recognized.

 I need to start automatically my ruby application at windows startup
 (session) !

 Thank you for your answers

 Max

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Problem with validates uniqueness and accented characters

2010-12-21 Thread Victor Cisneiros
I tried running on my linux VPS with Ruby 1.9.2 and the mysql2 gem and 
the problem still persists

The funny thing is that I have a view where you can filter all the 
clients and if I make it filter this particular client by running this 
query

SELECT `clients`.* FROM `clients` WHERE (nome LIKE '%João Victor 
Santos%') ORDER BY nome ASC LIMIT 30 OFFSET 0

It correctly returns 1 row

I'm starting to think the problem is with the BINARY in the validates 
uniqueness query, anyone knows a way to monkey-patch it to remove the 
BINARY keyword?

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: ArgumentError database.yml

2010-12-21 Thread Barb
Ah, that was it.  There were some hidden tabs in there.  Very picky.

Thanks.

On Dec 21, 9:31 pm, Frederick Cheung frederick.che...@gmail.com
wrote:
 On Dec 21, 8:17 pm, Barb barbaris...@gmail.com wrote: Hi,

  I have a new install of rails 3.0.3 on Snow Leopard.   When I first
  power up the rails server and hit a page I get the following error.  A
  subsequent hit to the same page results in a rendered page with no
  error.   I've tried various adapters with the same result.

 There's a syntax error in your yaml file. Make sure you are using
 spaces rather than tabs and that there aren't any nasty invisible
 characters hanging around

 Fred







  Thanks

  ArgumentError

  syntax error on line 3, col 9: `        adapter: postgresql'

  Rails.root: /Users/steve/Dropbox/Prototypes/Rails/first

  database.yml:

  # SQLite version 3.x
  #   gem install sqlite3-ruby (not necessary on OS X Leopard)
  development:
          adapter: postgresql
          encoding: utf8
          host: localhost
          username: postgres
          password:
          template: template0
          database: mydb

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Rails - escape_javascript without all the \n\n\n\n\n

2010-12-21 Thread Marnen Laibow-Koser
CuriousNewbie wrote in post #969870:
 Hello, I'm using escape_javascript to return a partial to the browser
 via ajax.

 Something like:

 $(#inject).html(%=escape_javascript(render :partial =feed/
 index)%);

Don't do that.  Keep your JavaScript files static.  ERb in JavaScript is 
a bad idea.

In this case, put the HTML in a hidden div with a known ID, then have 
the JS read that div.

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

Sent from my iPhone

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Problem with validates uniqueness and accented characters

2010-12-21 Thread Marnen Laibow-Koser
Please quote when replying.

Victor Cisneiros wrote in post #969879:
 I tried running on my linux VPS with Ruby 1.9.2 and the mysql2 gem and
 the problem still persists

 The funny thing is that I have a view where you can filter all the
 clients and if I make it filter this particular client by running this
 query

 SELECT `clients`.* FROM `clients` WHERE (nome LIKE '%João Victor
 Santos%') ORDER BY nome ASC LIMIT 30 OFFSET 0

 It correctly returns 1 row

 I'm starting to think the problem is with the BINARY in the validates
 uniqueness query, anyone knows a way to monkey-patch it to remove the
 BINARY keyword?

That's probably not the issue.  Did you investigate the encodings as I 
suggested in my earlier post?

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

Sent from my iPhone

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: How to start application from cmd.exe at windows startup?

2010-12-21 Thread Marnen Laibow-Koser
Maxime wrote in post #969877:
 Hello and thanks to all for your answers, I couldn't expect so many
 answers after a single day !

 I need to run this application on Windows because it's not on a server
 but in a desktop computer in office used as workstation.


Why are you running a Rails application in that sort of context (unless 
it's for development)?

And even in that case, I'd strongly urge the use of a *nix VM.

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

Sent from my iPhone

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Problem with validates uniqueness and accented characters

2010-12-21 Thread Victor Cisneiros
 That's probably not the issue.  Did you investigate the encodings as I
 suggested in my earlier post?

I don't have any encoding issue except on this query

Anyway I found out that if I put
validates :nome, :presence = true, :uniqueness = { :case_sensitive = 
false }

instead of
validates :nome, :presence = true, :uniqueness = true

The query changes and doesn't use BINARY anymore and guess what, it now 
works

Here is the generated sql now

SELECT `clients`.`id` FROM `clients` WHERE (LOWER(`clients`.`nome`) = 
LOWER('João Victor Santos')) LIMIT 1

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Problem with validates uniqueness and accented characters

2010-12-21 Thread Frederick Cheung

On Dec 21, 8:48 pm, Marnen Laibow-Koser li...@ruby-forum.com wrote:

 Victor Cisneiros wrote in post #969879:

  I tried running on my linux VPS with Ruby 1.9.2 and the mysql2 gem and
  the problem still persists

  The funny thing is that I have a view where you can filter all the
  clients and if I make it filter this particular client by running this
  query

  SELECT `clients`.* FROM `clients` WHERE (nome LIKE '%João Victor
  Santos%') ORDER BY nome ASC LIMIT 30 OFFSET 0

  It correctly returns 1 row

  I'm starting to think the problem is with the BINARY in the validates
  uniqueness query, anyone knows a way to monkey-patch it to remove the
  BINARY keyword?

 That's probably not the issue.  Did you investigate the encodings as I
 suggested in my earlier post?

It could be/ BINARY forces the comparison to be done byte by byte, but
(assuming the column is a utf8 one) the character ã can be represented
with more than one sequence of bytes.

Fred

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Duration

2010-12-21 Thread Marnen Laibow-Koser
Jack Waugh wrote in post #969867:
 It looks as though if you ask a DateTime to add something to itself,
 it looks at the something, and if it's an integer, it interprets it as
 a duration in seconds, but if it's a Rational, it interprets it as a
 duration in days.

 It's inconsistent.  Why didn't the designers settle on one type for
 durations and one way to interpret them?

Adding a dimensionless number to a measurement with units is asking for 
trouble.  Just specify units and you'll be fine.

 What should one store in a
 database for a duration?

Anything you like.  Use composed_of if necessary.

  What rules should one follow to avoid being
 tripped up by numbers being interpreted as different measures
 depending on accidental features such as the numbers'
 representations?

Use units.

  This is very disappointing; engineering designs
 should make logical sense.

It makes lots of sense to specify units (and as Fred said, 1.hour is a 
Duration, not a Fixnum).   What doesn't make sense is expecting the sum 
of a Time and a Fixnum to be anything but undefined.

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

Sent from my iPhone

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Rails - escape_javascript without all the \n\n\n\n\n

2010-12-21 Thread Garrett Lancaster
I happen to disagree completely, dynamic javascript is very helpful.  I have 
never had the whitespace issue, however, so I would perhaps look to editing 
your partial.

On Dec 21, 2010, at 2:46 PM, Marnen Laibow-Koser wrote:

 CuriousNewbie wrote in post #969870:
 Hello, I'm using escape_javascript to return a partial to the browser
 via ajax.
 
 Something like:
 
$(#inject).html(%=escape_javascript(render :partial =feed/
 index)%);
 
 Don't do that.  Keep your JavaScript files static.  ERb in JavaScript is 
 a bad idea.
 
 In this case, put the HTML in a hidden div with a known ID, then have 
 the JS read that div.
 
 Best,
 -- 
 Marnen Laibow-Koser
 http://www.marnen.org
 mar...@marnen.org
 
 Sent from my iPhone
 
 -- 
 Posted via http://www.ruby-forum.com/.
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to 
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/rubyonrails-talk?hl=en.
 

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Where put require

2010-12-21 Thread Paul Bergstrom
Marnen Laibow-Koser wrote in post #969862:

 It hasn't been easy for you because you're trying to fight Rails!
 So...stop fighting Rails.  Stop fighting Bundler.  Learn to do things
 the Rails way.  If you think you can improve on the Rails way, please do
 so -- but do so from a position of knowledge, not a position of
 ignorance.

 If you're not willing to do that, then find another Web framework that
 better suits your needs.

Haven't I ask you not to answer my posts? Why can't you respect that?

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Rails - escape_javascript without all the \n\n\n\n\n

2010-12-21 Thread Marnen Laibow-Koser
Please quote when replying.

Garrett Lancaster wrote in post #969887:
 I happen to disagree completely, dynamic javascript is very helpful.

Yes -- if your overall design is flawed.  I've done complex Ajax 
development (not with Rails, though) and never needed dynamic JS.  I 
maintain that dynamic JS is a design smell, and that the overall design 
should be corrected if dynamic JS starts to look like the appropriate 
solution.

Under what circumstances do you think dynamic JS is appropriate?

  I
 have never had the whitespace issue, however, so I would perhaps look to
 editing your partial.

Indeed.  Or even a JS minifier.

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



Re: [Rails] Re: How to start application from cmd.exe at windows startup?

2010-12-21 Thread Colin Law
On 21 December 2010 20:50, Marnen Laibow-Koser li...@ruby-forum.com wrote:
 Maxime wrote in post #969877:
 Hello and thanks to all for your answers, I couldn't expect so many
 answers after a single day !

 I need to run this application on Windows because it's not on a server
 but in a desktop computer in office used as workstation.


 Why are you running a Rails application in that sort of context (unless
 it's for development)?

I do this also (on Ubuntu though, not Windows of course).  I have
several apps that I run as if they were desktop apps on my PC.  One
displays data from my weather station for example.  A cron task
updates the database from the weather station and the rails app
displays the data and provides administrative operations.  A
conventional desktop application might be more efficient but doing it
this way gives me the option of putting the database and the app on a
server which would then allow access via the internet.

Colin


 And even in that case, I'd strongly urge the use of a *nix VM.

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

 Sent from my iPhone

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

 --
 You received this message because you are subscribed to the Google Groups 
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to 
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/rubyonrails-talk?hl=en.



-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Where put require

2010-12-21 Thread Marnen Laibow-Koser
Paul Bergstrom wrote in post #969888:
 Marnen Laibow-Koser wrote in post #969862:

 It hasn't been easy for you because you're trying to fight Rails!
 So...stop fighting Rails.  Stop fighting Bundler.  Learn to do things
 the Rails way.  If you think you can improve on the Rails way, please do
 so -- but do so from a position of knowledge, not a position of
 ignorance.

 If you're not willing to do that, then find another Web framework that
 better suits your needs.

 Haven't I ask you not to answer my posts?

I didn't realize it was a blanket prohibition.

 Why can't you respect that?

I can't respect the idea that you get to decide who answers you when you 
post on an unmoderated public list.  If you don't want answers from the 
public, don't post here.

If you have a problem with something I said, or if you think I'm wrong, 
please feel free to tell me.  If you want to killfile me, that's your 
right too.  But ad hominem invalidation is silly.

Oh, wait, I can't answer those direct questions from you.  Damn. ;

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



[Rails] Re: Problem with validates uniqueness and accented characters

2010-12-21 Thread Marnen Laibow-Koser
Frederick Cheung wrote in post #969886:
 On Dec 21, 8:48pm, Marnen Laibow-Koser li...@ruby-forum.com wrote:
  SELECT `clients`.* FROM `clients` WHERE (nome LIKE '%João Victor
  Santos%') ORDER BY nome ASC LIMIT 30 OFFSET 0

  It correctly returns 1 row

  I'm starting to think the problem is with the BINARY in the validates
  uniqueness query, anyone knows a way to monkey-patch it to remove the
  BINARY keyword?

 That's probably not the issue. Did you investigate the encodings as I
 suggested in my earlier post?

 It could be/ BINARY forces the comparison to be done byte by byte, but
 (assuming the column is a utf8 one) the character  can be represented
 with more than one sequence of bytes.


Oh, that's a really good point.

 Fred

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



Re: [Rails] Re: Where put require

2010-12-21 Thread Michael Pavling
On 21 December 2010 21:06, Marnen Laibow-Koser li...@ruby-forum.com wrote:
 Paul Bergstrom wrote in post #969888:
 Marnen Laibow-Koser wrote in post #969862:

 It hasn't been easy for you because you're trying to fight Rails!
 snip what everyone's telling the OP

 Haven't I ask you not to answer my posts?

*ker-plonk* (the sound of an addition to my killfile :-/

...it's a shame really... some people just don't seem to want help.
What's the sense in using software that declaims convention over
configuration, then ignoring conventions, and moaning the
configuration is too hard?

 Why can't you respect that?

 I can't respect the idea that you get to decide who answers you when you
 post on an unmoderated public list.  If you don't want answers from the
 public, don't post here.

+1

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Re: Re: Where put require

2010-12-21 Thread Paul Bergstrom
David Kahn wrote in post #969861:
 On Tue, Dec 21, 2010 at 1:41 PM, Paul Bergstrom


 Just give a try--- I am usually pretty vocal if something really it
 troublesome but I have not found such with Bundler, actually I do feel
 like
 it makes my life easier -- just having clarity what is and what is not
 in
 the project.

I see what you mean. But let me give you my view.

I had an easy life with Rails 2 but now with Rails 3 it has become more 
complex. I just wondered if there was a way to leave bundler out and 
just use require, as before. If there is, then what's the problem? Isn't 
that the easy way ahead? I can learn bundler later on if and when 
needed.

I like simplicity. That's why I got fond of ruby and then rails over 
php. But I don't think it's going the right way, even though I can see 
the need for a tool like bundler. I would prefer that Rails keep it 
simple but let users add tools like bundler if wanted. My setup in Rails 
2 was easier. Trust me.

Bundler reminds me of gem vs plugin. Do you see my thought?

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Re: Re: Where put require

2010-12-21 Thread Marnen Laibow-Koser
Paul Bergstrom wrote in post #969896:
 David Kahn wrote in post #969861:
 On Tue, Dec 21, 2010 at 1:41 PM, Paul Bergstrom


 Just give a try--- I am usually pretty vocal if something really it
 troublesome but I have not found such with Bundler, actually I do feel
 like
 it makes my life easier -- just having clarity what is and what is not
 in
 the project.

 I see what you mean. But let me give you my view.

 I had an easy life with Rails 2 but now with Rails 3 it has become more
 complex. I just wondered if there was a way to leave bundler out and
 just use require, as before. If there is, then what's the problem? Isn't
 that the easy way ahead? I can learn bundler later on if and when
 needed.

Apparently there isn't.  That's what people have been trying to tell 
you, and that's what you have apparently been ignoring.

Anyway, if you want to learn Rails 3, then learn it, don't kludge around 
it!  If, after having learned it, you think there's a better way to do 
things, then do so.


 I like simplicity. That's why I got fond of ruby and then rails over
 php. But I don't think it's going the right way, even though I can see
 the need for a tool like bundler. I would prefer that Rails keep it
 simple but let users add tools like bundler if wanted. My setup in Rails
 2 was easier.

No one is stopping you from continuing to use Rails 2, or from using 
another Web framework altogether.  If Rails 3 is getting in your way, 
then please don't use it.

However, please invest some honest effort into learning Rails 3 -- on 
its own merits -- before making that decision.

 Trust me.

Why? :)


 Bundler reminds me of gem vs plugin. Do you see my thought?

No.  How about making it explicit?

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



[Rails] Re: Re: Where put require

2010-12-21 Thread Marnen Laibow-Koser
Michael Pavling wrote in post #969893:
 On 21 December 2010 21:06, Marnen Laibow-Koser li...@ruby-forum.com
 wrote:
 Paul Bergstrom wrote in post #969888:
 Marnen Laibow-Koser wrote in post #969862:

 It hasn't been easy for you because you're trying to fight Rails!
 snip what everyone's telling the OP

 Haven't I ask you not to answer my posts?

 *ker-plonk* (the sound of an addition to my killfile :-/

 ...it's a shame really... some people just don't seem to want help.
 What's the sense in using software that declaims convention over
 configuration, then ignoring conventions, and moaning the
 configuration is too hard?

Well put.

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



[Rails] Where to find bookmark in controller

2010-12-21 Thread Ralph Shnelvar
If I do a
  link_to 'XYZ', '/usage/Faq.html#GB_limit'
in my view ...

can I detect GB_Limit in my controller?  Where?

I know I can do
  link_to 'XYZ', '/usage/Faq.html?bookmark=GB_limit'
and I can find GB_limit in params[:bookmark].

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Where to find bookmark in controller

2010-12-21 Thread Marnen Laibow-Koser
Ralph Shnelvar wrote in post #969900:
 If I do a
   link_to 'XYZ', '/usage/Faq.html#GB_limit'
 in my view ...

 can I detect GB_Limit in my controller?

Not to my knowledge.  I believe -- and I hope someone will correct me if 
I'm wrong -- that the browser removes the #fragment section of the URL, 
and merely does a HTTP GET '/usage/Faq.html', so that the server never 
even sees the #fragment.  Therefore, the only way I'm aware of to 
process the #fragment is to use client-side JavaScript.

(BTW, you should really be using lowercase for your HTML filenames, or 
else you're likely to run into case sensitivity issues.)

  Where?

 I know I can do
   link_to 'XYZ', '/usage/Faq.html?bookmark=GB_limit'
 and I can find GB_limit in params[:bookmark].

Right.  The ?query=string is meant for the server.  The #fragment is 
meant for the client.  That's just how HTTP URLs work.

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



Re: [Rails] Re: Re: Re: Where put require

2010-12-21 Thread David Kahn
On Tue, Dec 21, 2010 at 3:30 PM, Paul Bergstrom li...@ruby-forum.comwrote:

 David Kahn wrote in post #969861:
  On Tue, Dec 21, 2010 at 1:41 PM, Paul Bergstrom

 
  Just give a try--- I am usually pretty vocal if something really it
  troublesome but I have not found such with Bundler, actually I do feel
  like
  it makes my life easier -- just having clarity what is and what is not
  in
  the project.

 I see what you mean. But let me give you my view.

 I had an easy life with Rails 2 but now with Rails 3 it has become more
 complex. I just wondered if there was a way to leave bundler out and
 just use require, as before. If there is, then what's the problem? Isn't
 that the easy way ahead? I can learn bundler later on if and when
 needed.

 I like simplicity. That's why I got fond of ruby and then rails over
 php. But I don't think it's going the right way, even though I can see
 the need for a tool like bundler. I would prefer that Rails keep it
 simple but let users add tools like bundler if wanted. My setup in Rails
 2 was easier. Trust me.


This is something I have thought about. I came from the .NET world for a lot
of same reasons. I have been using Rails 3 for a few months intensively and
I think you should give it an honest shot. There are changes and there is a
learning curve but it is not that bad. My challenge is that I also took on
Rspec, Cucumber, Capybara, xpath and who knows what else at the same time
and this *was* painful but I am seeing that it has made me stronger. I have
ended up dropping Cucumber for Steak and this has helped. Anyhow, I suspect
that you will find that it just seems easier in 2 because it is what you are
used to.

Also... if you really want to simplify, check out developing a pure rack app
or with Sinatra or the like... pretty cool stuff and you feel closer to the
road ;)


 Bundler reminds me of gem vs plugin. Do you see my thought?


I am probably wrong but it seems to me that plugins are and will go away as
since each app has their own bundle the idea of plugins gets to be
insignificant, especially if you use RVM (and RVM *is* for sure worth the
effort to pick up).



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

 --
 You received this message because you are subscribed to the Google Groups
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.



-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Where put require

2010-12-21 Thread Paul Bergstrom
Marnen Laibow-Koser wrote in post #969891:

 I didn't realize it was a blanket prohibition.

 Why can't you respect that?

 I can't respect the idea that you get to decide who answers you when you
 post on an unmoderated public list.  If you don't want answers from the
 public, don't post here.

I only ask you to respect me as a fellow human being, asking you to 
behave and interact with other people in a kind, respectful and warm 
manner. :-) Is that too much to ask?

Several times when I have asked a question you have given me a question 
back like why do you want to do that? instead of just answering my 
question. Once or twice is nothing but not all the time.

I didn't ask for your opinion about bundler. I asked if there is a way 
to require a gem but keep the gems in one place, like before. I don't 
understand why that question would be so hard to understand. Why make it 
so complicated Marnen?

I'm sure bundler is wonderful, but I could do without it. Is that ok 
with you? You seem like a person who get nervous when someone is not 
following the rules. Is that true? Is that the problem here?

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Re: Re: Re: Where put require

2010-12-21 Thread Marnen Laibow-Koser
David Kahn wrote in post #969902:
[...]
 I
 have
 ended up dropping Cucumber for Steak and this has helped.
[...]

Now that's just a terrible idea.  I don't want to hijack this thread, 
but I'll be happy to discuss (in a different thread) why I think Steak 
is fundamentally misconceived.

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



[Rails] Consider using bundle exec? How do I resolve this error You have already activated rspec-core...

2010-12-21 Thread Rick R
I'm pretty newb... when I try to run my rspec tests I get the following
error:

You have already activated rspec-core 2.3.1, but your Gemfile requires
rspec-core 2.1.0. Consider using bundle exec.

At one point for another app  was working with I did have  rspec-core 2.31
defined, but in this app I have my Gemfile as:

source 'http://rubygems.org'

gem 'rails', '3.0.3'
gem 'sqlite3-ruby', '1.2.5', :require = 'sqlite3'

group :development do
  gem 'rspec-rails', '2.1.0'
end

group :test do
  gem 'rspec', '2.1.0'
  gem 'webrat', '0.7.1'
end

and I had done bundle install previously which shows:

Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.6)
Using tzinfo (0.3.23)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.12)
Using actionmailer (3.0.3)
Using arel (2.0.6)
Using activerecord (3.0.3)
Using activeresource (3.0.3)
Using bundler (1.0.7)
Using diff-lcs (1.1.2)
Using nokogiri (1.4.4)
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)
Using rspec-core (2.1.0)
Using rspec-expectations (2.1.0)
Using rspec-mocks (2.1.0)
Using rspec (2.1.0)
Using rspec-rails (2.1.0)
Using sqlite3-ruby (1.2.5)
Using webrat (0.7.1)

The only thing on google I found was related to
http://stackoverflow.com/questions/3695504/rails3-rspec-issue and it's
implying I need to manually delete some gems? This is confusing. I am also
using rvm if that matters. I ran into all of this going through the ruby on
rails tutorial
http://railstutorial.org/chapters/filling-in-the-layout#book_menu chapter 3.

-- 
Rick R

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Duration

2010-12-21 Thread Peter Vandenabeele
Frederick Cheung wrote in post #969871:
 On Dec 21, 5:17pm, Jack Waugh 7aq3z2h...@gmail.com wrote:
 It looks as though if you ask a DateTime to add something to itself,
 it looks at the something, and if it's an integer, it interprets it as
 a duration in seconds, but if it's a Rational, it interprets it as a
 duration in days.

 That's not actually the whole store - If you did DateTime.now + 1 then
 you would get 1 day after now.
 The key is that 1.second (and similarly 3.days, 2.hours + 6.minutes
 etc) aren't integers - they're ActiveSupport::Duration objects.
 They quite often pretend to be integers (the number of seconds
 represented by the duration - although this is obviously dodgy if the
 duration is something like 1 month), largely because that's quite
 convenient when dealing with Time objects and I suspect because of
 backwards compatibility (at one point in Rails' history
 the .second/.day... methods were just convenience methods that
 returned the corresponding number of seconds)

I am actually curious how I could see from the object
itself in a Rails context that it's not really a Fixnum,
but an ActiveSupport::Duration object

$ rails c
Loading development environment (Rails 3.0.3)
001:0 weekend = 2.days
= 2 days
002:0 weekend.class
= Fixnum   # but there is more functionality than a Fixnum
003:0 weekend.singleton_class
= #Class:#ActiveSupport::Duration:0xb727e068 # a hint ?

Also, here I did use specific units (in-casu days),
but still I had naively expected a different result
on line 005.

004:0 weekend.seconds
= 172800 seconds # this is correct
005:0 weekend.days
= 172800 days # I had expected '2' or '2 days'

Thanks,

Peter

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Re: Re: Re: Where put require

2010-12-21 Thread Paul Bergstrom
David Kahn wrote in post #969902:

 Rspec, Cucumber, Capybara, xpath and who knows what else at the same
 time

I get exhausted of hearing about all that stuff :-)

Just kidding. I see your point. I'm kind of full with knowledge. I'm 
tired of always having to learn new things. Once I was eager to do so, 
but not anymore.

I had a good life with Rails 2. Things worked well and I felt I had 
learned all I needed to have a good flow in my development (of my own 
few apps). Then came Rails 3 with some cool new features. :-)



 Bundler reminds me of gem vs plugin. Do you see my thought?


 I am probably wrong but it seems to me that plugins are and will go away
 as
 since each app has their own bundle the idea of plugins gets to be
 insignificant, especially if you use RVM (and RVM *is* for sure worth
 the
 effort to pick up).

I use RVM. Good for ruby. But otherwise I could be without it. It's one 
of these cool new features that I had to get into. :-) My head is 
alarming memory full.

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Where put require

2010-12-21 Thread Marnen Laibow-Koser
Paul Bergstrom wrote in post #969903:
 Marnen Laibow-Koser wrote in post #969891:

 I didn't realize it was a blanket prohibition.

 Why can't you respect that?

 I can't respect the idea that you get to decide who answers you when you
 post on an unmoderated public list.  If you don't want answers from the
 public, don't post here.

 I only ask you to respect me as a fellow human being, asking you to
 behave and interact with other people in a kind, respectful and warm
 manner. :-) Is that too much to ask?

I believe I have always done that; to the extent I haven't, I certainly 
apologize.


 Several times when I have asked a question you have given me a question
 back like why do you want to do that? instead of just answering my
 question. Once or twice is nothing but not all the time.

It's nothing personal.  You have a tendency to ask questions on this 
list which betray a misunderstanding of how to get the most out of 
Rails.  It is my usual procedure -- and, on the evidence, that of many 
others here -- to clarify why you're asking for advice on something that 
doesn't seem like a good idea in the first place.

I am not going to just stick my head in the sand and tell you or anyone 
else how to implement a bad idea without first saying this is a bad 
idea and here's how to do it better.

If you don't want advice, don't ask for it.  If you ask for advice, 
please listen to it.  Doing otherwise is not respectful to the people 
taking time and effort to give you the best advice we know how to give.


 I didn't ask for your opinion about bundler. I asked if there is a way
 to require a gem but keep the gems in one place, like before. I don't
 understand why that question would be so hard to understand. Why make it
 so complicated Marnen?

I'm not making things complicated; you are.  Rails explicitly makes it 
easy to do things in the Rails way, and less easy to do things that 
its designers consider bad.  That means that it will actually be less 
complicated if you learn the Rails way before trying to ignore it.

The Rails 3 way involves Bundler.  Since it's the Rails 3 way, you 
should learn it before deciding to do without it.


 I'm sure bundler is wonderful, but I could do without it.

Then do without it -- after learning to use it.

 Is that ok
 with you?

It's not up to me.

 You seem like a person who get nervous when someone is not
 following the rules. Is that true? Is that the problem here?

No.  I pity people who choose an opinionated framework such as Rails, 
and then make life hard for themselves by choosing to ignore that 
framework's conventions in the name of simplicity.  It's actually 
simpler in most cases to learn Rails' conventions than to fight them.

Now, Rails didn't get everything right.  The core team made a 
wonderfully testable framework, but built terrible testing tools -- 
which I know because I learned Test::Unit, then discarded it.

But if I thought that (say) it would be simpler to do without an ORM 
like ActiveRecord, I'd probably stop using Rails.

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



[Rails] Re: Re: Re: Re: Where put require

2010-12-21 Thread Marnen Laibow-Koser
Paul Bergstrom wrote in post #969907:
 David Kahn wrote in post #969902:

 Rspec, Cucumber, Capybara, xpath and who knows what else at the same
 time

 I get exhausted of hearing about all that stuff :-)

 Just kidding. I see your point. I'm kind of full with knowledge. I'm
 tired of always having to learn new things. Once I was eager to do so,
 but not anymore.
[...]

Then please stick with your old configuration.  Trying to learn Rails 3 
and make it work just like Rails 2 is an exercise in futility.  To learn 
new stuff, you have to *learn* *new* stuff.

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



[Rails] Re: Consider using bundle exec? How do I resolve this error You have already activated rspec-core...

2010-12-21 Thread E. Litwin
 You have already activated rspec-core 2.3.1, but your Gemfile requires
 rspec-core 2.1.0. Consider using bundle exec.

Did you consider using bundle exec?

Precede your command with bundle exec, i.e. bundle exec rspec spec

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Where to find bookmark in controller

2010-12-21 Thread Greg Donald
On Tue, Dec 21, 2010 at 3:53 PM, Marnen Laibow-Koser
li...@ruby-forum.com wrote:
 (BTW, you should really be using lowercase for your HTML filenames, or
 else you're likely to run into case sensitivity issues.)

I used to think that too, but then I tested it a few months back and
found every browser I tried worked fine with incorrect case in a URL.

http://example.com/Home.html worked when the actual URL was
http://example.com/home.html

I still go all lowercase just out of habit.. looks cleaner too.


-- 
Greg Donald
destiney.com | gregdonald.com

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Re: Re: Re: Where put require

2010-12-21 Thread Paul Bergstrom
David Kahn wrote in post #969902:

Btw, thanks for the input and you effort to help.

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Consider using bundle exec? How do I resolve this error You have already activated rspec-core...

2010-12-21 Thread Rick R
On Tue, Dec 21, 2010 at 5:11 PM, E. Litwin elit...@rocketmail.com wrote:

  You have already activated rspec-core 2.3.1, but your Gemfile requires
  rspec-core 2.1.0. Consider using bundle exec.

 Did you consider using bundle exec?

 Precede your command with bundle exec, i.e. bundle exec rspec spec



I had tried typing bundle exec and received errors, didn't realize it it
was bundle exec rspec spec I'll have to read up what that does.

The solution was to read further along in the tutorial.. and it mentions
this to fix issues...


$ rvm gemset delete rails3tutorial
$ rvm --create use 1@rails3tutorial
$ rvm --default 1@rails3tutorial
$ gem install rails -v 3.0.3 $ bundle install

I guess it's a good practice to setup a gemset specific for each project. I
hadn't done that previously (which yes I know the tutorial does mention to
do earlier.)

-- 
Rick R

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Re: Re: Re: Where put require

2010-12-21 Thread Paul Bergstrom
Marnen Laibow-Koser wrote in post #969909:
 Paul Bergstrom wrote in post #969907:


 Then please stick with your old configuration.  Trying to learn Rails 3
 and make it work just like Rails 2 is an exercise in futility.  To learn
 new stuff, you have to *learn* *new* stuff.



You just don't get it.

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



  1   2   >