R: Re: Re: [Rails] R: [ANN] Rails 3.0.7 has been released!

2011-04-18 Thread Manuele Dones
so "bundle update rails" is to update the application from an older to an 
earlier version, right?

And then "gem clean" to remove the older version of the gems.

That's should be the common rule... ;-)

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



[Rails] Form's and Actions.

2011-04-18 Thread Niklas Nson
Have the following form:

<%= simple_form_for @user, :as => :user, :action =>
"edit_notification" do |f| -%>
<%= f.input :email %>
<%= f.input :email_alerts %>
<%= f.input :email_summarize %>
<%= f.input :email_newsletter %>
<%= f.input :email_announcements %>
<%= f.button :submit %>
<% end %>

It should trigger the edit_notification action ? But it triggers the
standard edit action. Do i have to add more routes then:
resources :users to get it to trigger ?

This is driving me mad at the time.

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



Re: Re: [Rails] R: [ANN] Rails 3.0.7 has been released!

2011-04-18 Thread Pedro Nascimento
just run 'bundle update rails'.

On Tue, Apr 19, 2011 at 03:49, Manuele Dones  wrote:
> Ok i've changed the Gem file from "rails 3.0.6" to "rails 3.0.7", then run
> "gem clean": it deleted all the older version.
> Then I've finally run "bundle", and it downloaded some older version gem,
> for example "mail 2.1.16" (so I've both mail 2.1.17 and 2.1.16). I think
> that's not an issue, since my app is working perfectly...
> Please reply if you have some other ideas of what's the best when a new
> rails version is released.
> ;-) thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>

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



R: Re: [Rails] R: [ANN] Rails 3.0.7 has been released!

2011-04-18 Thread Manuele Dones
Ok i've changed the Gem file from "rails 3.0.6" to "rails 3.0.7", then run 
"gem clean": it deleted all the older version.
Then I've finally run "bundle", and it downloaded some older version gem, 
for example "mail 2.1.16" (so I've both mail 2.1.17 and 2.1.16). I think 
that's not an issue, since my app is working perfectly...

Please reply if you have some other ideas of what's the best when a new 
rails version is released. 

;-) thanks!

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



Re: [Rails] script or utility to transform a string w embedded spaces into a sym

2011-04-18 Thread Michael Pavling
On 18 April 2011 23:09, Erwin  wrote:
> I need to transform strings like "Instructor ID"  or "Lovely Ice tree"
> into sym  :instructor_id  , :lovely_ice_tree
>
> is there a better and faster way to do it ?

I have a little monkey-patch called "dehumanize" which is *almost*
what you want:

module ActiveSupport::Inflector
  # does the opposite of humanize mostly. Basically does a
  # space-substituting .underscore
  def dehumanize(string_value)
result = string_value.to_s.dup
result.downcase.gsub(/ +/,'_')
  end
end
class String
  def dehumanize
ActiveSupport::Inflector.dehumanize(self)
  end
end

you could then call:
  String.dehumanize.to_sym

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



[Rails] Re: Rails3 integration with SourceForce

2011-04-18 Thread balakrishna.ka...@gmail.com
Sorry for the typo mistake.
Its salesforce.

On Apr 18, 7:06 pm, Bryan Crossland  wrote:
> On Mon, Apr 18, 2011 at 6:01 AM, balakrishna.ka...@gmail.com <
>
> balakrishna.ka...@gmail.com> wrote:
> > Hi,
> >       I looking forward to integrate Rail3 application with
> > SourceForce. Any help in this regard is appreciated.
>
> > Thanks,
> > Balakrishna
>
> What is SourceForce? Did you mean SourceForge?
>
> B.

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



[Rails] confirming change of email with devise

2011-04-18 Thread Matt Harrison
Hi list,

I've found someone else asking this on the devise list but it didn't end with a
suitable solution. I have posted there on that thread and asked for more help 
but the
list is incredibly quiet and I haven't found any help yet. Hoping someone here 
can
help out.

Devise allows me to require that users confirm their email addresses when they 
sign
up but also allows them to change the address without confirmation.

I wanted to implement confirmation whenever the address is changed but after 
thinking
about it I'm pretty stumped.

I could just set the account to require confirmation again, but what if the user
accidentally entered an invalid/incorrect email address and doesn't remember 
exactly
what they typed? They will be unable to login with their email address.

So, I need to store the new address somewhere safe, send a confirmation again 
and when
confirmed, copy the new address to the right field.

I can work this solution out except for the first part. Getting the profile 
saving
action to save the email address somewhere other than the email field would 
require me
to hack the device gem around right?

I've been working with rails for a while but never got too deep and dirty with 
it (or
gems). To me, it seems that if I go in and fiddle with the controller inside 
devise,
then I'll end up with my own fork essentially and have to maintain that as well 
as my
application.

Does anyone have any insights or tips concerning this?

TIA


pgpvkWKinALTB.pgp
Description: PGP signature


Re: [Rails] How to change the url (from localhostL:3000) to (example.com)

2011-04-18 Thread Alex Katebi
Open your /etc/hosts file in Linux. Windows is the same hosts file under
some other directory.
Any how puts the next line in the file
127.0.0.1 example.com
Then if you "ping example.com" IP 127.0.0.1 will respond.
now you can use example.com:3000 to access your web site.
If you are not happy with your 3000 port then change Rails default http port
setting.
I don't know how to change this port number.

On Mon, Apr 18, 2011 at 5:51 AM, amrit pal pathak  wrote:

> I am new to ruby on rails and running rails 2.3.5.My application is
> running at localhost:3000 ,but i want it should be run at
> "example.com" in brower when i start the serve normally as  "script/
> server" .
> What to do?
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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



Re: [Rails] handling validation

2011-04-18 Thread Matt Harrison
On Mon, Apr 18, 2011 at 10:44:08PM -0500, Bryan Crossland wrote:
> I think the issue is that you need to remove :partial=> from your Edit
> Category view. When you are specifying :partial hash param it is ignoring
> :target and expecting something else, like collection, to be passed in. If
> you change your Edit to be like what is below it should work.
> 
> Change from this:
> 
>  = render :partial => "shared/error_messages", :target => @category
> 
> To this:
> 
>  = render "shared/error_messages", :target => @category
> 
> B.

Thanks Bryan,

That was exactly the problem. I had looked at the edit views vs the new views 
so many
times. I just didn't notice that they differed as you showed above. I thought 
I'd
copied and pasted so I really didn't expect them to be different.

Thanks again


pgplOUEd6tEYg.pgp
Description: PGP signature


[Rails] Re: rails 3 time breakdowns don't add up

2011-04-18 Thread gamov
I also noticed that on my app, even in development:
Completed 200 OK in 1390ms (Views: 294.7ms | ActiveRecord: 4.8ms)


Josh wrote:
> production isn't bad at all:
>
> Completed 200 OK in 24ms (Views: 19.5ms | ActiveRecord: 2.2ms |
> Sphinx: 0.0ms)
>
> However, it's highly annoying to wait for 1 second requests in
> development - rails 2.x wasn't like this.

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



Re: [Rails] Re: Problem with new action 'validate'

2011-04-18 Thread Bryan Crossland
On Mon, Apr 18, 2011 at 6:01 PM, Tomas R.  wrote:

> so you say that should be form_for params[:key]? that wont work neither
>
>
You only fixed part of the issue. Fred pointed out two things. The first was
that you specified params[:key] incorrectly. The second, and more important,
is that you put your :action in the wrong place. Remove the :action from
your submit tag and change your form_tag to go to
invitations_validation_path.

<%= form_tag invitations_validation_path do %>
 
   <%= label_tag :key %>
   <%= text_field_tag :key %>
 
 
   <%= submit_tag 'validate' %>
 
<% end %>

B.

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



Re: [Rails] handling validation

2011-04-18 Thread Bryan Crossland
On Mon, Apr 18, 2011 at 10:47 AM, Matt Harrison <
iwasinnamuk...@genestate.com> wrote:

> On Mon, Apr 18, 2011 at 07:51:49AM -0500, Bryan Crossland wrote:
> > On Sun, Apr 17, 2011 at 5:01 PM, Matt Harrison <
> iwasinnamuk...@genestate.com
> > > wrote:
> >
> > >
> > > I can post full code examples if necessary.
> > >
> > >
> > That would be extremely helpful.
>
> Ok, here is the controller code:
>
> http://pastie.org/1807523
>
> And the views:
>
> http://pastie.org/1807530
>
> And the partial:
>
> http://pastie.org/1807536
>
>
> new/update works perfectly, while edit/update gives this error while
> visiting the edit
> action:
>
> http://pastie.org/1807548
>
>
> If I change the edit view to look like the following, it works fine:
>
> http://pastie.org/1807558
>
> But I don't want to have to do that for every view. As you can tell I'm no
> expert and
> I'm a bit stumped. Grateful for some tips
>
> Thanks
>


I think the issue is that you need to remove :partial=> from your Edit
Category view. When you are specifying :partial hash param it is ignoring
:target and expecting something else, like collection, to be passed in. If
you change your Edit to be like what is below it should work.

Change from this:

 = render :partial => "shared/error_messages", :target => @category

To this:

 = render "shared/error_messages", :target => @category

B.

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



Re: [Rails] Simple Parameter Passing

2011-04-18 Thread Alex Katebi
Nothing is simple. The only thing simple is to ask people how to do simple
stuff. [?]

On Mon, Apr 18, 2011 at 4:11 PM, Sig Luft  wrote:

> Hi,
>
> I'm trying to put together a really simple application, which only uses
> Rails in the most rudimentary manner.
>
> Basically, I have a command line application that takes one parameter,
> and returns the necessary text in return.  I also have an existing web
> site that can call a URL with a ?param.
>
> What I want to do, is have a simple controller which calls a system(...)
> call, passing the ?param to the non-rails application.
>
> I then want the view to display the result.  I gather this is bone
> simple, and perhaps a little offensive to the spirit of Rails, but what
> can I say, baby steps
>
> Any help would be greatly appreciated.
>
> Thanks,
>
> Sig
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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

<<32B.gif>>

Re: [Rails] Simple UJS Fields

2011-04-18 Thread Julian Leviston
Do you mean Ajax, or UJS? UJS is unobtrusive JavaScript which means the 
JavaScript handling code is decorated on the HTML AFTER the page loads so that 
it doesn't make the HTML invalid and so that things like Braille readers still 
work with it. 

RJS on the other hand is Ajax where parts of the page are updated independently 
of the whole page. 

You say UJS but you talk as if you mean AJAX using RJS templates. 

There are good simple examples all over the web for both of these. 

Blog: http://random8.zenunit.com/
Twitter: http://twitter.com/random8r
Learn: http://sensei.zenunit.com/
New video up now at http://sensei.zenunit.com/ real fastcgi rails deploy 
process! Check it out now!


On 19/04/2011, at 6:25 AM, Tom Ricks  wrote:

> Hello,
> 
> I have the view:
> 
> <% form_tag '/' do %>
>  <%= number_field_tag(:number_one) %>
>  <%= number_field_tag(:number_two) %>
>  <%= submit_tag 'Calculate' %>
> <% end %>
> <%= @number %>
> 
> and the controller:
> 
> def add
>  numberone = params[:number_one].to_f
>  numbertwo = params[:number_two].to_f
>  @number = numberone + numbertwo
> end
> 
> I am trying to learn some ujs in rails with this example, but I can't
> get it to work. I would like it to not refresh the page to load @number
> unobtrusively. Every time I try the submit_tag just stops working. I
> have read many tutorials and such teaching how to get form_for forms to
> use javascript, but not an example as simple as mine. Should I create a
> .js file named add.js? ect. ect.
> 
> Point me in the right direction?
> 
> Thanks
> 
> -- 
> Posted via http://www.ruby-forum.com/.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
> 

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



[Rails] Re: sqlite3.dll problem

2011-04-18 Thread Miguel Lara
also you can read
 http://www.juan-capristan.net/blog/?p=173

for an explanation an guidance

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

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



[Rails] Testing apps with HTTP authentication AND redirection

2011-04-18 Thread marco
Hello,
does anybody know how can I test a controller in a Rails app (using
the Rails testing framework) that requires HTTP authentication, and
redirects after that?

With integration (I mean, using UserFlowsTest <
ActionController::IntegrationTest) tests I know I can
follow_redirect! , but I don't know how to do the authentication.

With inheriting the test class from ActionController::TestCase won't
give me the follow_redirect! method. You see, I know how to
authenticate in this case, but can't folllow redirections.

I found some interesting links, but they weren't enough:
http://flip.netzbeben.de/2008/06/functional-test-for-http-authentication-in-rails-2/
http://tek-zappeln.blogspot.com/2009/04/rails-2-functional-tests-with-http.html


Any help would be great!

Regards

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



Re: [Rails] ActiveSupport 3.0.6: require 'active_support/core_ext' generates "circular require" warning

2011-04-18 Thread Conrad Taylor
On Mon, Apr 18, 2011 at 3:40 PM, Alexey Muranov wrote:

> Hello,
>
> i noticed some strange warnings when doing
>
>  require 'active_support/core_ext'
>
> with activesupport 3.0.6.
> If i do
>
>  gem 'activesupport', '=3.0.5'
>  require 'active_support/core_ext'
>
> then it works fine.
> Is this a bug in rails 3.0.6?
>
> More precisely, if i do
>
> $ irb -w
> > require 'active_support/core_ext'
>
> i get a warning "warning: loading in progress, circular require
> considered harmful" with a long page of explanations.
> If i do
>
> $ irb -w
> > gem 'activesupport', '=3.0.5'
> > require 'active_support/core_ext'
>
> then it is fine.
>
> What is this warning about?
>
>
Alexey, I would recommend filing a ticket/issue against the gem on
github.com.  However, if it's
just a warning, I wouldn't worry too much about it.

Good luck,

-Conrad



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

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



[Rails] Re: Problem with new action 'validate'

2011-04-18 Thread Tomas R.
so you say that should be form_for params[:key]? that wont work neither

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

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



Re: [Rails] R: [ANN] Rails 3.0.7 has been released!

2011-04-18 Thread Conrad Taylor
On Mon, Apr 18, 2011 at 3:52 PM, Manuele Dones wrote:

> ...and another question ;-) I've noticed running *gem list *that on my
> system I've both rails 3.0.6 and 3.0.7, and the same for activerecord,
> activesupport, etc etc...
>
> Is there a problem? is there a way to clean up older versions?
>
>
This isn't an issue and this is by design.  The Gemfile will tell indicate
what version you would like to use for your Rails project.  Now, if you
would like to use the latest of all gems, you can do the following to clean
up your gems:

gem clean

However, you should be aware that other gems may depend on an earlier
version of a gem(s).  Thus, I would recommend not doing the above unless you
truly understand all your gems and their associated dependencies.

Good luck,

-Conrad


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

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



Re: [Rails] R: [ANN] Rails 3.0.7 has been released!

2011-04-18 Thread Conrad Taylor
On Mon, Apr 18, 2011 at 3:44 PM, Manuele Dones wrote:

> Great! I'm updating the gems... So if i've done a project using rails 3.0.6
> and now i'm updating gems to rails 3.0.7, what I've to do inside my project?
> Should I change the Gem file inside my project, from rails 3.0.6 to rails
> 3.0.7? or run "bundle install" ? or something else?


Hi, I would recommend doing the following

adding/updating the rails line within Gemfile to look like the following:

gem 'rails', '3.0.7'

Then run 'bundle' from the command line within the root of your Rails
project.

Good luck,

-Conrad


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

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



[Rails] R: [ANN] Rails 3.0.7 has been released!

2011-04-18 Thread Manuele Dones
...and another question ;-) I've noticed running *gem list *that on my 
system I've both rails 3.0.6 and 3.0.7, and the same for activerecord, 
activesupport, etc etc...

Is there a problem? is there a way to clean up older versions?

Thanks! ;-) 

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



[Rails] R: [ANN] Rails 3.0.7 has been released!

2011-04-18 Thread Manuele Dones
Great! I'm updating the gems... So if i've done a project using rails 3.0.6 
and now i'm updating gems to rails 3.0.7, what I've to do inside my project? 
Should I change the Gem file inside my project, from rails 3.0.6 to rails 
3.0.7? or run "bundle install" ? or something else? 

Thanks in advance!

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



[Rails] ActiveSupport 3.0.6: require 'active_support/core_ext' generates "circular require" warning

2011-04-18 Thread Alexey Muranov
Hello,

i noticed some strange warnings when doing

  require 'active_support/core_ext'

with activesupport 3.0.6.
If i do

  gem 'activesupport', '=3.0.5'
  require 'active_support/core_ext'

then it works fine.
Is this a bug in rails 3.0.6?

More precisely, if i do

$ irb -w
> require 'active_support/core_ext'

i get a warning "warning: loading in progress, circular require
considered harmful" with a long page of explanations.
If i do

$ irb -w
> gem 'activesupport', '=3.0.5'
> require 'active_support/core_ext'

then it is fine.

What is this warning about?

Thanks.

Alexey.

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

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



Re: [Rails] script or utility to transform a string w embedded spaces into a sym

2011-04-18 Thread Philip Hallstrom

On Apr 18, 2011, at 3:09 PM, Erwin wrote:

> I need to transform strings like "Instructor ID"  or "Lovely Ice tree"
> into sym  :instructor_id  , :lovely_ice_tree
> I tried to do the following :
> downcase all string components the unique the spaces and replace w an
> underscore
> 
> is there a better and faster way to do it ?


string.downcase.tr(' ', '_')

maybe.

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



Re: [Rails] Gem install error

2011-04-18 Thread Bryan Crossland
On Mon, Apr 18, 2011 at 2:42 PM, Pedro  wrote:

> Hi There,
>
> Im trying to install vagrant , but I got the error below. Probably it
> is an  environment issue, Im using MINGW32,  WIN XP.
> Does anybody know how to solve it?
> Thanks!
>
> Pedro
>
> $ gem install vagrant
> Building native extensions.  This could take a while...
> ERROR:  Error installing vagrant:
>   ERROR: Failed to build gem native extension.
>
> c:/Ruby187/bin/ruby.exe extconf.rb
> checking for re.h... no
> creating Makefile
>
> make
> make: *** No rule to make target `ruby.h', needed by `generator.o'.
> Stop.
>
>
> Gem files will remain installed in c:/Ruby187/lib/ruby/gems/1.8/gems/
> json-1.5.1
> for inspection.
> Results logged to c:/Ruby187/lib/ruby/gems/1.8/gems/json-1.5.1/ext/
> json/ext/gene
> rator/gem_make.out
>
>

I think MINGW32 is your problem. It looks like you are missing some C
compiler packages from MINGW32 that Vagrant needs to install.

B.

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



[Rails] script or utility to transform a string w embedded spaces into a sym

2011-04-18 Thread Erwin
I need to transform strings like "Instructor ID"  or "Lovely Ice tree"
into sym  :instructor_id  , :lovely_ice_tree
I tried to do the following :
downcase all string components the unique the spaces and replace w an
underscore

is there a better and faster way to do it ?

thanks fy feedback

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



[Rails] Drying my code ..

2011-04-18 Thread Erwin
I am parsing an xml result using Hpricot, amazing ..
I have a serie of tags to be transformed as parameters, so I am
building Hash by looping on these tags , the resulting data is oK? but
I ma not sure that I wrote a dry code

...
if doc.search('response > error').innerHTML.empty?
  accountTypes = []
  (doc/:accounttype).each do |accountType|
data = {}

data[:locale] =
(accountType/:localized/:locale/:code).innerHTML
data[:title] =
(accountType/:localized/:locale/:title).innerHTML

... # here is the loop over the  elements
   tags = {}
   (accountType/:tag).each do |tag|
 key = (tag/:name).innerHTML.to_s
 value = (tag/:value).innerHTML.to_s
 tags.store(key, value)
   end
.# end of the loop , storing the data
data[:tags] = tags
   accountTypes << data
   end

Is this loop OK ?
   tags = {}
   (accountType/:tag).each do |tag|
 key = (tag/:name).innerHTML.to_s
 value = (tag/:value).innerHTML.to_s
 tags.store(key, value)
   end

thanks for you fedback

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



[Rails] Re: How to change the url (from localhostL:3000) to (example.com)

2011-04-18 Thread Tom Ricks
I am very new to rails as well, but I am pretty sure that's not possible 
in development mode, and why would you want to do it, developing under 
local is much faster than having to update your server files every time. 
You would have to deploy it to change the url that its under, like get a 
server. Or you can just play around with Heroku, they offer free 
deployment for testing.

http://www.heroku.com/

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

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



[Rails] [ANN] Rails 3.0.7 has been released!

2011-04-18 Thread Aaron Patterson
Hello everyone!  I hope you're having an AMAZING Monday.  If you Monday
wasn't AMAZING enough already, I've decided to make it even better by releasing
Rails version 3.0.7!

(As a side note, sometimes I have a hard time telling if my day is
AMAZING or FABULOUS.  If anyone has hints, let me know!)

I want to say thanks to Santiago for handling the release candidate gems.  He's
on vacation, so I get to do the real thing.

The main change in this release is to fix a performance regression in
ActiveRecord that was introduced in version 3.0.6.

# Changes

For a web friendly view, check out the compare view
[on github](https://github.com/rails/rails/compare/v3.0.6...v3.0.7).

For those that want the TL;DR of the commits, here are the pertinant CHANGELOG
entries for each project:

## activesupport
* `Hash.from_xml` no longer loses attributes on tags containing only whitespace
  [André Arko]

## activerecord
* Destroying records via nested attributes works independent of `reject_if`
  LH #6006 [Durran Jordan]
* Delegate any? and many? to Model.scoped for consistency [Andrew White]
* Quote the ORDER BY clause in batched finds - fixes #6620 [Andrew White]
* Change exists? so records are not instantiated - fixes #6127. This prevents
  `after_find` and `after_initialize` callbacks being triggered when checking
  for record existence.
  [Andrew White]
* Fix performance bug with attribute accessors which only occurred on
  Ruby 1.8.7, and ensure we cache type-casted values when the column returned
  from the db contains non-standard chars.
  [Jon Leighton]
* Fix a performance regression introduced here
  86acbf1cc050c8fa8c74a10c735e467fb6fd7df8
  related to `read_attribute` method [Stian Grytøyr]

## actionmailer
* remove AM delegating `register_observer` and `register_interceptor` to Mail
  [Josh Kalderimis]

# Checksums

Just in case!

$ shasum *
6b96ed6cf0717e7e40b7ef9b39a70814d3928250  actionmailer-3.0.7.gem
c28009b6ce47c60553027c1ddd9c9bd2aacb2c82  actionpack-3.0.7.gem
6ee5ca84b460fff55e7dd825fc966cfbc4b36070  activemodel-3.0.7.gem
25ff07f49129ccd405c95047b41e6717e95f9471  activerecord-3.0.7.gem
a4adde3ad82017d8925e99733d1cd288b1474c39  activeresource-3.0.7.gem
d1a0192fd9da869caee79be66a5915633eda291f  activesupport-3.0.7.gem
04aa110f50d2ea9b8434526faff57ab2e249495e  rails-3.0.7.gem
9430747274afa4fac2c37ae05a39f9cb79680e16  railties-3.0.7.gem

Have a great week everyone!

<3 <3 <3 <3 <3

-- 
Aaron Patterson
http://tenderlovemaking.com/


pgpL5JeI5YmBA.pgp
Description: PGP signature


[Rails] Re: put alias in Model.find query

2011-04-18 Thread Ad Ber
Uhm...I figured out how to do it..

 Song.find(:all, :select => "AS s artist, g.genre_name AS name_genre",
:joins => "LEFT OUTER JOIN genres AS g on songs.genre_id = g.id", :order
=> params[:sort])

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

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



Re: [Rails] Re: Ruby On Rails 3 and Webrick

2011-04-18 Thread Bryan Crossland
On Mon, Apr 18, 2011 at 12:46 PM, kdwill  wrote:

> By noob, I mean me. I'm the noob. Sorry for any confusion.
>
>
Brew for Mac
https://github.com/mxcl/homebrew

The command not found is referring to apt-get which is not on Mac (hence his
pointing you to Brew).

B.






> On Apr 18, 10:30 am, kdwill  wrote:
> > Here's where this noob gets nailed.
> >
> > I tried installing the suggested sudo and got command not found. Then
> > I looked for the brew for mac and I'm just not getting it.
> >
> > Radhames, thanks for your help and patience. If others have
> > suggestions of what I'm missing here, please add your voice. All help
> > is appreciated.
> >
> > On Apr 17, 6:50 pm, radhames brito  wrote:
> >
> > > if you are under *nix environtment try installing this packages, use
> the
> > > brew for mac
> >
> > > sudo apt-get install libmysql-ruby libmysqlclient-dev
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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



[Rails] put alias in Model.find query

2011-04-18 Thread Ad Ber
Hi to all,

I want to be able to put alias to my Song.find query.
the artist field belongs to song model so that i could code efficiently
in sorting columns. I want to put an (s) alias to my Song model.

In the code below :select => "artist, g.genre_name AS name_genre"
should be
:select => "s.artist, g.genre_name AS name_genre"

In my controller:

@q = Song.find(:all, :select => "artist, g.genre_name AS name_genre",
:joins => "LEFT OUTER JOIN genres AS g on songs.genre_id = g.id", :order
=> params[:sort])

In my view:

 <%= link_to "Artist", :sort => "artist"%>
 <%= link_to "Genre", :sort => "genre_name"%>

Anyone has an idea how to do this?

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

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



[Rails] TypeError (Cannot visit Category):

2011-04-18 Thread John Merlino
Hey all,

this order_by method right here is throwing an exception:

@resource_model.order_by(@order_field)

The exception is "TypeError (Cannot visit Category):"

I think it's returning this:

#

I have no clue why. It's supposed to be returning a string like
'controller asc'.


This is the lead up to the error:

 def find_options
extract_pagination
extract_order
opts = {:page => @will_paginate_page, :per_page =>
@will_paginate_per_page, :order => @will_paginate_order}
opts.merge(additional_options)
  end


 def additional_options
{}
  end

 def extract_pagination
@will_paginate_page = params[:page] || 1
   @will_paginate_per_page = params[:per_page] || 20
  end

  def extract_order
if params[:order].present?
  @order_field = params[:order]
end
 @will_paginate_order = @resource_model.order_by(@order_field)
  end

#my category model inherits from restfulmodel.rb:

def self.order_by(field)
field = field.to_s
if field.blank?
  return default_order ? order_by(default_order) : scoped(nil) #if
returned value of default_order call exists, self-invoke order_by
end
 scope = field.starts_with?('-') ? 'descend_by_' + field.from(1) :
'ascend_by_' + field
send(scope)
  end

#then my category model has this:
  def self.default_order
 'controller'
  end

  scope :ascend_by_controller, :order => 'controller asc'


Something is flawed with that order_by method. It's not sending
ascend_by_controller to the category model and then returning the value
of the scope :ascend_by_controller. Am I missing something here?

@will_paginate_order should hold a string like 'controller asc'

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



[Rails] Simple UJS Fields

2011-04-18 Thread Tom Ricks
Hello,

I have the view:

<% form_tag '/' do %>
  <%= number_field_tag(:number_one) %>
  <%= number_field_tag(:number_two) %>
  <%= submit_tag 'Calculate' %>
<% end %>
<%= @number %>

and the controller:

def add
  numberone = params[:number_one].to_f
  numbertwo = params[:number_two].to_f
  @number = numberone + numbertwo
end

I am trying to learn some ujs in rails with this example, but I can't
get it to work. I would like it to not refresh the page to load @number
unobtrusively. Every time I try the submit_tag just stops working. I
have read many tutorials and such teaching how to get form_for forms to
use javascript, but not an example as simple as mine. Should I create a
.js file named add.js? ect. ect.

Point me in the right direction?

Thanks

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

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



Re: [Rails] Simple Parameter Passing

2011-04-18 Thread Colin Law
On 18 April 2011 21:11, Sig Luft  wrote:
> Hi,
>
> I'm trying to put together a really simple application, which only uses
> Rails in the most rudimentary manner.
>
> Basically, I have a command line application that takes one parameter,
> and returns the necessary text in return.  I also have an existing web
> site that can call a URL with a ?param.
>
> What I want to do, is have a simple controller which calls a system(...)
> call, passing the ?param to the non-rails application.
>
> I then want the view to display the result.  I gather this is bone
> simple, and perhaps a little offensive to the spirit of Rails, but what
> can I say, baby steps

I suggest you work through some rails tutorials to see how rails works
for typical applications rather than starting with something unusual
(for rails).  Then you should see how to do what you want.
railstutorial.org is a good free-to-use-online tutorial.  Also see the
Rails Guides.

Colin

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



[Rails] Re: acts_as_commentable validations

2011-04-18 Thread Tony Tony
Colin Law wrote in post #993612:
> On 18 April 2011 18:22, Tony Tony  wrote:
>>
>> The show view form for the comment is the following:
>> However I am getting the following error only when validation fails (if
>> a normal length comment is created the site works):
>>
>> [code]
>> Template is missing
>>
>> Missing template comments/create with {:handlers=>[:erb, :rjs, :builder,
>> :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths
>> "/...", "/.../.rvm/gems/ruby-1.9.2-head/gems/devise-1.2.1/app/views"
>> [/code]
>
> What does the code for action create in the controller look like?
> What happens in there if the validation fails (ie save will return
> zero).  What view does it attempt to show in that case?
>
> Colin


Hi Colin,

Ok so I just figured out the main problem was with the create action in 
CommentsController.

I had:

  def create
@post = Post.find(params[:post_id])
@comment = @post.comments.new(params[:comment])
@comment.user_id = current_user.id
if @comment.save
  redirect_to @post
end
  end

What I needed was to add an else statement to @comment.save like so:

  def create
@post = Post.find(params[:post_id])
@comment = @post.comments.new(params[:comment])
@comment.user_id = current_user.id
if @comment.save
  redirect_to @post
else
  redirect_to @post
end
  end


Now the problem I'm having showing the validation errors on my post show 
form (code in my original message). Any tips on displaying that? Thanks!

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

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



[Rails] Simple Parameter Passing

2011-04-18 Thread Sig Luft
Hi,

I'm trying to put together a really simple application, which only uses
Rails in the most rudimentary manner.

Basically, I have a command line application that takes one parameter,
and returns the necessary text in return.  I also have an existing web
site that can call a URL with a ?param.

What I want to do, is have a simple controller which calls a system(...)
call, passing the ?param to the non-rails application.

I then want the view to display the result.  I gather this is bone
simple, and perhaps a little offensive to the spirit of Rails, but what
can I say, baby steps

Any help would be greatly appreciated.

Thanks,

Sig

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

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



Re: [Rails] acts_as_commentable validations

2011-04-18 Thread Colin Law
On 18 April 2011 18:22, Tony Tony  wrote:
> Hi all,
>
> I recently started back up with Rails and things are going well up until
> now.
>
> I've set up acts_as_commentable in my Post model and it's working great.
> Problem is users are able to create a "blank" comment. I've added the
> following validations in the comment.rb file generated by
> acts_as_commentable to limit the comment length:
>
>
> [code]
> validates_length_of :comment, :minimum => 3, :too_short => "must be at
> least {{count}} words.", :tokenizer => lambda {|str| str.scan(/\w+/) }
>
> validates_length_of :comment, :maximum => 200, :too_long => "must be
> shorter than {{count}} words. Make sure there are no links or
> elements.", :tokenizer => lambda {|str| str.scan(/\w+/) }
> [/code]
>
>
> The show view form for the comment is the following:
>
> [code]
> <%- form_for [@post, @comment] do |f|-%>
>  <%= f.error_messages %>
>  <%= f.text_area :comment, :rows => 3 -%>
>  <%= f.submit -%>
> <%- end -%>
> [/code]
>
>
> However I am getting the following error only when validation fails (if
> a normal length comment is created the site works):
>
> [code]
> Template is missing
>
> Missing template comments/create with {:handlers=>[:erb, :rjs, :builder,
> :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths
> "/...", "/.../.rvm/gems/ruby-1.9.2-head/gems/devise-1.2.1/app/views"
> [/code]

What does the code for action create in the controller look like?
What happens in there if the validation fails (ie save will return
zero).  What view does it attempt to show in that case?

Colin

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



Re: [Rails] Re: Unable to install Rails through proxy

2011-04-18 Thread Bryan Crossland
On Mon, Apr 18, 2011 at 9:54 AM, rubynewbie wrote:

> The problem is not inclusion of http:// in the URL(I tried without
> that). On the contrary I suspect the reason to be on how to specify
> the domain in the URL. Is my way of specifying the domain right?
>
> C:\Documents and Settings\Users\Desktop>gem install rails -v 3.0.1  -p
> http://MYDOMAIN\myUserID:MyPassword@MyProxy:Port
>
>
>
I found this on StackOverflow where there were discussing setting the
http-proxy environment variable for ISA to install a gem on Windows from
behind a proxy. I don't think you need the domain if your admin has
specified a default one to authenticate against. However if they have not,
one of the comments suggested URI encoding the backslash. So you new string
would look like this:

http://MYDOMAIN %5myUserID:MyPassword@MyProxy:Port

http://stackoverflow.com/questions/4418/how-do-i-update-ruby-gems-from-behind-a-proxy-isa-ntlm

B.




> Thanks,
>
> S
>
> On Apr 18, 6:42 pm, Bryan Crossland  wrote:
> > On Mon, Apr 18, 2011 at 4:58 AM, rubynewbie  >wrote:
> >
> >
> >
> > > I am new to Rails and have been facing difficulty while installing
> > > rails. I have already installed Ruby and RubyGems on my machine by
> > > downloading the packages. But when I install Rails through RubyGems
> > > through a HTTP Proxy , I am thrown an error. Below is the details of
> > > the command and the exception i am getting :
> >
> > > Command Executed :
> > > C:\Documents and Settings\Users\Desktop>gem install rails -v 3.0.1  -p
> > >http://mydomain\myUserID:MyPassword@MyProxy:Port
> >
> > > Error thrown  :
> >
> > > ERROR:  While executing gem ... (OptionParser::InvalidArgument)
> > >invalid argument: -phttp://myDomain\MyUserID:MyPassword@MyProxy:80
> >
> > > Please note that mydomain is the domain to which my User ID belongs.
> > > The authentication is ISA i believe.
> >
> > >  Would appreciate some help in this.
> >
> > > Thanks in advance
> >
> > > S
> >
> > Since you are calling an http proxy I don't think you need to specify
> > http:// on the URL. I could be wrong. I don't have a proxy to test
> against
> > to confirm this.
> >
> > B.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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



[Rails] Gem install error

2011-04-18 Thread Pedro
Hi There,

Im trying to install vagrant , but I got the error below. Probably it
is an  environment issue, Im using MINGW32,  WIN XP.
Does anybody know how to solve it?
Thanks!

Pedro

$ gem install vagrant
Building native extensions.  This could take a while...
ERROR:  Error installing vagrant:
   ERROR: Failed to build gem native extension.

c:/Ruby187/bin/ruby.exe extconf.rb
checking for re.h... no
creating Makefile

make
make: *** No rule to make target `ruby.h', needed by `generator.o'.
Stop.


Gem files will remain installed in c:/Ruby187/lib/ruby/gems/1.8/gems/
json-1.5.1
for inspection.
Results logged to c:/Ruby187/lib/ruby/gems/1.8/gems/json-1.5.1/ext/
json/ext/gene
rator/gem_make.out

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



Re: [Rails] how can i test a file content with cucumber

2011-04-18 Thread Bryan Crossland
On Mon, Apr 18, 2011 at 9:20 AM, Isaac Jarquin wrote:

> Hi everyone, im quite new  in cucumber worl and I need to test a file
> content in cucumber and i cant find a clue of how to do it, could
> anyone help me ?
>
>
This should help you. It's amazing what you can find on the internet.

http://tinyurl.com/42pb4co

B.

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



[Rails] Re: best practices for debugging errors on production mode on server

2011-04-18 Thread Frederick Cheung


On Apr 18, 7:34 pm, John Merlino  wrote:
> Hey all,
>
> I think I need some help with best practices for debugging. So I am
> familiar with logger.info e.g. "The variable is #{@variable}". This
> helps when I want to inspect the value of a variable on my local
> machine. However, it doesn't get output to the production log so when
> the site runs on the server, I don't know what the variable contains.
> And when my local copy is working great, I don't know what to do when I
> get this in production log on server:
>
You can either change the threshold at which things end up in the log
file or log at a higher level, eg logger.error instead of logger.info

Fred
>  Parameters: {"action"=>"index", "controller"=>"sites"}
>
> NoMethodError (undefined method `paginate' for Site:Class):
>   searchlogic (2.4.27) lib/searchlogic/named_scopes/conditions.rb:81:in
> `method$
>   searchlogic (2.4.27)
> lib/searchlogic/named_scopes/association_conditions.rb:1$
>   searchlogic (2.4.27)
> lib/searchlogic/named_scopes/association_ordering.rb:27:$
>   searchlogic (2.4.27) lib/searchlogic/named_scopes/ordering.rb:30:in
> `method_m$
>   searchlogic (2.4.27)
> lib/searchlogic/named_scopes/or_conditions.rb:28:in `met$
>   searchlogic (2.4.27) lib/searchlogic/search/method_missing.rb:58:in
> `send'
>   searchlogic (2.4.27) lib/searchlogic/search/method_missing.rb:58:in
> `method_m$
>   app/other/restful_component.rb:362:in `find_and_paginate_resources'
>   app/other/app.rb:31:in `benchmark'
>   app/other/restful_component.rb:361:in `find_and_paginate_resources'
>   /usr/local/lib/ruby/1.8/benchmark.rb:308:in `realtime'
>   rack (1.1.0) lib/rack/head.rb:9:in `call'
>   rack (1.1.0) lib/rack/methodoverride.rb:24:in `call'
>   rack (1.1.0) lib/rack/lock.rb:11:in `call'
>   rack (1.1.0) lib/rack/lock.rb:11:in `synchronize'
>   rack (1.1.0) lib/rack/lock.rb:11:in `call'
>   passenger (3.0.6) lib/phusion_passenger/rack/request_handler.rb:96:in
> `proces$
>   passenger (3.0.6)
> lib/phusion_passenger/abstract_request_handler.rb:513:in `a$
>   passenger (3.0.6)
> lib/phusion_passenger/abstract_request_handler.rb:274:in `m$
>   passenger (3.0.6)
> lib/phusion_passenger/classic_rails/application_spawner.rb:$
>   passenger (3.0.6)
> lib/phusion_passenger/classic_rails/application_spawner.rb:$
>   passenger (3.0.6)
> lib/phusion_passenger/classic_rails/application_spawner.rb:$
>   passenger (3.0.6) lib/phusion_passenger/utils.rb:479:in `safe_fork'
>   passenger (3.0.6)
> lib/phusion_passenger/classic_rails/application_spawner.rb:$
>   passenger (3.0.6) lib/phusion_passenger/abstract_server.rb:357:in
> `__send__'
>   passenger (3.0.6) lib/phusion_passenger/abstract_server.rb:357:in
> `server_mai$
>   passenger (3.0.6) lib/phusion_passenger/abstract_server.rb:206:in
> `start_sync$
>   passenger (3.0.6) lib/phusion_passenger/abstract_server.rb:180:in
> `start'
>   passenger (3.0.6)
> lib/phusion_passenger/classic_rails/application_spawner.rb:$
>   passenger (3.0.6) lib/phusion_passenger/spawn_manager.rb:219:in
> `spawn_rails_$
>   passenger (3.0.6)
> lib/phusion_passenger/abstract_server_collection.rb:132:in $
>   passenger (3.0.6) lib/phusion_passenger/spawn_manager.rb:214:in
> `spawn_rails_$
>   passenger (3.0.6)
> lib/phusion_passenger/abstract_server_collection.rb:82:in `$
>   passenger (3.0.6)
> lib/phusion_passenger/abstract_server_collection.rb:79:in `$
>   passenger (3.0.6) lib/phusion_passenger/spawn_manager.rb:213:in
> `spawn_rails_$
>   passenger (3.0.6) lib/phusion_passenger/spawn_manager.rb:132:in
> `spawn_applic$
>   passenger (3.0.6) lib/phusion_passenger/spawn_manager.rb:275:in
> `handle_spawn$
>   passenger (3.0.6) lib/phusion_passenger/abstract_server.rb:357:in
> `__send__'
>   passenger (3.0.6) lib/phusion_passenger/abstract_server.rb:357:in
> `server_mai$
>   passenger (3.0.6) lib/phusion_passenger/abstract_server.rb:206:in
> `start_sync$
>   passenger (3.0.6) helper-scripts/passenger-spawn-server:99
>
> So clearly it is pointing to the paginate method in this method as the
> culrpit:
>
> def find_and_paginate_resources
>
>     opts = {:page => @will_paginate_page, :per_page =>
> @will_paginate_per_page}
>     opts.merge!(find_resources_options)
>     opts.merge!(collect_extra_sortable_options)
>
>     App.benchmark "Loading #{@resource_model_name.pluralize}", :verbose,
> :pre do
>
>       @resources = @resources.paginate(opts)
>
>     end
>
>   end
>
> Thanks for response.
>
> --
> Posted viahttp://www.ruby-forum.com/.

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



[Rails] Re: How to convert this sql into named_scope

2011-04-18 Thread Tim Shaffer
Correct me if I'm wrong, but can't that query be rewritten as follows:

select event_id, user_id, max(invite_time) as last_invite_time
from invitations
where event_id = @event_id 
group by event_id, user_id 

Basically you want to get distinct event_id and user_id and the latest 
invite_time? No need to join to itself.

In that case, you could go ahead and do it like this in ActiveRecord:

Invitation.select("event_id, user_id, max(invite_time) as 
last_invite_time").group("event_id, 
user_id").where(:event_id => @event_id)

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



[Rails] best practices for debugging errors on production mode on server

2011-04-18 Thread John Merlino
Hey all,

I think I need some help with best practices for debugging. So I am
familiar with logger.info e.g. "The variable is #{@variable}". This
helps when I want to inspect the value of a variable on my local
machine. However, it doesn't get output to the production log so when
the site runs on the server, I don't know what the variable contains.
And when my local copy is working great, I don't know what to do when I
get this in production log on server:

 Parameters: {"action"=>"index", "controller"=>"sites"}

NoMethodError (undefined method `paginate' for Site:Class):
  searchlogic (2.4.27) lib/searchlogic/named_scopes/conditions.rb:81:in
`method$
  searchlogic (2.4.27)
lib/searchlogic/named_scopes/association_conditions.rb:1$
  searchlogic (2.4.27)
lib/searchlogic/named_scopes/association_ordering.rb:27:$
  searchlogic (2.4.27) lib/searchlogic/named_scopes/ordering.rb:30:in
`method_m$
  searchlogic (2.4.27)
lib/searchlogic/named_scopes/or_conditions.rb:28:in `met$
  searchlogic (2.4.27) lib/searchlogic/search/method_missing.rb:58:in
`send'
  searchlogic (2.4.27) lib/searchlogic/search/method_missing.rb:58:in
`method_m$
  app/other/restful_component.rb:362:in `find_and_paginate_resources'
  app/other/app.rb:31:in `benchmark'
  app/other/restful_component.rb:361:in `find_and_paginate_resources'
  /usr/local/lib/ruby/1.8/benchmark.rb:308:in `realtime'
  rack (1.1.0) lib/rack/head.rb:9:in `call'
  rack (1.1.0) lib/rack/methodoverride.rb:24:in `call'
  rack (1.1.0) lib/rack/lock.rb:11:in `call'
  rack (1.1.0) lib/rack/lock.rb:11:in `synchronize'
  rack (1.1.0) lib/rack/lock.rb:11:in `call'
  passenger (3.0.6) lib/phusion_passenger/rack/request_handler.rb:96:in
`proces$
  passenger (3.0.6)
lib/phusion_passenger/abstract_request_handler.rb:513:in `a$
  passenger (3.0.6)
lib/phusion_passenger/abstract_request_handler.rb:274:in `m$
  passenger (3.0.6)
lib/phusion_passenger/classic_rails/application_spawner.rb:$
  passenger (3.0.6)
lib/phusion_passenger/classic_rails/application_spawner.rb:$
  passenger (3.0.6)
lib/phusion_passenger/classic_rails/application_spawner.rb:$
  passenger (3.0.6) lib/phusion_passenger/utils.rb:479:in `safe_fork'
  passenger (3.0.6)
lib/phusion_passenger/classic_rails/application_spawner.rb:$
  passenger (3.0.6) lib/phusion_passenger/abstract_server.rb:357:in
`__send__'
  passenger (3.0.6) lib/phusion_passenger/abstract_server.rb:357:in
`server_mai$
  passenger (3.0.6) lib/phusion_passenger/abstract_server.rb:206:in
`start_sync$
  passenger (3.0.6) lib/phusion_passenger/abstract_server.rb:180:in
`start'
  passenger (3.0.6)
lib/phusion_passenger/classic_rails/application_spawner.rb:$
  passenger (3.0.6) lib/phusion_passenger/spawn_manager.rb:219:in
`spawn_rails_$
  passenger (3.0.6)
lib/phusion_passenger/abstract_server_collection.rb:132:in $
  passenger (3.0.6) lib/phusion_passenger/spawn_manager.rb:214:in
`spawn_rails_$
  passenger (3.0.6)
lib/phusion_passenger/abstract_server_collection.rb:82:in `$
  passenger (3.0.6)
lib/phusion_passenger/abstract_server_collection.rb:79:in `$
  passenger (3.0.6) lib/phusion_passenger/spawn_manager.rb:213:in
`spawn_rails_$
  passenger (3.0.6) lib/phusion_passenger/spawn_manager.rb:132:in
`spawn_applic$
  passenger (3.0.6) lib/phusion_passenger/spawn_manager.rb:275:in
`handle_spawn$
  passenger (3.0.6) lib/phusion_passenger/abstract_server.rb:357:in
`__send__'
  passenger (3.0.6) lib/phusion_passenger/abstract_server.rb:357:in
`server_mai$
  passenger (3.0.6) lib/phusion_passenger/abstract_server.rb:206:in
`start_sync$
  passenger (3.0.6) helper-scripts/passenger-spawn-server:99

So clearly it is pointing to the paginate method in this method as the
culrpit:

def find_and_paginate_resources

opts = {:page => @will_paginate_page, :per_page =>
@will_paginate_per_page}
opts.merge!(find_resources_options)
opts.merge!(collect_extra_sortable_options)

App.benchmark "Loading #{@resource_model_name.pluralize}", :verbose,
:pre do

  @resources = @resources.paginate(opts)

end

  end

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



Re: [Rails] DateTime + x.days, x.minutes and the like?

2011-04-18 Thread David Kahn
On Mon, Apr 18, 2011 at 1:11 PM, Michael Pavling  wrote:

> On 18 April 2011 16:38, David Kahn  wrote:
> > Am still perplexed by this output (ruby 1.8.7-p330 on 64bit/Snow
> Leopard):
> >
> > ruby-1.8.7-p330 :001 > DateTime.now
> >  => #
> > ruby-1.8.7-p330 :002 > DateTime.now + 1.day
> >  => #
>
> I wonder if it's something along the lines of the value of
> DateTime.now expressed as an integer added to 1.day expressed as an
> integer (86400 seconds maybe) converted back to a DateTime - giving a
> date wayyy in the future... :-/
>
> What happens when you do:
>  DateTime.now + 1.second
> or
>  DateTime.now + 1.minute
> etc?
>

Yeah, I am pending to play around with this a bit later, as I am also
recalling that ruby 1.9.2 is fine on my computer, so at least try another
wipe of the 1.8.7. As well see if anything is weird on the config, since as
to your question, it looks like you are on to something:

ruby-1.8.7-p330 :005 > dt = DateTime.now
 => #
ruby-1.8.7-p330 :006 > dt + 1.second
 => #
ruby-1.8.7-p330 :007 > dt + 1.minute
 => #

Because also if I do the following we are right on:

ruby-1.8.7-p330 :008 > dt + 1
 => #


>
> ?:-/
> 'fraid I can't help more than this wild speculation though, because I
> have no access to a Mac to test it on.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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



Re: [Rails] DateTime + x.days, x.minutes and the like?

2011-04-18 Thread Michael Pavling
On 18 April 2011 16:38, David Kahn  wrote:
> Am still perplexed by this output (ruby 1.8.7-p330 on 64bit/Snow Leopard):
>
> ruby-1.8.7-p330 :001 > DateTime.now
>  => #
> ruby-1.8.7-p330 :002 > DateTime.now + 1.day
>  => #

I wonder if it's something along the lines of the value of
DateTime.now expressed as an integer added to 1.day expressed as an
integer (86400 seconds maybe) converted back to a DateTime - giving a
date wayyy in the future... :-/

What happens when you do:
  DateTime.now + 1.second
or
  DateTime.now + 1.minute
etc?

?:-/
'fraid I can't help more than this wild speculation though, because I
have no access to a Mac to test it on.

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



Re: [Rails] Re: Rails 3 Crashing On Windows 7

2011-04-18 Thread Bryan Crossland
On Mon, Apr 18, 2011 at 9:28 AM, cipher_neo  wrote:

> It seems to die while processing dynamic javascript...
>
> I have a controller for managing the dynamic javascript (as documented
> here: http://railscasts.com/episodes/88-dynamic-select-menus)
>
> The exact lines that appear in the development.log file before the app
> crashes are:
>
> Started GET "/javascripts/products.js" for 89.100.131.129 at
> 2011-04-18 15:23:49 +0100
>  Processing by JavascriptsController#products as JS
>
> and the products.js.erb file contains:
>
>
Is there another javascript file in your javascripts directory called
products.js? The log is looking for that file but the examples you sent and
the railscast are looking for products.js.erb.

B.






> var products = new Array();
>
> <% Product.all.each do |p|%>
> products[<%= p.id %>] = {'id':'<%= p.id %>', 'name':'<%= p.name %>',
> 'price':<%= p.price %>};
> <% end %>
>
>
> thanks
>
> On Apr 18, 1:49 pm, Bryan Crossland  wrote:
> > On Sun, Apr 17, 2011 at 4:14 PM, cipher_neo  wrote:
> > > sorry, they are all the gems on my system.
> >
> > > I only use the following: (from Gemfile)
> >
> > >  gem 'annotate-models', :require => 'annotate_models'
> > >  gem 'ruby-debug19'
> > >  gem 'populator'
> > >  gem 'faker'
> > >  gem "mongrel", '1.2.0.pre2'
> >
> > What exactly is your application trying to do when it crashes?
> >
> > B.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > > On Apr 16, 4:20 pm, cipher_neo  wrote:
> > > > sure:
> >
> > > > C:\Windows\System32>gem list
> >
> > > > *** LOCAL GEMS ***
> >
> > > > abstract (1.0.0)
> > > > actionmailer (3.0.5)
> > > > actionpack (3.0.5)
> > > > activemodel (3.0.5)
> > > > activerecord (3.0.5)
> > > > activeresource (3.0.5)
> > > > activesupport (3.0.5, 2.3.11)
> > > > annotate-models (1.0.4)
> > > > archive-tar-minitar (0.5.2)
> > > > arel (2.0.9)
> > > > builder (2.1.2)
> > > > bundler (1.0.10)
> > > > cgi_multipart_eof_fix (2.5.0)
> > > > columnize (0.3.2)
> > > > configuration (1.2.0)
> > > > diff-lcs (1.1.2)
> > > > erubis (2.6.6)
> > > > extlib (0.9.15)
> > > > faker (0.9.5)
> > > > gem_plugin (0.2.3)
> > > > heroku (1.19.1)
> > > > highline (1.6.1)
> > > > i18n (0.5.0)
> > > > launchy (0.3.7)
> > > > linecache19 (0.5.11)
> > > > mail (2.2.15)
> > > > mime-types (1.16)
> > > > minitest (1.6.0)
> > > > mongrel (1.2.0.pre2 x86-mingw32)
> > > > mysql2 (0.2.6 x86-mingw32)
> > > > polyglot (0.3.1)
> > > > populator (1.0.0)
> > > > rack (1.2.2)
> > > > rack-mount (0.6.14)
> > > > rack-test (0.5.7)
> > > > rails (3.0.5)
> > > > railties (3.0.5)
> > > > rake (0.8.7)
> > > > rdiscount (1.6.8)
> > > > rdoc (2.5.8)
> > > > rest-client (1.6.1)
> > > > rhodes (2.3.2)
> > > > ruby-debug-base19 (0.11.24)
> > > > ruby-debug-ide19 (0.4.12)
> > > > ruby-debug19 (0.11.6)
> > > > ruby_core_source (0.1.4)
> > > > templater (1.0.0)
> > > > thor (0.14.6)
> > > > treetop (1.4.9)
> > > > tzinfo (0.3.25)
> >
> > > > thanks for the reply
> >
> > > > On Apr 16, 4:18 pm, Luis Lavena  wrote:
> >
> > > > > On Apr 16, 11:58 am, cipher_neo  wrote:
> >
> > > > > > Hi guys,
> >
> > > > > > I have Rails 3 running on Windows 7 with Ruby 1.9.2
> >
> > > > > > Every now and again, my server crashes, and I see the following
> > > > > > information in the windows event log:
> >
> > > > > > Faulting application name: ruby.exe, version: 1.9.2.180, time
> stamp:
> > > > > > 0x4d5ee5ed
> > > > > > Faulting module name: msvcrt-ruby191.dll, version: 1.9.2.180,
> time
> > > > > > stamp: 0x4d5ee5ec
> > > > > > Exception code: 0xc005
> > > > > > Fault offset: 0x0011a00e
> > > > > > Faulting process id: 0x1624
> > > > > > Faulting application start time: 0x01cbfc46036ca1be
> > > > > > Faulting application path: C:\Ruby192\bin\ruby.exe
> > > > > > Faulting module path: C:\Ruby192\bin\msvcrt-ruby191.dll
> > > > > > Report Id: ae8872dc-6839-11e0-ae3f-904ce5fafcb7
> >
> > > > > > I have no clue what is causing this error, but it is a pain to
> try to
> > > > > > get work done when my app keeps crashing.
> >
> > > > > Can you provide a list of the gems involved in your application?
> >
> > > > > That way we would be able to assist you better.
> >
> > > > > --
> > > > > Luis Lavena
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Ruby on Rails: Talk" group.
> > > To post to this group, send email to rubyonrails-talk@googlegroups.com
> .
> > > To unsubscribe from this group, send email to
> > > rubyonrails-talk+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/rubyonrails-talk?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
You received 

[Rails] has a field through an association

2011-04-18 Thread Garrett Lancaster

Hey guys,

Trying to figure out how to do something like the following:

class Child
belongs_to :parent
has_field :some_field, :through => :parent
end

class Parent
has_one :child
attr_accessible :some_field
end

child.some_field #=> parent.some_field
child.some_field = value #=> sets parent.some_field = value

I can of course accomplish this by adding custom accessors to Child, but 
looking for a better solution. I could also write a plugin that 
dynamically adds the accessors, but not sure if something already exists.


Thanks in advance,
Garrett Lancaster

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



[Rails] Re: rubygems fail - require hpricot!

2011-04-18 Thread Anush J.
Frederick Cheung wrote in post #993456:
> On Apr 18, 7:12am, "Anush J."  wrote:
>> Hi guys,
>> I wanted to fetch some info from webpage and use it in my db. I read
>> hpricot is one way to do it. But the problem is I'm unable to use it
>> with my app. For some reason after successfully installing hpricot it
>> fails when I try to use it in the rails console.
>>
>> I've been trying to fix this for the last four-five days. I'm stumped !
>> I tried re-installing everything and still cant go past the error. Can
>> some one please help me, I really appreciate it !
>>
> Did you add it to your Gemfile?
>
> Fred

Hey Fred,

Argh! I didnt knw about that.

[root@anushj testApp2]# rails c
Loading development environment (Rails 3.0.6)
irb(main):001:0> require 'hpricot'
=> nil
irb(main):002:0>


I think it worked now, I wasted some time doing unwanted things.
Thanks a lot !!!

Anush

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

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



[Rails] Re: Ruby On Rails 3 and Webrick

2011-04-18 Thread kdwill
By noob, I mean me. I'm the noob. Sorry for any confusion.

On Apr 18, 10:30 am, kdwill  wrote:
> Here's where this noob gets nailed.
>
> I tried installing the suggested sudo and got command not found. Then
> I looked for the brew for mac and I'm just not getting it.
>
> Radhames, thanks for your help and patience. If others have
> suggestions of what I'm missing here, please add your voice. All help
> is appreciated.
>
> On Apr 17, 6:50 pm, radhames brito  wrote:
>
> > if you are under *nix environtment try installing this packages, use the
> > brew for mac
>
> > sudo apt-get install libmysql-ruby libmysqlclient-dev

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



[Rails] Re: Ruby On Rails 3 and Webrick

2011-04-18 Thread kdwill
Here's where this noob gets nailed.

I tried installing the suggested sudo and got command not found. Then
I looked for the brew for mac and I'm just not getting it.

Radhames, thanks for your help and patience. If others have
suggestions of what I'm missing here, please add your voice. All help
is appreciated.

On Apr 17, 6:50 pm, radhames brito  wrote:
> if you are under *nix environtment try installing this packages, use the
> brew for mac
>
> sudo apt-get install libmysql-ruby libmysqlclient-dev

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



[Rails] acts_as_commentable validations

2011-04-18 Thread Tony Tony
Hi all,

I recently started back up with Rails and things are going well up until
now.

I've set up acts_as_commentable in my Post model and it's working great.
Problem is users are able to create a "blank" comment. I've added the
following validations in the comment.rb file generated by
acts_as_commentable to limit the comment length:


[code]
validates_length_of :comment, :minimum => 3, :too_short => "must be at
least {{count}} words.", :tokenizer => lambda {|str| str.scan(/\w+/) }

validates_length_of :comment, :maximum => 200, :too_long => "must be
shorter than {{count}} words. Make sure there are no links or
elements.", :tokenizer => lambda {|str| str.scan(/\w+/) }
[/code]


The show view form for the comment is the following:

[code]
<%- form_for [@post, @comment] do |f|-%>
  <%= f.error_messages %>
  <%= f.text_area :comment, :rows => 3 -%>
  <%= f.submit -%>
<%- end -%>
[/code]


However I am getting the following error only when validation fails (if
a normal length comment is created the site works):

[code]
Template is missing

Missing template comments/create with {:handlers=>[:erb, :rjs, :builder,
:rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths
"/...", "/.../.rvm/gems/ruby-1.9.2-head/gems/devise-1.2.1/app/views"
[/code]


Any idea how I can render just a regular validation error? Thanks in
advance!

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

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



Re: [Rails] please help:Can't initialize a new Rails application within the directory of another.

2011-04-18 Thread Vladimir Rybas
"Can't initialize a new Rails application within the directory of another"

You're trying to create Rails project through Netbeans and specifying
a path to an existing Rails project. If you want, kinda, import the
existing Rails project to Netbeans, you should choose to create "New
Rails project with existing sources" or something like that.

On Mon, Apr 18, 2011 at 6:08 PM, hoboy Hoboy  wrote:
> I have just install Netbeans 7.0.
> then install the plugins.
> But when I create a rails project I get the following errors:
> Can't initialize a new Rails application within the directory of
> another, please change to a non-Rails directory first.
> Type 'rails' for 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-talk@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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



Re: [Rails] Re: what is mean of Deployment?

2011-04-18 Thread Colin Law
On 18 April 2011 17:46, amrit pal pathak  wrote:
>
>
> On Apr 18, 12:30 pm, Colin Law  wrote:
>> On 18 April 2011 17:12, amrit pal pathak  wrote:
>>
>>
>>
>> > On Apr 18, 9:07 am, Colin Law  wrote:
>> >> On 18 April 2011 10:00, amrit pal pathak  
>> >> wrote:
>>
>> >> > ...
>> >> >     it will be created as rake db:create (after specifying in the
>> >> > production enviornment i,e database: production)??  and to
>> >> >> start the server in production mode.
>>
>> >> To create the production database
>> >> RAILS_ENV=production rake db:migrate
>> >         Please tell me in which  to specity RAILS_ENV=production.I
>> > didnt
>> >         find it in enviornment.rb file
>>
>> You just run the command
>> RAILS_ENV=production rake db:create
>   I ran RAILS_ENV=production  and then rake db:create (sussessfully
> worked) It created the database with same name as my application name.
>       is  It all done?

Is what all done?  It created the db, what more do you expect rake
db:create to do?

>         There is no need to change the database.yml file's production
> environment settings?

If you wanted any changes you should have made them before running
db:create.  It will have used the settings under production: from
database.yml.

Colin

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



[Rails] Re: what is mean of Deployment?

2011-04-18 Thread amrit pal pathak


On Apr 18, 12:30 pm, Colin Law  wrote:
> On 18 April 2011 17:12, amrit pal pathak  wrote:
>
>
>
> > On Apr 18, 9:07 am, Colin Law  wrote:
> >> On 18 April 2011 10:00, amrit pal pathak  wrote:
>
> >> > ...
> >> >     it will be created as rake db:create (after specifying in the
> >> > production enviornment i,e database: production)??  and to
> >> >> start the server in production mode.
>
> >> To create the production database
> >> RAILS_ENV=production rake db:migrate
> >         Please tell me in which  to specity RAILS_ENV=production.I
> > didnt
> >         find it in enviornment.rb file
>
> You just run the command
> RAILS_ENV=production rake db:create
   I ran RAILS_ENV=production  and then rake db:create (sussessfully
worked) It created the database with same name as my application name.
   is  It all done?
 There is no need to change the database.yml file's production
environment settings?

Thanks

> As I pointed out previously did you try googling for
> rails create production database
> before asking here?
   I tried but it didn't help.Thats why i moved here

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



Re: [Rails] DateTime + x.days, x.minutes and the like?

2011-04-18 Thread Philip Hallstrom
> > This cant be so hard but feeling rather annoyed with myself for thinking I
> > can do the following:
> >
> > DateTime.now + 1.day
> >
> > Is there any easy way to do this?
> 
> I prefer to use .since and .ago:
> 
>  DateTime.now.since(1.day)
> 
> Hmmm, I like the idea but getting an error - I am in rails console (Ruby 
> 1.8.7)... but in Ruby 1.9.2 the method is present. Any idea how to aproach 
> this problem in 1.8.7?
> 
> ruby-1.8.7-p330 :020 > DateTime.now.since(1.day)
> NoMethodError: undefined method `since' for # 2011-04-15T13:52:34-05:00>
> 
> ruby-1.9.2-p136 :001 > DateTime.now.since(1.day)
>  => Sat, 16 Apr 2011 13:55:22 -0500 
> 
> 
> Which version of ActiveSupport are you running? I have ruby 1.8.7 installed 
> and ActiveSupport 2.3.11. I was able to run your first examples and get the 
> correct output as well as run Micheal's examples and get the correct output.  
>  
> 
> Hey Brian, thanks so I am on activesupport (= 3.0.6) (from my gemfile 
> lock, which I assume is reliable)... on one side I am glad that perhaps 
> something is wrong with my environment because I have resorted to doing 
> things like: Time.now + 1.day.seconds to get certain outcomes (gave up on 
> datetime). 
> 
> So you are on Rails 2, right? I wonder if either is a difference bet R2 and 
> R3 but I think Michael was using Ruby 1.9.2 and I assumed Rails 3. I guess I 
> should probably drop my gemset and reinstall and see what happens 
> 
> ruby-1.8.7-p330 :001 > DateTime.now
>  => # 
> ruby-1.8.7-p330 :002 > DateTime.now + 1.day
>  => # 
> 
>  
> 
> >> DateTime.now
> => Sat, 16 Apr 2011 01:00:29 -0500
> >> DateTime.now + 1.day
> => Sun, 17 Apr 2011 01:00:32 -0500
> 
> >> DateTime.now.since(1.day)
> => Sun, 17 Apr 2011 01:00:34 -0500
> 
> Am still perplexed by this output (ruby 1.8.7-p330 on 64bit/Snow Leopard):
> 
> 
> ruby-1.8.7-p330 :001 > DateTime.now
>  => # 
> ruby-1.8.7-p330 :002 > DateTime.now + 1.day
>  => # 
> 
> I was thinking that maybe it was due to upgrading to Snow Leopard but I 
> reinstalled ruby and my gemset and not success, could that be a plausible 
> explanation and I am missing something? Anyone have any other idea? Really 
> bothering me that I am getting one result and others on list getting 
> different. 
> 
> 
> I wonder if it is the patch level that is the issue. I'm not using p330. This 
> is my version:
> 
> ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
> 
> To the group: Is anyone else running p330 and having this issue? 

Not p330, but p334... doesn't show the problem.

ruby-1.8.7-p334 :036 > DateTime.now
 => Mon, 18 Apr 2011 09:32:07 -0700 
ruby-1.8.7-p334 :037 >  DateTime.now + 1.day
 => Tue, 19 Apr 2011 09:32:18 -0700 

  ruby:
interpreter:  "ruby"
version:  "1.8.7"
date: "2011-02-18"
platform: "x86_64-darwin10.6.0"
patchlevel:   "2011-02-18 patchlevel 334"
full_version: "ruby 1.8.7 (2011-02-18 patchlevel 334) [x86_64-darwin10.6.0]"


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



Re: [Rails] Re: what is mean of Deployment?

2011-04-18 Thread Colin Law
On 18 April 2011 17:12, amrit pal pathak  wrote:
>
>
> On Apr 18, 9:07 am, Colin Law  wrote:
>> On 18 April 2011 10:00, amrit pal pathak  wrote:
>>
>> > ...
>> >     it will be created as rake db:create (after specifying in the
>> > production enviornment i,e database: production)??  and to
>> >> start the server in production mode.
>>
>> To create the production database
>> RAILS_ENV=production rake db:migrate
>         Please tell me in which  to specity RAILS_ENV=production.I
> didnt
>         find it in enviornment.rb file

You just run the command
RAILS_ENV=production rake db:create
(note, I made a mistake before, it is db:create not db:migrate)
That sets the environment variable RAILS_ENV to production and runs
rake, then rake db:create checks RAILS_ENV so it knows which section
to use from database.yml and which file to use from
config/environments.

As I pointed out previously did you try googling for
rails create production database
before asking here?

Colin

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



[Rails] Re: what is mean of Deployment?

2011-04-18 Thread dana tassler
As always, Colin has at least one good point.  And I would add to
that.

Initially, you asked what is meant by deployment.  Several people did
provide the answer to that question, at which point this topic could
safely have been considered "closed."

Being resourceful is always a good idea.  However, this thread has
turned quickly from a question about the meaning of deployment to
"please step me through deployment of an application."  ;-)

On Apr 18, 8:07 am, Colin Law  wrote:
> On 18 April 2011 10:00, amrit pal pathak  wrote:
>
> > ...
> >     it will be created as rake db:create (after specifying in the
> > production enviornment i,e database: production)??  and to
> >> start the server in production mode.
>
> To create the production database
> RAILS_ENV=production rake db:migrate
>
> The setting for RAILS_ENV tells it which settings to use from
> database.yml (production or development normally)
>
> to start server in production mode
> script/server -e production
>
> Googling for
> rails create production database
> and
> rails start server production
> would probably have got you the answer to these much quicker than waiting 
> here.
>
> Colin

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



[Rails] Re: what is mean of Deployment?

2011-04-18 Thread amrit pal pathak


On Apr 18, 9:07 am, Colin Law  wrote:
> On 18 April 2011 10:00, amrit pal pathak  wrote:
>
> > ...
> >     it will be created as rake db:create (after specifying in the
> > production enviornment i,e database: production)??  and to
> >> start the server in production mode.
>
> To create the production database
> RAILS_ENV=production rake db:migrate
 Please tell me in which  to specity RAILS_ENV=production.I
didnt
 find it in enviornment.rb file

   Thanks

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



[Rails] Re: what is mean of Deployment?

2011-04-18 Thread amrit pal pathak


On Apr 18, 11:41 am, dana tassler  wrote:
> As always, Colin has at least one good point.  And I would add to
> that.
>
> Initially, you asked what is meant by deployment.  Several people did
> provide the answer to that question, at which point this topic could
> safely have been considered "closed."
I too think so.Sorry for extending the question.
>

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



Re: [Rails] DateTime + x.days, x.minutes and the like?

2011-04-18 Thread Bryan Crossland
On Mon, Apr 18, 2011 at 10:38 AM, David Kahn wrote:

>
>
> On Sat, Apr 16, 2011 at 4:37 AM, David Kahn 
> wrote:
>
>>
>>
>> On Sat, Apr 16, 2011 at 1:01 AM, Bryan Crossland 
>> wrote:
>>
>>> On Fri, Apr 15, 2011 at 1:56 PM, David Kahn 
>>> wrote:
>>>


 On Fri, Apr 15, 2011 at 1:50 PM, Michael Pavling wrote:

> On 15 April 2011 19:41, David Kahn  wrote:
> > This cant be so hard but feeling rather annoyed with myself for
> thinking I
> > can do the following:
> >
> > DateTime.now + 1.day
> >
> > Is there any easy way to do this?
>
> I prefer to use .since and .ago:
>
>  DateTime.now.since(1.day)
>

 Hmmm, I like the idea but getting an error - I am in rails console (Ruby
 1.8.7)... but in Ruby 1.9.2 the method is present. Any idea how to aproach
 this problem in 1.8.7?

 ruby-1.8.7-p330 :020 > DateTime.now.since(1.day)
 NoMethodError: undefined method `since' for #>>> 2011-04-15T13:52:34-05:00>

 ruby-1.9.2-p136 :001 > DateTime.now.since(1.day)
  => Sat, 16 Apr 2011 13:55:22 -0500


>>> Which version of ActiveSupport are you running? I have ruby 1.8.7
>>> installed and ActiveSupport 2.3.11. I was able to run your first examples
>>> and get the correct output as well as run Micheal's examples and get the
>>> correct output.
>>>
>>
>> Hey Brian, thanks so I am on activesupport (= 3.0.6) (from my gemfile
>> lock, which I assume is reliable)... on one side I am glad that perhaps
>> something is wrong with my environment because I have resorted to doing
>> things like: Time.now + 1.day.seconds to get certain outcomes (gave up on
>> datetime).
>>
>> So you are on Rails 2, right? I wonder if either is a difference bet R2
>> and R3 but I think Michael was using Ruby 1.9.2 and I assumed Rails 3. I
>> guess I should probably drop my gemset and reinstall and see what
>> happens
>>
>> ruby-1.8.7-p330 :001 > DateTime.now
>>  => #
>> ruby-1.8.7-p330 :002 > DateTime.now + 1.day
>>  => #
>>
>>
>>
>>>
>>> >> DateTime.now
>>> => Sat, 16 Apr 2011 01:00:29 -0500
>>> >> DateTime.now + 1.day
>>> => Sun, 17 Apr 2011 01:00:32 -0500
>>>
>>> >> DateTime.now.since(1.day)
>>> => Sun, 17 Apr 2011 01:00:34 -0500
>>>
>>
> Am still perplexed by this output (ruby 1.8.7-p330 on 64bit/Snow Leopard):
>
>
> ruby-1.8.7-p330 :001 > DateTime.now
>  => #
> ruby-1.8.7-p330 :002 > DateTime.now + 1.day
>  => #
>
> I was thinking that maybe it was due to upgrading to Snow Leopard but I
> reinstalled ruby and my gemset and not success, could that be a plausible
> explanation and I am missing something? Anyone have any other idea? Really
> bothering me that I am getting one result and others on list getting
> different.
>
>
I wonder if it is the patch level that is the issue. I'm not using p330.
This is my version:

ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]

To the group: Is anyone else running p330 and having this issue?

B.

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



Re: [Rails] handling validation

2011-04-18 Thread Matt Harrison
On Mon, Apr 18, 2011 at 07:51:49AM -0500, Bryan Crossland wrote:
> On Sun, Apr 17, 2011 at 5:01 PM, Matt Harrison  > wrote:
> 
> >
> > I can post full code examples if necessary.
> >
> >
> That would be extremely helpful.

Ok, here is the controller code:

http://pastie.org/1807523

And the views:

http://pastie.org/1807530

And the partial:

http://pastie.org/1807536


new/update works perfectly, while edit/update gives this error while visiting 
the edit
action:

http://pastie.org/1807548


If I change the edit view to look like the following, it works fine:

http://pastie.org/1807558

But I don't want to have to do that for every view. As you can tell I'm no 
expert and
I'm a bit stumped. Grateful for some tips

Thanks


pgp88XJluE97e.pgp
Description: PGP signature


Re: [Rails] DateTime + x.days, x.minutes and the like?

2011-04-18 Thread David Kahn
On Sat, Apr 16, 2011 at 4:37 AM, David Kahn wrote:

>
>
> On Sat, Apr 16, 2011 at 1:01 AM, Bryan Crossland wrote:
>
>> On Fri, Apr 15, 2011 at 1:56 PM, David Kahn 
>> wrote:
>>
>>>
>>>
>>> On Fri, Apr 15, 2011 at 1:50 PM, Michael Pavling wrote:
>>>
 On 15 April 2011 19:41, David Kahn  wrote:
 > This cant be so hard but feeling rather annoyed with myself for
 thinking I
 > can do the following:
 >
 > DateTime.now + 1.day
 >
 > Is there any easy way to do this?

 I prefer to use .since and .ago:

  DateTime.now.since(1.day)

>>>
>>> Hmmm, I like the idea but getting an error - I am in rails console (Ruby
>>> 1.8.7)... but in Ruby 1.9.2 the method is present. Any idea how to aproach
>>> this problem in 1.8.7?
>>>
>>> ruby-1.8.7-p330 :020 > DateTime.now.since(1.day)
>>> NoMethodError: undefined method `since' for #>> 2011-04-15T13:52:34-05:00>
>>>
>>> ruby-1.9.2-p136 :001 > DateTime.now.since(1.day)
>>>  => Sat, 16 Apr 2011 13:55:22 -0500
>>>
>>>
>> Which version of ActiveSupport are you running? I have ruby 1.8.7
>> installed and ActiveSupport 2.3.11. I was able to run your first examples
>> and get the correct output as well as run Micheal's examples and get the
>> correct output.
>>
>
> Hey Brian, thanks so I am on activesupport (= 3.0.6) (from my gemfile
> lock, which I assume is reliable)... on one side I am glad that perhaps
> something is wrong with my environment because I have resorted to doing
> things like: Time.now + 1.day.seconds to get certain outcomes (gave up on
> datetime).
>
> So you are on Rails 2, right? I wonder if either is a difference bet R2 and
> R3 but I think Michael was using Ruby 1.9.2 and I assumed Rails 3. I guess I
> should probably drop my gemset and reinstall and see what happens
>
> ruby-1.8.7-p330 :001 > DateTime.now
>  => #
> ruby-1.8.7-p330 :002 > DateTime.now + 1.day
>  => #
>
>
>
>>
>> >> DateTime.now
>> => Sat, 16 Apr 2011 01:00:29 -0500
>> >> DateTime.now + 1.day
>> => Sun, 17 Apr 2011 01:00:32 -0500
>>
>> >> DateTime.now.since(1.day)
>> => Sun, 17 Apr 2011 01:00:34 -0500
>>
>
Am still perplexed by this output (ruby 1.8.7-p330 on 64bit/Snow Leopard):

ruby-1.8.7-p330 :001 > DateTime.now
 => #
ruby-1.8.7-p330 :002 > DateTime.now + 1.day
 => #

I was thinking that maybe it was due to upgrading to Snow Leopard but I
reinstalled ruby and my gemset and not success, could that be a plausible
explanation and I am missing something? Anyone have any other idea? Really
bothering me that I am getting one result and others on list getting
different.



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

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



Re: [Rails] Rails 3 render erb text

2011-04-18 Thread Andrew Miehs
On Mon, Apr 18, 2011 at 2:59 PM, Bryan Crossland wrote:

>  On Sun, Apr 17, 2011 at 6:17 PM, Andrew Miehs  wrote:
>
>> Why does
>>render 'configure.text.erb'
>> actually work?
>>
>> How does render know that this is plain text? Does it assume this due to
>> the text.erb ending?
>>
>> How does this actually all plumb together?
>>
>>
>> I think you will find these links helpful in answering your questions:
>>
>> How does respond_to work in Rails controllers?
>>
>> http://www.tokumine.com/2009/09/13/how-does-respond_to-work-in-the-rails-controllers/
>>
>> Layouts and Rendering in Rails
>> http://guides.rubyonrails.org/layouts_and_rendering.html
>>
>> B.
>
>
Perfect - thankyou!

Andrew

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



[Rails] Rails HTML5 Boilerplate Application Template

2011-04-18 Thread Russ
Just wanted to let fellow Rails users about a Rails
application template I wrote to help speed up the process of starting
new Rails projects that will make use of Paul Irish's HTML 5
Boilerplate (http://html5boilerplate.com/).

Project location: https://github.com/russfrisch/Rails-HTML5-Boilerplate-Template

Usage: rails new  -m
https://github.com/russfrisch/Rails-HTML5-Boilerplate-Template/raw/master/html5boilerplate.rb

This template does the following:

* Removes default prototype/scriptaculous javascripts and Rails driver
* Downloads latest jQuery Rails driver and place into javascripts
folder
* Downloads HTML5 Boilerplate dependencies: javascripts, stylesheets,
icons, .htaccess, etc.
* Replace _contents_ of default application.html.erb layout with the
contents of HTML5 boilerplate index.html
* Modifies the updated application.html.erb to add back in appropriate
Rails content
* Updates javascript :defaults expansion to include jquery, plugins,
and rails driver.

I'm relatively new to Ruby/Rails and this is my first template so any
suggestions, feedback, or push requests are certainly welcome.

Hopefully this saves someone a little bit of time.

Russ

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



[Rails] Re: Unable to install Rails through proxy

2011-04-18 Thread rubynewbie
The problem is not inclusion of http:// in the URL(I tried without
that). On the contrary I suspect the reason to be on how to specify
the domain in the URL. Is my way of specifying the domain right?

C:\Documents and Settings\Users\Desktop>gem install rails -v 3.0.1  -p
http://MYDOMAIN\myUserID:MyPassword@MyProxy:Port


Thanks,

S

On Apr 18, 6:42 pm, Bryan Crossland  wrote:
> On Mon, Apr 18, 2011 at 4:58 AM, rubynewbie wrote:
>
>
>
> > I am new to Rails and have been facing difficulty while installing
> > rails. I have already installed Ruby and RubyGems on my machine by
> > downloading the packages. But when I install Rails through RubyGems
> > through a HTTP Proxy , I am thrown an error. Below is the details of
> > the command and the exception i am getting :
>
> > Command Executed :
> > C:\Documents and Settings\Users\Desktop>gem install rails -v 3.0.1  -p
> >http://mydomain\myUserID:MyPassword@MyProxy:Port
>
> > Error thrown  :
>
> > ERROR:  While executing gem ... (OptionParser::InvalidArgument)
> >    invalid argument: -phttp://myDomain\MyUserID:MyPassword@MyProxy:80
>
> > Please note that mydomain is the domain to which my User ID belongs.
> > The authentication is ISA i believe.
>
> >  Would appreciate some help in this.
>
> > Thanks in advance
>
> > S
>
> Since you are calling an http proxy I don't think you need to specify
> http:// on the URL. I could be wrong. I don't have a proxy to test against
> to confirm this.
>
> B.

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



[Rails] how can i test a file content with cucumber

2011-04-18 Thread Isaac Jarquin
Hi everyone, im quite new  in cucumber worl and I need to test a file
content in cucumber and i cant find a clue of how to do it, could
anyone help me ?

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



[Rails] Dynamic model validation

2011-04-18 Thread Alex Takitani
Hi, I am searching for a way to dynamic validate my models.

The solution that I got working is:

def after_initialize
  singleton = class << self; self; end

  validations = eval(calendar.cofig)

  validations.each do |val|
singleton.class_eval(val)
  end
end

On my actual app, I have 2 models

class Calendar < ActiveRecord::Base
  has_many :events
end

class Event < ActiveRecord::Base
  belongs_to :calendar

  def after_initialize
singleton = class << self; self; end

validations = eval(calendar.config)

validations.each do |val|
   singleton.class_eval(val)
end
 end

end

As you can see, the validation code that should be added to the Event
class lies on the Calendar field "config".

Works fine for a existing Event, but doesn't for a new record. That's
because, at the time that after_initialize is called, the association
doesn't exists yet.

I can't find a way to do that besides putting the config values on
Event itself.

Any advices?

Tks!

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



Re: [Rails] paypal with Active merchant

2011-04-18 Thread David Kahn
On Mon, Apr 18, 2011 at 8:56 AM, Bryan Crossland wrote:

> On Mon, Apr 18, 2011 at 6:23 AM, News Aanad wrote:
>
>> Hi, I am integrating paypal service in my application using
>> Activemerchant.
>>
>> Now I want to know how to use ActiveMerchant to make payment to Bank or
>> Credit card ?
>>
>> for example:
>> I am seller and I want to pay some amount to somebody. I want to pay such
>> amount which will be credited in somebody's bank account or credit card
>> directly ?
>>
>> Please reply me as early as possible.
>> And also suggest me any configuration which i should make in test
>> accounts, if any.
>>
>>
> Try using the credit method.
>
>
> http://activemerchant.rubyforge.org/classes/ActiveMerchant/Billing/TrustCommerceGateway.html#M000339
>

I actually was just looking into this last week. What I found was that I
could only credit up to an amount equal to what was already billed (in
essence cancelling a charge), from the link above:

"credit()
allows you to return money to a card that was previously billed."

If you are looking to pay someone (vs reimburse a payment you captured),
paypal has a method to send a payment and although I have not implemented
this it looks like you should be able to, see the following links:

http://activemerchant.rubyforge.org/classes/ActiveMerchant/Billing/PaypalCommonAPI.html#M000192

http://dimaspriyanto.com/2010/05/01/simple-paypal-transfer-using-active-merchant/




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

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



[Rails] Re: Rails 3 Crashing On Windows 7

2011-04-18 Thread cipher_neo
It seems to die while processing dynamic javascript...

I have a controller for managing the dynamic javascript (as documented
here: http://railscasts.com/episodes/88-dynamic-select-menus)

The exact lines that appear in the development.log file before the app
crashes are:

Started GET "/javascripts/products.js" for 89.100.131.129 at
2011-04-18 15:23:49 +0100
  Processing by JavascriptsController#products as JS

and the products.js.erb file contains:

var products = new Array();

<% Product.all.each do |p|%>
products[<%= p.id %>] = {'id':'<%= p.id %>', 'name':'<%= p.name %>',
'price':<%= p.price %>};
<% end %>


thanks

On Apr 18, 1:49 pm, Bryan Crossland  wrote:
> On Sun, Apr 17, 2011 at 4:14 PM, cipher_neo  wrote:
> > sorry, they are all the gems on my system.
>
> > I only use the following: (from Gemfile)
>
> >  gem 'annotate-models', :require => 'annotate_models'
> >  gem 'ruby-debug19'
> >  gem 'populator'
> >  gem 'faker'
> >  gem "mongrel", '1.2.0.pre2'
>
> What exactly is your application trying to do when it crashes?
>
> B.
>
>
>
>
>
>
>
>
>
> > On Apr 16, 4:20 pm, cipher_neo  wrote:
> > > sure:
>
> > > C:\Windows\System32>gem list
>
> > > *** LOCAL GEMS ***
>
> > > abstract (1.0.0)
> > > actionmailer (3.0.5)
> > > actionpack (3.0.5)
> > > activemodel (3.0.5)
> > > activerecord (3.0.5)
> > > activeresource (3.0.5)
> > > activesupport (3.0.5, 2.3.11)
> > > annotate-models (1.0.4)
> > > archive-tar-minitar (0.5.2)
> > > arel (2.0.9)
> > > builder (2.1.2)
> > > bundler (1.0.10)
> > > cgi_multipart_eof_fix (2.5.0)
> > > columnize (0.3.2)
> > > configuration (1.2.0)
> > > diff-lcs (1.1.2)
> > > erubis (2.6.6)
> > > extlib (0.9.15)
> > > faker (0.9.5)
> > > gem_plugin (0.2.3)
> > > heroku (1.19.1)
> > > highline (1.6.1)
> > > i18n (0.5.0)
> > > launchy (0.3.7)
> > > linecache19 (0.5.11)
> > > mail (2.2.15)
> > > mime-types (1.16)
> > > minitest (1.6.0)
> > > mongrel (1.2.0.pre2 x86-mingw32)
> > > mysql2 (0.2.6 x86-mingw32)
> > > polyglot (0.3.1)
> > > populator (1.0.0)
> > > rack (1.2.2)
> > > rack-mount (0.6.14)
> > > rack-test (0.5.7)
> > > rails (3.0.5)
> > > railties (3.0.5)
> > > rake (0.8.7)
> > > rdiscount (1.6.8)
> > > rdoc (2.5.8)
> > > rest-client (1.6.1)
> > > rhodes (2.3.2)
> > > ruby-debug-base19 (0.11.24)
> > > ruby-debug-ide19 (0.4.12)
> > > ruby-debug19 (0.11.6)
> > > ruby_core_source (0.1.4)
> > > templater (1.0.0)
> > > thor (0.14.6)
> > > treetop (1.4.9)
> > > tzinfo (0.3.25)
>
> > > thanks for the reply
>
> > > On Apr 16, 4:18 pm, Luis Lavena  wrote:
>
> > > > On Apr 16, 11:58 am, cipher_neo  wrote:
>
> > > > > Hi guys,
>
> > > > > I have Rails 3 running on Windows 7 with Ruby 1.9.2
>
> > > > > Every now and again, my server crashes, and I see the following
> > > > > information in the windows event log:
>
> > > > > Faulting application name: ruby.exe, version: 1.9.2.180, time stamp:
> > > > > 0x4d5ee5ed
> > > > > Faulting module name: msvcrt-ruby191.dll, version: 1.9.2.180, time
> > > > > stamp: 0x4d5ee5ec
> > > > > Exception code: 0xc005
> > > > > Fault offset: 0x0011a00e
> > > > > Faulting process id: 0x1624
> > > > > Faulting application start time: 0x01cbfc46036ca1be
> > > > > Faulting application path: C:\Ruby192\bin\ruby.exe
> > > > > Faulting module path: C:\Ruby192\bin\msvcrt-ruby191.dll
> > > > > Report Id: ae8872dc-6839-11e0-ae3f-904ce5fafcb7
>
> > > > > I have no clue what is causing this error, but it is a pain to try to
> > > > > get work done when my app keeps crashing.
>
> > > > Can you provide a list of the gems involved in your application?
>
> > > > That way we would be able to assist you better.
>
> > > > --
> > > > Luis Lavena
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-talk@googlegroups.com.
> > To unsubscribe from this group, send email to
> > rubyonrails-talk+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/rubyonrails-talk?hl=en.

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



[Rails] Re: Which editor to use

2011-04-18 Thread king key
www.wholesalesnkey.com
windows 7
office 2007
office 2010
office visio key
windows visio key
windows xp key

wholesale windows 7 key
wholesale office 2007 key
wholesale office 2010 key
wholesale office visio key
wholesale windows visio key
wholesale windows xp key
Cheap and easy to use

Do not miss passing through!
Select only expensive non-election!

www.wholesalesnkey.com

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

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



Re: [Rails] Rails3 integration with SourceForce

2011-04-18 Thread Bryan Crossland
On Mon, Apr 18, 2011 at 6:01 AM, balakrishna.ka...@gmail.com <
balakrishna.ka...@gmail.com> wrote:

> Hi,
>   I looking forward to integrate Rail3 application with
> SourceForce. Any help in this regard is appreciated.
>
> Thanks,
> Balakrishna
>
>
What is SourceForce? Did you mean SourceForge?

B.

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



[Rails] please help:Can't initialize a new Rails application within the directory of another.

2011-04-18 Thread hoboy Hoboy
I have just install Netbeans 7.0.
then install the plugins.
But when I create a rails project I get the following errors:
Can't initialize a new Rails application within the directory of
another, please change to a non-Rails directory first.
Type 'rails' for 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-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] rails runner giving problem

2011-04-18 Thread Bryan Crossland
On Mon, Apr 18, 2011 at 7:44 AM, Mike Disuza  wrote:

> Hi,
> I have a rails 2.3.8 application, which has some ruby script in scripts
> folder which has ran through the cron.
>
> I just upgraded my application to rails 3. My problem is I am not able
> found a solution to run these scripts.
>
> In Rails 2.3.8:-
> ruby script/runner test.rb
>
> In Rails 3:-
> rails runner test.rb does not working.
>
> Can anyone tell me How can I run the scripts?
>
>
What error do you get when trying to run rails runner test.rb?

B.

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



Re: [Rails] paypal with Active merchant

2011-04-18 Thread Bryan Crossland
On Mon, Apr 18, 2011 at 6:23 AM, News Aanad  wrote:

> Hi, I am integrating paypal service in my application using Activemerchant.
>
> Now I want to know how to use ActiveMerchant to make payment to Bank or
> Credit card ?
>
> for example:
> I am seller and I want to pay some amount to somebody. I want to pay such
> amount which will be credited in somebody's bank account or credit card
> directly ?
>
> Please reply me as early as possible.
> And also suggest me any configuration which i should make in test accounts,
> if any.
>
>
Try using the credit method.

http://activemerchant.rubyforge.org/classes/ActiveMerchant/Billing/TrustCommerceGateway.html#M000339

B.

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



Re: [Rails] Re: Rails 3 Migration expecting test gems to be installed??

2011-04-18 Thread Bryan Crossland
On Mon, Apr 18, 2011 at 5:43 AM, johnnybutler7 wrote:

> Yes i did bundle install --without test and that worked fine, when i
> try the db migrate for staging
> i get the error, i could install all the gems as you say rspec is
> needed for other stuff possibly but
> the actual error for the autotest gem is because its specific to mac,
> the staging site is on linux.  From reading
> the docs it seems to suggest that bundler will know what OS you are on
> and install the appropriate gem. The whole point of
> the grouping should be exactly for this reason, i shouldnt have to
> install test/dev gems on the staging/production server.
>
> Maybe its something silly im doing but but i can see what.
>
>
You didn't happen to move over your Gemfile.lock from your mac to your
staging server did you? If you did, try deleting that file and running the
command again.

B.





> On Apr 18, 11:16 am, Frederick Cheung 
> wrote:
> > On Apr 15, 2:01 pm, johnnybutler7  wrote:
> >
> > > Hi,
> >
> > > I have gem file set up so only the specific gems are installed/needed
> > > for each environment, so all the test gems like cucumber etc are
> > > grou[ed in test.  When i try a rake db:migrate RAILS_ENV=staging on
> > > the staging server however i get an error saying  gem is not
> > > installed, please use bundle install.  I dont want the test gems
> > > installed on this server however when i run the migration on staging
> > > its expecting them to be installed.
> >
> > > Anyone hit this problem before and how did you sort it, i cant find
> > > anything in the forums?
> >
> > did you run bundle install --without test --without development
> >
> > Some gems (like rspec) used to generate rake files that required rspec
> > to be loaded, so when rails tried to load your rake tasks it would
> > fail if those gems weren't there anymore. They don't anymore though,
> > now that everyone has figured out the sensible ways of working with
> > bundler - I'd try using a current versions of those gems and clearing
> > out any unneeded rake task files.
> >
> > Fred
> >
> >
> >
> > > JB
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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



Re: [Rails] Unable to install Rails through proxy

2011-04-18 Thread Bryan Crossland
On Mon, Apr 18, 2011 at 4:58 AM, rubynewbie wrote:

> I am new to Rails and have been facing difficulty while installing
> rails. I have already installed Ruby and RubyGems on my machine by
> downloading the packages. But when I install Rails through RubyGems
> through a HTTP Proxy , I am thrown an error. Below is the details of
> the command and the exception i am getting :
>
> Command Executed :
> C:\Documents and Settings\Users\Desktop>gem install rails -v 3.0.1  -p
> http://mydomain\myUserID:MyPassword@MyProxy:Port
>
> Error thrown  :
>
> ERROR:  While executing gem ... (OptionParser::InvalidArgument)
>invalid argument: -p http://myDomain\MyUserID:MyPassword@MyProxy:80
>
> Please note that mydomain is the domain to which my User ID belongs.
> The authentication is ISA i believe.
>
>  Would appreciate some help in this.
>
> Thanks in advance
>
> S
>


Since you are calling an http proxy I don't think you need to specify
http:// on the URL. I could be wrong. I don't have a proxy to test against
to confirm this.

B.

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



Re: [Rails] how to handle session with external input?

2011-04-18 Thread Bryan Crossland
On Mon, Apr 18, 2011 at 4:48 AM, frankblizzard wrote:

> Hi,
>
> I hope I chose the right title for the question. I am doing a time
> tracking app for our intranet. Because the people tend to forget to
> save their hours, we made a small desktop app with adobe air that pops
> up where you can enter your hours, the hours should be posted to the
> hours controller of the rails app.
>
> When we post the data to /hours/new we get redirected to the login
> page, because we are not logged in.
> Question is can a session exist outside of the application, or does
> session return anything that we could send with each post data to
> confirm that the user is logged in?
>
> which route you guys would go in order to solve this problem?
> many thanks in advance..
>
>
I would suggest coding your Adobe Air application to login into your rails
app before trying to add the hours. If you have the users login/password,
whether provided by the user or stored by them in your Air app, then it
should not be too much of an issue to send them over to your login
controller and log the user in.

B.

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



Re: [Rails] whyt should i use mongrel_cluster ?

2011-04-18 Thread Colin Law
On 18 April 2011 11:20, amrit pal pathak  wrote:
> why should i use mongrel_cluster in my rails application?
>  What are its benefits for which i should install and configure it

Read up what a mongrel cluster is.  If the answer to your question is
not then obvious ask it again.

Colin

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



Re: [Rails] Re: Problem with resque; parent process doesn't die

2011-04-18 Thread Bryan Crossland
On Mon, Apr 18, 2011 at 12:37 AM, Nilesh  wrote:

> What if I explicitly exit process(using Process.exit(0)) in FooJob#perform
> after line Bar.add_jobs?


No as that will kill your child processes as they start. You should take a
look at Parents and Children as well as the Signals section of the Resque
README. It discusses using a QUIT signal to shut down idle processes. It
also talks about checking to see what that process is doing in queue.

https://github.com/defunkt/resque

B.

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



Re: [Rails] Re: what is mean of Deployment?

2011-04-18 Thread Colin Law
On 18 April 2011 10:00, amrit pal pathak  wrote:
> ...
>     it will be created as rake db:create (after specifying in the
> production enviornment i,e database: production)??  and to
>> start the server in production mode.

To create the production database
RAILS_ENV=production rake db:migrate

The setting for RAILS_ENV tells it which settings to use from
database.yml (production or development normally)

to start server in production mode
script/server -e production

Googling for
rails create production database
and
rails start server production
would probably have got you the answer to these much quicker than waiting here.

Colin

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



[Rails] Re: unable to set default_url_options on per environment basis

2011-04-18 Thread Frederick Cheung

On Apr 17, 10:16 pm, charles d  wrote:
> Im trying to set the default_url_options on a per environment basis
> but nothing is working. I keep getting "Missing host to link to!
> Please provide :host parameter or set default_url_options[:host]"
>
> post.rb
>
> def share_all
>   url =  Rails.application.routes.url_helpers.post_url(self)
>   if user.authentications.where(:provider => 'twitter').any?
>     user.twitter_share(url)
>   end
> end
>
> I've tried adding this to my config/environments/development.rb :
>
> development.rb
>
> config.action_controller.default_url_options = {:host => "localhost:
> 3000"}
>
> which didn't work so I tried it this way:
>
> development.rb
>
> config.action_controller.default_url_options = {:host =>
> "localhost", :port => 3000}
>
> And that didnt work so I tried just defining the method in the
> application controller but it didnt work either.
>
> class ApplicationController < ActionController::Base
>   protect_from_forgery
>   include ApplicationHelper
>   def default_url_options
>       { :host => "example.com"}
>   end
> end
>
> What am I missing here? This is driving me nuts, thanks.

I think  you're not setting default_url_options in the correct place -
you're using the named routes module in isolation (whereas normally
that code would be called from within a controller or helper) so the
stuff you're doing to ApplicationController doesn't come into place.

 Rails.application.routes.default_url_options[:host]= 'example.com'

seems to do the trick

Fred

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



Re: [Rails] Rails 3 render erb text

2011-04-18 Thread Bryan Crossland
On Sun, Apr 17, 2011 at 6:17 PM, Andrew Miehs  wrote:

> Hi all,
>
> I have a file called configure.text.erb in views// directory.
>
> Why does
>render 'configure.text.erb'
> actually work?
>
> How does render know that this is plain text? Does it assume this due to
> the text.erb ending?
>
> How does this actually all plumb together?
>
> And would be the difference in the between using the following two to
> generate html in a controller?
> Am I correct in assuming that the first one will only generate html if
> asked for, the other will generate it all the time?
> Does something in format.html call "render" ?
>
>respond_to do |format|
>  format.html # configure.html.erb
>end
>
> and using
>
>render 'configure.html.erb'
>
> Rails does a whole lot of great things, but at the moment the magic is
> overwhelming me.
> Trying to work out how all this is connected is really confusing.
>
>
> Thanks for any light you can shed on this.
>
>

I think you will find these links helpful in answering your questions:

How does respond_to work in Rails controllers?
http://www.tokumine.com/2009/09/13/how-does-respond_to-work-in-the-rails-controllers/

Layouts and Rendering in Rails
http://guides.rubyonrails.org/layouts_and_rendering.html

B.

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



Re: [Rails] handling validation

2011-04-18 Thread Bryan Crossland
On Sun, Apr 17, 2011 at 5:01 PM, Matt Harrison  wrote:

>
> I can post full code examples if necessary.
>
>
That would be extremely helpful.

B.

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



Re: [Rails] Re: Rails 3 Crashing On Windows 7

2011-04-18 Thread Bryan Crossland
On Sun, Apr 17, 2011 at 4:14 PM, cipher_neo  wrote:

> sorry, they are all the gems on my system.
>
> I only use the following: (from Gemfile)
>
>  gem 'annotate-models', :require => 'annotate_models'
>  gem 'ruby-debug19'
>  gem 'populator'
>  gem 'faker'
>  gem "mongrel", '1.2.0.pre2'
>
>
>
What exactly is your application trying to do when it crashes?

B.





>
>
>
> On Apr 16, 4:20 pm, cipher_neo  wrote:
> > sure:
> >
> > C:\Windows\System32>gem list
> >
> > *** LOCAL GEMS ***
> >
> > abstract (1.0.0)
> > actionmailer (3.0.5)
> > actionpack (3.0.5)
> > activemodel (3.0.5)
> > activerecord (3.0.5)
> > activeresource (3.0.5)
> > activesupport (3.0.5, 2.3.11)
> > annotate-models (1.0.4)
> > archive-tar-minitar (0.5.2)
> > arel (2.0.9)
> > builder (2.1.2)
> > bundler (1.0.10)
> > cgi_multipart_eof_fix (2.5.0)
> > columnize (0.3.2)
> > configuration (1.2.0)
> > diff-lcs (1.1.2)
> > erubis (2.6.6)
> > extlib (0.9.15)
> > faker (0.9.5)
> > gem_plugin (0.2.3)
> > heroku (1.19.1)
> > highline (1.6.1)
> > i18n (0.5.0)
> > launchy (0.3.7)
> > linecache19 (0.5.11)
> > mail (2.2.15)
> > mime-types (1.16)
> > minitest (1.6.0)
> > mongrel (1.2.0.pre2 x86-mingw32)
> > mysql2 (0.2.6 x86-mingw32)
> > polyglot (0.3.1)
> > populator (1.0.0)
> > rack (1.2.2)
> > rack-mount (0.6.14)
> > rack-test (0.5.7)
> > rails (3.0.5)
> > railties (3.0.5)
> > rake (0.8.7)
> > rdiscount (1.6.8)
> > rdoc (2.5.8)
> > rest-client (1.6.1)
> > rhodes (2.3.2)
> > ruby-debug-base19 (0.11.24)
> > ruby-debug-ide19 (0.4.12)
> > ruby-debug19 (0.11.6)
> > ruby_core_source (0.1.4)
> > templater (1.0.0)
> > thor (0.14.6)
> > treetop (1.4.9)
> > tzinfo (0.3.25)
> >
> > thanks for the reply
> >
> > On Apr 16, 4:18 pm, Luis Lavena  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > On Apr 16, 11:58 am, cipher_neo  wrote:
> >
> > > > Hi guys,
> >
> > > > I have Rails 3 running on Windows 7 with Ruby 1.9.2
> >
> > > > Every now and again, my server crashes, and I see the following
> > > > information in the windows event log:
> >
> > > > Faulting application name: ruby.exe, version: 1.9.2.180, time stamp:
> > > > 0x4d5ee5ed
> > > > Faulting module name: msvcrt-ruby191.dll, version: 1.9.2.180, time
> > > > stamp: 0x4d5ee5ec
> > > > Exception code: 0xc005
> > > > Fault offset: 0x0011a00e
> > > > Faulting process id: 0x1624
> > > > Faulting application start time: 0x01cbfc46036ca1be
> > > > Faulting application path: C:\Ruby192\bin\ruby.exe
> > > > Faulting module path: C:\Ruby192\bin\msvcrt-ruby191.dll
> > > > Report Id: ae8872dc-6839-11e0-ae3f-904ce5fafcb7
> >
> > > > I have no clue what is causing this error, but it is a pain to try to
> > > > get work done when my app keeps crashing.
> >
> > > Can you provide a list of the gems involved in your application?
> >
> > > That way we would be able to assist you better.
> >
> > > --
> > > Luis Lavena
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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



[Rails] Rails3 integration with SourceForce

2011-04-18 Thread balakrishna.ka...@gmail.com
Hi,
   I looking forward to integrate Rail3 application with
SourceForce. Any help in this regard is appreciated.

Thanks,
Balakrishna

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



[Rails] Re: routes question rails 3.0 vs. rails 2.0

2011-04-18 Thread sol.manager
Google doesn't seem to want to post my reply properly. I wanted to say
thank you as your last suggestion worked. I removed the offending =
and my site is working with Solr properly now. Thank you.

On Apr 17, 6:05 pm, Phil Crissman  wrote:
> On Sun, Apr 17, 2011 at 4:17 PM, sol.manager  wrote:
> > The full error message goes something like this:
>
> > showing app/views/jobs/_search_form.html.erb where line #1 raised:
>
> > compile error
> > /Users/aesthetica/Apps/blank-r2311/app/views/jobs/
> > _search_form.html.erb:1: syntax error, unexpected ')'
> > ...obs_path, :method => :get do ).to_s); @output_buffer.concat ...
> >                              ^
> > /Users/aesthetica/Apps/blank-r2311/app/views/jobs/
> > _search_form.html.erb:6: syntax error, unexpected kENSURE, expecting
> > ')'
> > /Users/aesthetica/Apps/blank-r2311/app/views/jobs/
> > _search_form.html.erb:8: syntax error, unexpected kEND, expecting ')'
> > Extracted source (around line #1):
>
> > 1: <%= form_tag search_jobs_path, :method => :get do %>
>
> Problem is not the route, then. This line (above) should not have an '='
> sign at the beginning. Try
>
> <% form_tag search_jobs_path, :method => :get do %>
>
>
>
> > 2: 
> > 3:   <%= text_field_tag :query, params[:query] %> <%= submit_tag
> > "Search!" %>
> > 4: 
> > Trace of template inclusion: app/views/jobs/_search_form.html.erb, app/
> > views/jobs/index.html.erb
>
> > > What is the error?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-talk@googlegroups.com.
> > To unsubscribe from this group, send email to
> > rubyonrails-talk+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/rubyonrails-talk?hl=en.

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



Re: [Rails] file_column undefined method relative_url_root

2011-04-18 Thread Bryan Crossland
On Sun, Apr 17, 2011 at 12:32 PM, Tara Schultz wrote:

> I just installed and started using the file_column plugin and am
> getting the following error:
>
> No Method Error
> undefined method 'relative_url_root' for nil:NilClass
>
> Extracted source (around line #5)
> 5: <%= image_tag url_for_file_column("fan", "image_url") %>
>
> I'm running Rails 3.0.1.
>
> Does anyone know what I need to do to fix this?
>
> Thanks,
> Tara
>

It means that whatever object you are trying to use the method
relative_url_root on is nil so therefore no method exists. Check to make
sure in your code that the object you are passing in actually exists.

B.

>

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



[Rails] rails runner giving problem

2011-04-18 Thread Mike Disuza
Hi,
I have a rails 2.3.8 application, which has some ruby script in scripts
folder which has ran through the cron.

I just upgraded my application to rails 3. My problem is I am not able
found a solution to run these scripts.

In Rails 2.3.8:-
ruby script/runner test.rb

In Rails 3:-
rails runner test.rb does not working.

Can anyone tell me How can I run the scripts?


Thanks,
Mike

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

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



Re: [Rails] Assigning admin invalidates the user

2011-04-18 Thread Bryan Crossland
On Sun, Apr 17, 2011 at 12:14 PM, non useless  wrote:

> I am experiencing an issue as I am following the tutorial and
> currently at the end of chapter 10. When I use toggle in the rails
> console to flip the admin property of a user from false to true (I'm
> trying to create an Admin user), I am successful in doing so, however
> that user becomes invalid, when I try to log in to the application
> with this user's credential I am getting an error that the credentials
> are incorrect (even though they are) ... just from checking the logs
> and the looking at the terminal, it seems the authenticity token is
> either missing or incorrect... any ideas what I am doing wrong here? I
> tried following the tutorial as close as possible, I doubt I missed
> something, but its obviously possible..
>
> Thank you and best regards!
>
>
There are lots of tutorials out there. Please be more specific as to which
one you were following. For example, give us a link to it.

B.

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



Re: [Rails] ERROR NameError: uninitialized constant ActiveSupport::Dependencies

2011-04-18 Thread Bryan Crossland
On Sun, Apr 17, 2011 at 2:35 PM, doom spork  wrote:

> Hello all,
>
> I keep getting the following error after visiting 127.0.0.1:3000 on a
> fresh rails 3.0.6 install with ruby 1.9.2.  I have tried googling
> solutions but most results are addressing the issue in rails 2 and
> suggest adding 'require "threads"' to the boot.rb; this did not resolve
> my issues.
>
> Any suggestions on how to resolve this or where to start?
>
> [2011-04-17 15:17:18] ERROR NameError: uninitialized constant
> ActiveSupport::Dependencies
>  /Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3
> /gems/actionpack-3.0.3/lib/action_dispatch/middleware/stack.rb:9:in
> `initialize'
>  /Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3
> /gems/actionpack-3.0.3/lib/action_dispatch/middleware/stack.rb:67:in
> `new'
>  /Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3
> /gems/actionpack-3.0.3/lib/action_dispatch/middleware/stack.rb:67:in
> `use'
>  /Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3
> /gems/railties-3.0.3/lib/rails/application.rb:190:in
> `block in default_middleware_stack'
>  /Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3
> /gems/railties-3.0.3/lib/rails/application.rb:189:in
> `tap'
>  /Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3
> /gems/railties-3.0.3/lib/rails/application.rb:189:in
> `default_middleware_stack'
>  /Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3
> /gems/railties-3.0.3/lib/rails/application.rb:161:in
> `app'
>  /Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3
> /gems/railties-3.0.3/lib/rails/application.rb:168:in
> `call'
>  /Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3
> /gems/railties-3.0.3/lib/rails/application.rb:77:in
> `method_missing'
>  /Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3
> /gems/railties-3.0.3/lib/rails/rack/log_tailer.rb:14:in
> `call'
>  /Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3
> /gems/rack-1.2.2/lib/rack/content_length.rb:13:in
> `call'
>  /Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3
> /gems/rack-1.2.2/lib/rack/handler/webrick.rb:52:in
> `service'
>
>  
> /Users/doom/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/httpserver.rb:111:in
> `service'
>
>  
> /Users/doom/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/httpserver.rb:70:in
> `run'
>
>  
> /Users/doom/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/server.rb:183:in
> `block in start_thread'
>
>
Can you post a gem list for the RVM environment you are trying to run this
in?

B.

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



[Rails] Re: how to update data

2011-04-18 Thread Ar Chron
News Aanad wrote in post #993479:
> hi, I have json string in json request.
> i want to update the database using that string.
> how can i do that?
> There would be a multipal object in this string.
>
> sample string is:
>
> 
[{"product":{"amt":300,"created_at":"2011-03-28T05:46:52Z","id":1,"prodnm":"maruti","qty":1,"rate":12,"updated_at":"2011-03-28T05:46:52Z"}},{"product":{"amt":2000,"created_at":"2011-04-18T09:02:45Z","id":2,"prodnm":"lux","qty":2,"rate":12,"updated_at":"2011-04-18T09:02:45Z"}}]
>
> Can anybody help me???

Deserialize the string into the separate product objects (JSON.parse 
from http://flori.github.com/json/ perhaps?), then use the normal object 
methods to perists the data I think.

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

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



[Rails] Re: How to generate a form in rails 2.3.5

2011-04-18 Thread Ar Chron
amritpal p. wrote in post #993489:
>But i didnt explain in which
> file it should be written?
>
> Thanks

Well, perhaps you would benefit from seeing a scaffolded response. At an 
OS prompt, type in:

ruby script/generate scaffold person first_name:string last_name:string

run the resulting migration, then take some time to look at the 
controller, model, and views created for a person / people.

That might give you some insight to how Rails works by default.  Then 
you could answer your own question I think.

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

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



[Rails] paypal with Active merchant

2011-04-18 Thread News Aanad
Hi, I am integrating paypal service in my application using Activemerchant.

Now I want to know how to use ActiveMerchant to make payment to Bank or
Credit card ?

for example:
I am seller and I want to pay some amount to somebody. I want to pay such
amount which will be credited in somebody's bank account or credit card
directly ?

Please reply me as early as possible.
And also suggest me any configuration which i should make in test accounts,
if any.


Thank  you.

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



[Rails] paypal with Active merchant

2011-04-18 Thread News Aanad
Hi, I am integrating paypal service in my application using Activemerchant.

Now I want to know how to use ActiveMerchant to make payment to Bank or
Credit card ?

for example:
I am seller and I want to pay some amount to somebody. I want to pay such
amount which will be credited in somebody's bank account or credit card
directly ?

Please reply me as early as possible.
And also suggest me any configuration which i should make in test accounts,
if any.


Thank  you.

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



Re: [Rails] How to change the url (from localhostL:3000) to (example.com)

2011-04-18 Thread Peter De Berdt


On 18 Apr 2011, at 11:51, amrit pal pathak wrote:


I am new to ruby on rails and running rails 2.3.5.My application is
running at localhost:3000 ,but i want it should be run at
"example.com" in brower when i start the serve normally as  "script/
server" .
What to do?


1. Learn about DNS
2. Learn about DNS applied to the operating system you are running
3. Add the domain to the DNS
4. Learn how to host your rails app on a privileged port

In any case, your question is not even close to being within the Rails  
scope and thus doesn't belong on this list.


If you're on a Linux-based OS, you might want to look into http://pow.cx/

Also (since I don't want to be posting on just about every message  
you've posted in the last two hours), if I were you, I would start  
reading up on Rails itself and how to use it or you'll just run into a  
brick wall all the time and keep asking basic questions that are  
actually in the guides, API and just about every "Rails for dummies"- 
like book out there.



Best regards

Peter De Berdt

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



[Rails] Re: How to generate a form in rails 2.3.5

2011-04-18 Thread amrit pal pathak


On Apr 18, 6:05 am, Chris Kottom  wrote:
> Have you readhttp://guides.rubyonrails.org/v2.3.8/form_helpers.html?

  i read a bit .like it tell about to write a simple code   like
 
  

  
  Form contents

   But i didnt explain in which
file it should be written?

Thanks

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



[Rails] Re: Rails 3 Migration expecting test gems to be installed??

2011-04-18 Thread johnnybutler7
Yes i did bundle install --without test and that worked fine, when i
try the db migrate for staging
i get the error, i could install all the gems as you say rspec is
needed for other stuff possibly but
the actual error for the autotest gem is because its specific to mac,
the staging site is on linux.  From reading
the docs it seems to suggest that bundler will know what OS you are on
and install the appropriate gem. The whole point of
the grouping should be exactly for this reason, i shouldnt have to
install test/dev gems on the staging/production server.

Maybe its something silly im doing but but i can see what.

On Apr 18, 11:16 am, Frederick Cheung 
wrote:
> On Apr 15, 2:01 pm, johnnybutler7  wrote:
>
> > Hi,
>
> > I have gem file set up so only the specific gems are installed/needed
> > for each environment, so all the test gems like cucumber etc are
> > grou[ed in test.  When i try a rake db:migrate RAILS_ENV=staging on
> > the staging server however i get an error saying  gem is not
> > installed, please use bundle install.  I dont want the test gems
> > installed on this server however when i run the migration on staging
> > its expecting them to be installed.
>
> > Anyone hit this problem before and how did you sort it, i cant find
> > anything in the forums?
>
> did you run bundle install --without test --without development
>
> Some gems (like rspec) used to generate rake files that required rspec
> to be loaded, so when rails tried to load your rake tasks it would
> fail if those gems weren't there anymore. They don't anymore though,
> now that everyone has figured out the sensible ways of working with
> bundler - I'd try using a current versions of those gems and clearing
> out any unneeded rake task files.
>
> Fred
>
>
>
> > JB

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



[Rails] Re: query optimize

2011-04-18 Thread Frederick Cheung


On Apr 18, 9:49 am, jey bal  wrote:
> I have following query for find out the total no of counts.
>
> *** 
> 
>
>       SELECT count(*)
>       FROM contacts_lists
>       JOIN plain_contacts ON contacts_lists.contact_id =
> plain_contacts.contact_id
>       JOIN contacts ON contacts.id = plain_contacts.contact_id
>       WHERE plain_contacts.has_email AND NOT contacts.email_bad AND NOT
> contacts.email_unsub AND contacts_lists.list_id = 45897
>
> *** 
> 
>
>       It takes 150ms  to complete its task.
> Is there any another way to run the above query?
> Is there any way  to reduce the time? is it possible?  please tell
> me.
>

well the first step is to run explain against the query and see what
it says. Make sure you've added indexes when appropriate (at a minimum
this should include the columns being joined on. You should also index
columns used in the where clause that are sufficiently selective (I'd
guess that contacts_lists.list_id would be a good candidate). use
explain before and after to see the difference adding indexes makes to
the query plan

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

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



[Rails] Re: Could use some opinions on indexes

2011-04-18 Thread Frederick Cheung


On Apr 18, 10:32 am, Phoenix Rising  wrote:
> Hey guys,
>
> Finding a more experienced group of developers is a tough challenge,
> so I'm posting this here.  It's slightly Rails-related, but mostly a
> database issue.
>
> So I'm using AuthLogic for an app I'm building.  Should I be worried
> about putting indexes on fields like crypted_password, password_salt,
> persistence_token, single_access_token, perishable_token, etc.?
>

> My general understanding on indexes (I'm more of a hacker than a
> "developer", so bear that in mind) is that they're essentially a "map"
> of what data is where so the database can do its select queries
> faster.  As far as I know, AuthLogic isn't going to be doing any
> select queries based off the fields above (my thinking is, look up by
> uuid [e-mail for example], then compare stuff against that record),
> but I definitely could be wrong.
>
> Any thoughts here guys?  It's appreciated - thank you.
>
Well one way would be to inspect your log file - you'll see those
queries being executed. databases usually have some kind of query
logging facility for logging 'bad' queries, queries that required a
full table scan would usually fit that definition. Off the top of my
head single_access_token is used for loading users in some
circumstances (might be something like password resets or something
like that)

> PS - does anyone know a good/accurate way to predict the size of a
> field index as it reaches N number of rows?  For example, let's assume
> that even though my 'email' field is a varchar(255), that all 255
> characters are used; if I have 5 users this is laughable, but 500,000
> sure as hell isn't.  How can I accurately predict the disk space size
> of an index (basically trying to get an idea of how big a database I
> need to buy from Heroku) once the number of rows in that table hits

I would assume that index/data size would scale linearly with the
number of rows in the table, but check your db's documentation

Fred

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



  1   2   >