[Rails] Re: Subselection by URL

2010-12-20 Thread Jo Bu
Marnen Laibow-Koser wrote in post #969567:
> You want nested resources.  Read the routing docs.

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

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

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



[Rails] Re: rails 3 routes

2010-12-20 Thread daze
On Dec 20, 9:13 pm, Marnen Laibow-Koser  wrote:
> Well, you didn't quote the lines you were replying to, and you didn't
> state what you were wondering...so I'm left wondering how to read your
> mind. :D
>
> In future, please just ask what you need to ask.
>
> Best,
> --
> Marnen Laibow-Koserhttp://www.marnen.org
> mar...@marnen.org

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

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

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



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

2010-12-20 Thread Ahmy Yulrizka
AFAIK, form_for need the @user object to determine the url.
if its a new then it would generate /users and POST method
if its already exist it generate /users with PUT method

i think that you can specify the URL like daze said,
if you create new @user, it wil redirect to create method (if you have REST
route)
unless you specify the route otherwise


On Tue, Dec 21, 2010 at 7:41 AM, John Merlino  wrote:

> Hey all,
>
> I know that this:
>
> Called id for nil, which would mistakenly be 4 -- if you really wanted
> the id of nil, use object_id
>
> means that I have an instance variable that has not been initialized.
> However, I'm a little confused as to what to do in a signup form for
> form_for:
>
> <% content_for :login do %>
>   <% form_for @user, :url => { :action => "login" } do |f|  %>
><%= error_messages_for 'user' %>
><%= f.label(:user_login, "Username")%>
> <%= f.text_field(:login) %>
> <%= f.label(:user_password, "User Password")%>
><%= f.password_field(:password) %>
><%= f.submit("Sign Up") %>
>
><%= link_to 'Register', :action => 'signup' %> |
>  <%= link_to 'Forgot my password', :action => 'forgot_password' %>
>  <% end %>
>  <% end %>
>
> Because I didn't declare @user in login method:
>
>  def login
>if request.post?
>  if session[:user] = User.authenticate(params[:user][:login],
> params[:user][:password])
>flash[:message]  = "Login successful"
>redirect_to_root
>  else
>flash[:warning] = "Login unsuccessful"
>  end
>end
>
>  end
>
> There is no @user and so interpreter throws the exception. However, what
> can I do in order to allow someone the opportunity to signin when using
> a form? Do I create a temporary blank user: @user = User.new?
>
> Thanks for response.
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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



[Rails] Re: rails 3 routes

2010-12-20 Thread Marnen Laibow-Koser
daze wrote in post #969695:
> I'm wondering about something along these lines too...

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

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

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

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

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



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

2010-12-20 Thread Marnen Laibow-Koser
John Merlino wrote in post #969678:
> Hey all,
>
> I know that this:
>
> Called id for nil, which would mistakenly be 4 -- if you really wanted
> the id of nil, use object_id
>
> means that I have an instance variable that has not been initialized.

Well, it means that something tried to call nil.id .

> However, I'm a little confused as to what to do in a signup form for
> form_for:
>
[...]
> There is no @user and so interpreter throws the exception. However, what
> can I do in order to allow someone the opportunity to signin when using
> a form? Do I create a temporary blank user: @user = User.new?

That's one common way of doing it.  Almost every Rails tutorial does 
that at some point.

>
> Thanks for response.

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

Sent from my iPhone

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

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



[Rails] Bundler behind a proxy

2010-12-20 Thread rails.n...@gmail.com
Can anyone help with this question?

https://github.com/wycats/bundler/issues/issue/203/

thanks

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



Re: [Rails] Shoulda Question: how to test validates_inclusion_of...?

2010-12-20 Thread David Kahn
On Mon, Dec 20, 2010 at 9:55 PM, David Kahn wrote:

>
>
> On Mon, Dec 20, 2010 at 9:28 PM, daze  wrote:
>
>> I'm using thoughtbot's shoulda, and I have this in a model:
>>
>> validates_inclusion_of :year, :in => %w[ 09-10 10-11 ]
>>
>> where :year is of type string.  How do I test this in shoulda?  Is it
>> with
>> (1) should ensure_inclusion_of
>> or do I have to do
>> (2) should allow_value('09-10').for(:year) and the should_not
>> equivalents?
>>
>>
>> So?  (2) seems verbose... I mean, having to do a bunch of should's and
>> should_not's?
>>
>
> I would be curious if there was another way if I understand exactly what
> you are doing, but I think (2) is what you have to do... seems to me it is
> similar to validating the format of an attribute.
>
> Although, you might have to change your structure but seems that somehow
> you could use "should include_value_in_range"...
>
> (see
> http://rubydoc.info/github/thoughtbot/shoulda/master/Shoulda/ActiveRecord/Macros
> )
>

Oops, I was looking at deprecated stuff... anyhow you would probably have to
change your structure to something numeric or date-like to use
ensure_inclusion_of but maybe in the end that would be the right way to do
it.


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

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



Re: [Rails] Shoulda Question: how to test validates_inclusion_of...?

2010-12-20 Thread David Kahn
On Mon, Dec 20, 2010 at 9:28 PM, daze  wrote:

> I'm using thoughtbot's shoulda, and I have this in a model:
>
> validates_inclusion_of :year, :in => %w[ 09-10 10-11 ]
>
> where :year is of type string.  How do I test this in shoulda?  Is it
> with
> (1) should ensure_inclusion_of
> or do I have to do
> (2) should allow_value('09-10').for(:year) and the should_not
> equivalents?
>
>
> So?  (2) seems verbose... I mean, having to do a bunch of should's and
> should_not's?
>

I would be curious if there was another way if I understand exactly what you
are doing, but I think (2) is what you have to do... seems to me it is
similar to validating the format of an attribute.

Although, you might have to change your structure but seems that somehow you
could use "should include_value_in_range"...

(see
http://rubydoc.info/github/thoughtbot/shoulda/master/Shoulda/ActiveRecord/Macros
)


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

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



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

2010-12-20 Thread daze
You could do something like

<%= form_for :user, :url=>{ blablabla } do |f| %>
  (...)
<% end %>

:-)

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



[Rails] Shoulda Question: how to test validates_inclusion_of...?

2010-12-20 Thread daze
I'm using thoughtbot's shoulda, and I have this in a model:

validates_inclusion_of :year, :in => %w[ 09-10 10-11 ]

where :year is of type string.  How do I test this in shoulda?  Is it
with
(1) should ensure_inclusion_of
or do I have to do
(2) should allow_value('09-10').for(:year) and the should_not
equivalents?


So?  (2) seems verbose... I mean, having to do a bunch of should's and
should_not's?

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



[Rails] Re: rails 3 routes

2010-12-20 Thread daze
I'm wondering about something along these lines too...

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



[Rails] Re: Having trouble testing :( "superclass mismatch" and can't load "test_helper"

2010-12-20 Thread daze
I figured it out.

I simply forgot to put "Admin::" for the articles controller in the
admin namespace.  Making the controllers start with "class
Admin::ArticlesController" resolved the issue.
Of course I had to add "Admin:: to any other controllers in the admin
namespace that were missing it too.

:)

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



[Rails] Re: looking for best rails hosting

2010-12-20 Thread gezope
Some additional help source:

here you can easily compare them http://railshostinginfo.com/

I used this, gave me so many good views! http://www.railshosting.org/

About deployment their tutorials are quite useful. http://hostingrails.com

It really depends on your needs. For trying out Rails you don't need
any expensive or cloud.
good luck,
gezope

On dec. 17, 12:42, nicolas  wrote:
> hi developers
> i need a clarification about rails hosting.
> Someone preferred to get rails hosting at justhost.com.is there anyone
> got account with justhost.com please let me know the speed , downtime
> and other things.
>
> nirosh

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



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

2010-12-20 Thread John Merlino
Hey all,

I know that this:

Called id for nil, which would mistakenly be 4 -- if you really wanted
the id of nil, use object_id

means that I have an instance variable that has not been initialized.
However, I'm a little confused as to what to do in a signup form for
form_for:

<% content_for :login do %>
   <% form_for @user, :url => { :action => "login" } do |f|  %>
<%= error_messages_for 'user' %>
<%= f.label(:user_login, "Username")%>
 <%= f.text_field(:login) %>
 <%= f.label(:user_password, "User Password")%>
<%= f.password_field(:password) %>
<%= f.submit("Sign Up") %>

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

Because I didn't declare @user in login method:

  def login
if request.post?
  if session[:user] = User.authenticate(params[:user][:login],
params[:user][:password])
flash[:message]  = "Login successful"
redirect_to_root
  else
flash[:warning] = "Login unsuccessful"
  end
end

  end

There is no @user and so interpreter throws the exception. However, what
can I do in order to allow someone the opportunity to signin when using
a form? Do I create a temporary blank user: @user = User.new?

Thanks for response.

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

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



[Rails] Store Locator

2010-12-20 Thread Brian Scott
Hello,

Does anyone know a good article on building a store locator in Rails?

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

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



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

2010-12-20 Thread daze
On Dec 20, 11:01 am, "ppgeng...@prevailhs.com" 
wrote:

> As a note, in the case where you just want a number in a string I
> prefer this syntax:
>
> Factory.define :article do |t|
>   t.association       :section
>   t.sequence(:title)  {|n| "Article#{n}"}
> end
>
> That way you don't have a sequence who's only job is to replicate this
> functionality; save those sequences for something that is more complex
> that you want to reuse and count.
>
> \Peter

Wait what if you wanted to do this?

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

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

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



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

2010-12-20 Thread daze
On Dec 20, 11:01 am, "ppgeng...@prevailhs.com" 
wrote:

> As a note, in the case where you just want a number in a string I
> prefer this syntax:
>
> Factory.define :article do |t|
>   t.association       :section
>   t.sequence(:title)  {|n| "Article#{n}"}
> end
>
> That way you don't have a sequence who's only job is to replicate this
> functionality; save those sequences for something that is more complex
> that you want to reuse and count.
>
> \Peter

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



[Rails] Looking for contributors for project: acts_as_facebook_object

2010-12-20 Thread Matt Lightner
Hey All,

I'm taking on a rather ambitious project that is something of an
extraction from a recent project that ended up getting scrapped.  The
idea is to provide a simple macro to allow any ruby class' objects to
represent an object in the Facebook graph.  This is especially handy
when the class representing Facebook objects happens to be an ORM
class.  I also developed a very clever way to model the myriad
relationships between objects without creating an absolute ton of join
tables, so this library can basically be used to make a complete copy
of any data available to your application via the API.

I would like for this gem/plugin to be Facebook Graph client agnostic
as well as ORM agnostic--any client or ORM library for which a proper
adapter can be written is welcome to join the party.  I plan to
implement either fbgraph or fb_graph as a graph client, and AR as an
ORM for starters.

I just started the extraction so it's in the early stages, but you can
see kinda where it's going.  Everything is open for improvement and
rewriting at this point.  Perhaps it might even make more sense to
split it into two separate gems.

Anyway, the repo is here:  https://github.com/hypernight/acts_as_facebook_object

If you're seriously interested, let me know and i'd be happy to
consider adding you as a developer on the project.  Other than that,
general suggestions are very much appreciated!

Thanks,
Matt

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



[Rails] Rails 3.0.3 Generator NoMethodError On Existing Project

2010-12-20 Thread Preston Lee
I'm getting a nasty NoMethodError when running the scaffold generator on a 
Rails 3.0.3 project that was upgraded from a Rails 2 project. The following 
command works fine on a *new* Ralis 3.0.3 project:

rails g scaffold variant_location name:string description:string 
code:string


...but fails for an existing project with the error:

 invoke  active_record

  createdb/migrate/20101220190429_create_variant_locations.rb

   identicalapp/models/variant_location.rb

  invoketest_unit

   identical  test/unit/variant_location_test.rb

   identical  test/fixtures/variant_locations.yml

   route  resources :variant_locations

  invoke  scaffold_controller

(erb):5:in `template': undefined method `all' for ActiveModel:Module 
(NoMethodError)

from 
/Users/preston/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/erb.rb:753:in `eval'

from 
/Users/preston/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/erb.rb:753:in 
`result'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/actions/file_manipulation.rb:111:in
 
`block in template'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/actions/create_file.rb:54:in
 
`call'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/actions/create_file.rb:54:in
 
`render'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/actions/create_file.rb:47:in
 
`identical?'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/actions/create_file.rb:73:in
 
`on_conflict_behavior'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:111:in
 
`invoke_with_conflict_check'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/actions/create_file.rb:61:in
 
`invoke!'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/actions.rb:95:in
 
`action'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/actions/create_file.rb:26:in
 
`create_file'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/actions/file_manipulation.rb:110:in
 
`template'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb:14:in
 
`create_controller_files'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/task.rb:22:in 
`run'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:118:in
 
`invoke_task'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in
 
`block in invoke_all'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in
 
`each'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in
 
`map'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in
 
`invoke_all'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/group.rb:226:in
 
`dispatch'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:109:in
 
`invoke'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/group.rb:269:in
 
`block in _invoke_for_class_method'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/shell.rb:74:in 
`with_padding'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/group.rb:258:in
 
`_invoke_for_class_method'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/group.rb:150:in
 
`_invoke_from_option_scaffold_controller'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/task.rb:22:in 
`run'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:118:in
 
`invoke_task'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in
 
`block in invoke_all'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in
 
`each'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in
 
`map'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in
 
`invoke_all'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/group.rb:226:in
 
`dispatch'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/base.rb:389:in 
`start'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/generators.rb:163:in
 
`invoke'

from 
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands/generate.rb:10:in
 
`'

from 
/Users/preston/.rvm/gems/rub

[Rails] Re: path vs. url

2010-12-20 Thread Madhav V.
> Here is my advise: use _url all the time. Yeah it wastes a few bytes,
> but the day you'll add https support to your site it will save you tons
> of headaches.

How would it save headaches in case of https?.

Lets say you have apache in front of your rails server and only apache 
is configured for https. And http is disabled in apache.

Now with _url option, the web page gets generated as
http://host/resource/1"; ...

And apache passes it along as it as, unless one enables URL rewriting in 
apache to replace http with https.

Where as if it is just _path it gets generated as

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

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



Re: [Rails] Writing to a CSV with Faster::CSV

2010-12-20 Thread Rob Biedenharn


On Dec 20, 2010, at 4:30 PM, TomRossi7 wrote:


Is there a way to write a csv file using a hash instead of an array?
Something like this:

header_keys = :first_name, :last_name, :email
FasterCSV.open("path/to/file.csv", "w") do |csv|
   User.all.do |user|
  csv << user

csv << user.attributes.values_at(*header_keys)

   end
 end

Thanks...

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




Rob Biedenharn  
r...@agileconsultingllc.com http://AgileConsultingLLC.com/
r...@gaslightsoftware.com   http://GaslightSoftware.com/

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



[Rails] Writing to a CSV with Faster::CSV

2010-12-20 Thread TomRossi7
Is there a way to write a csv file using a hash instead of an array?
Something like this:

header_keys = :first_name, :last_name, :email
FasterCSV.open("path/to/file.csv", "w") do |csv|
User.all.do |user|
   csv << user
end
  end

Thanks...

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



[Rails] Re: Get back routes the old way

2010-12-20 Thread Paul Bergstrom
I added this:

match ':controller(/:action(/:id(.:format)))'

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



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

2010-12-20 Thread Rajinder Yadav
On Mon, Dec 20, 2010 at 9:07 AM, Marnen Laibow-Koser
 wrote:
> Maxime Calay wrote in post #969556:
>> Hello,
>>
>> I searched three hours how to start my RoR application automatically as
>> windows starts.
>
> That depends on what you are using for a Web server.
>
>> No information about this on internet.
>
> Sure there is, but you're looking in the wrong place.  You should be
> looking at your Web server software's docs; there's little or nothing
> Rails-specific here.
>
> [...]
>> If i run cmd.exe, then go to rails app directory and type "ruby
>> script/server" it doesn't work because "ruby" command is not recognized.

are you possibly using rails 3? if so you should use, "rails server"

i assume you want to run your rails app in development mode, for
production you should seek other solutions, look into apache + mod
passenger

>> I need to start automatically my ruby application at windows startup
>> (session) !
>
> Why do you need to do this in the first place, instead of using a real
> server?  (And why are you making your life harder by using Windows?)
>
>>
>> Thank you for your answers
>>
>> Max
>
> Best,
> --
> Marnen Laibow-Koser
> http://www.marnen.org
> mar...@marnen.org
>
> Sent from my iPhone
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>



-- 
Kind Regards,
Rajinder Yadav | DevMentor.org | Do Good! ~ Share Freely

GNU/Linux: 2.6.35-22-generic
Kubuntu x86_64 10.10 | KDE 4.5.1
Ruby 1.9.2p0 | Rails 3.0.1

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



Re: [Rails] Re: Re: rails code to sql

2010-12-20 Thread Chris Habgood
fyi, it goes in the select portion.

On Mon, Dec 20, 2010 at 11:26, Chris Habgood  wrote:

> I know enough sql I was not sure where to put it in the rails 3 finders.
>
>
> On Mon, Dec 20, 2010 at 11:23, Marnen Laibow-Koser 
> wrote:
>
>> Chris Habgood wrote in post #969587:
>> > OH, is there a way to do the REMOVE sql command using the finders so I
>> > would
>> > not have to loop over the whole set and replace items?
>>
>> Yes. You can write your WHERE clause to do that.
>>
>> Now, put aside Rails for the next few days, and study a good elementary
>> SQL reference.  If you're asking questions like these, you need to go
>> learn SQL as such.
>>
>> Best,
>> --
>> Marnen Laibow-Koser
>> http://www.marnen.org
>> mar...@marnen.org
>>
>> Sent from my iPhone
>>
>> --
>> Posted via http://www.ruby-forum.com/.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To post to this group, send email to rubyonrails-t...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> rubyonrails-talk+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>>
>

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



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

2010-12-20 Thread Norm Scherer

Maxime Calay wrote:

Hello,

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


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


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


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


Thank you for your answers

Max


--
You received this message because you are subscribed to the Google 
Groups "Ruby on Rails: Talk" group.

To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.
There are a number of ways to do this.  One way I have used is to set up 
a couple of .bat files that run from startup.

start_mysql.bat

   PATH C:\InstantRails\mysql\bin;%PATH%
   mysqld

start_app.bat

   CD C:\InstantRails\rails_apps\my_app
   PATH C:\InstantRails\ruby\bin;C:\InstantRails\mysql\bin;%PATH%
   ruby script\server -e production

To start your server from cmd.exe, just run 'use_ruby.cmd' found in the 
InstantRails directory and then cd app and 'ruby script/server'


You can also set up mysql and mongrel_rails  to run as services but that 
is fairly complex but doable.  I do it from an installer so I would have 
to extract the relevant stuff if you are interested.  Let me know if you 
want to see that.


Norm

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



[Rails] Re: Labels, I18n and accepts_nested_attributes_for

2010-12-20 Thread Garrett Lancaster
I am having the same problem with Rails 3.0.3. If you don't require
context-dependent labels, you can use
en.activerecord.attributes.activity.some_field_here (notice it is not
nested inside the person model).
However, I have not found any workaround if your label IS context
dependent, and I believe it should probably be filed on lighthouse.

Garrett

On Nov 28, 9:17 pm, Paul Schreiber  wrote:
> Note: I am using Rails 2.3.10.
>
> Normally, you can use Rails’ I18n system to generate label text.
>
> For example, suppose you have a Person class with a name attribute. And this 
> ERB:
> <%= form_for @person do |f| %>
> <%= f.label :name %>
> <%= f.text_field :name %>
> <% end %>
>
> And you’d construct your en.yml like so:
> en:
>   helpers:
>     label:
>       name: “your name”
>
> However, this doesn’t work very well with related objects and 
> accepts_nested_attributes_for. Suppose you have the same Person class as 
> before. And person has_many :activities (likewise, activity belongs_to 
> :person) and accepts_nested_attributes_for :activities.
>
> Now your ERB looks like this:
> <%= form_for @person do |f| %>
> <%= f.label :name %>
> <%= f.text_field :name %>
>         <% f.fields_for :activities do |a| %>
>                 <%= l.label :difficulty %>
>                 <%= l.text_field :difficulty %>
>         <% end %>
> <% end %>
>
> Various combinations indentation of person / activities / difficulty in my 
> en.yml file didn’t work. So I looked inside rails to see what’s going on.
>
> The relevant code is in 
> actionpack-2.3.10/lib/action_view/helpers/form_helper.rb. The method used is  
>     
>         def to_label_tag(text = nil, options = {})
> on line 758.
>
> And the code doing the work is:
>         content = if text.blank?
>           i18n_label = I18n.t("helpers.label.#{object_name}.#{method_name}", 
> :default => “”)
>           i18n_label if i18n_label.present?
>         else
>           text.to_s
>         end
>
> The problem is you end up with a set of labels like:
>         helpers.label.person[activities_attributes][0].difficulty
>         helpers.label.person[activities_attributes][1].difficulty
>         helpers.label.person[activities_attributes][2].difficulty
>
> Is there a way you can put wildcards in YAML? If not, is there some other way 
> around this limitation? If not, this seems like a bug in Rails, and I’ll file 
> a lighthouse ticket.
>
> Paul
>
>  smime.p7s
> 4KViewDownload

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



Re: [Rails] Re: Re: rails code to sql

2010-12-20 Thread Chris Habgood
I know enough sql I was not sure where to put it in the rails 3 finders.

On Mon, Dec 20, 2010 at 11:23, Marnen Laibow-Koser wrote:

> Chris Habgood wrote in post #969587:
> > OH, is there a way to do the REMOVE sql command using the finders so I
> > would
> > not have to loop over the whole set and replace items?
>
> Yes. You can write your WHERE clause to do that.
>
> Now, put aside Rails for the next few days, and study a good elementary
> SQL reference.  If you're asking questions like these, you need to go
> learn SQL as such.
>
> Best,
> --
> Marnen Laibow-Koser
> http://www.marnen.org
> mar...@marnen.org
>
> Sent from my iPhone
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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



[Rails] Re: Re: rails code to sql

2010-12-20 Thread Marnen Laibow-Koser
Chris Habgood wrote in post #969587:
> OH, is there a way to do the REMOVE sql command using the finders so I
> would
> not have to loop over the whole set and replace items?

Yes. You can write your WHERE clause to do that.

Now, put aside Rails for the next few days, and study a good elementary 
SQL reference.  If you're asking questions like these, you need to go 
learn SQL as such.

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

Sent from my iPhone

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

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



[Rails] Re: unpacking ruby-odbc

2010-12-20 Thread Marnen Laibow-Koser
pepe wrote in post #969581:
>> What 'native extensions' means is that parts of the gem are not
>> written in Ruby but are (generally I think) in C. These need to be
>> compiled to generate code suitable for the OS the app is being run on.
>
> Yes, I learned that by working with ruby-odbc.
>
>> The gem cannot therefore be frozen as it would be frozen with code
>> compiled for the wrong OS. I think therefore you must install such
>> gems on the target machine in the normal way.
>
> Thanks Colin. I was afraid that would be the case.

Bundler might help here.

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

Sent from my iPhone

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

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



Re: [Rails] Re: rails code to sql

2010-12-20 Thread Chris Habgood
OH, is there a way to do the REMOVE sql command using the finders so I would
not have to loop over the whole set and replace items?

On Sun, Dec 19, 2010 at 21:16, Chris Habgood  wrote:

> Oh ok, that is cool, thanks.
>
>
> On Sun, Dec 19, 2010 at 21:09, Luke Cowell  wrote:
>
>> Hi Chris, you could try something like this:
>> categories = Category.select("*, LOWER(name) as lower_name")
>>
>> The calculated column 'lower_name' would now be available as a accessor on
>> each result. eg. categories.first.lower_name
>>
>> Luke
>>
>> On 2010-12-19, at 6:42 PM, Chris Habgood wrote:
>>
>> It is, how do I implement it with the Rails 3 finders?
>>
>> On Sun, Dec 19, 2010 at 20:35, Marnen Laibow-Koser 
>> wrote:
>>
>>> Luke Cowell wrote in post #969470:
>>> > This filters out rows where name is null and orders by name in SQL:
>>> > Category.where("name NOT NULL").order("name ASC")
>>> >
>>> > I'm not sure how to get mysql to downcase the column, but I'm pretty
>>> > sure there's a way.
>>>
>>> I believe the standard SQL function for that is lower().  Check the
>>> docs.
>>> >
>>> > Luke
>>>
>>> Best,
>>> --
>>> Marnen Laibow-Koser
>>> http://www.marnen.org
>>> mar...@marnen.org
>>>
>>> Sent from my iPhone
>>>
>>> --
>>> Posted via http://www.ruby-forum.com/.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Ruby on Rails: Talk" group.
>>> To post to this group, send email to rubyonrails-t...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> rubyonrails-talk+unsubscr...@googlegroups.com
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>>
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To post to this group, send email to rubyonrails-t...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> rubyonrails-talk+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To post to this group, send email to rubyonrails-t...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> rubyonrails-talk+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>
>

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



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

2010-12-20 Thread ppgeng...@prevailhs.com
On Dec 19, 11:03 am, daze  wrote:
> Figured it out. Here's the summary:
>
> If you have a sequence called :xyz and you are calling it in a
> factory, YOU NEED TO HAVE BRACKETS around the Factory.next(:xyz)
> call.  In my case:
>
> # Factories
> Factory.define :article do |t|
>         t.association :section # 'belongs to a section'
>         t.title {|x| "Article#{Factory.next(:count)}" }
>         (...)
> end

As a note, in the case where you just want a number in a string I
prefer this syntax:

Factory.define :article do |t|
  t.association   :section
  t.sequence(:title)  {|n| "Article#{n}"}
end

That way you don't have a sequence who's only job is to replicate this
functionality; save those sequences for something that is more complex
that you want to reuse and count.

\Peter

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



Re: [Rails] Re: Re: Get back routes the old way

2010-12-20 Thread Michael Pavling
On 20 December 2010 15:23, Paul Bergstrom  wrote:
> Michael Pavling wrote in post #969380:
> e called "me" than "user/2".
>>
>>   # routes.rb
>>   map.me 'me', :controller => 'users', :action => 'display_current_user'
>
> Should't that be match?

I wrote it off the top of my head, so you could be right. But it also
depends what version of Rails the OP has to what routing commands he
can use... but the general gist is that he should be able to achieve
what he wants with routes...

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



[Rails] Re: unpacking ruby-odbc

2010-12-20 Thread pepe
> What 'native extensions' means is that parts of the gem are not
> written in Ruby but are (generally I think) in C. These need to be
> compiled to generate code suitable for the OS the app is being run on.

Yes, I learned that by working with ruby-odbc.

>  The gem cannot therefore be frozen as it would be frozen with code
> compiled for the wrong OS.  I think therefore you must install such
> gems on the target machine in the normal way.

Thanks Colin. I was afraid that would be the case.

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



[Rails] Re: Re: Get back routes the old way

2010-12-20 Thread Paul Bergstrom
Michael Pavling wrote in post #969380:
e called "me" than "user/2".
>
>   # routes.rb
>   map.me 'me', :controller => 'users', :action => 'display_current_user'

Should't that be match?

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

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



Re: [Rails] Re: unpacking ruby-odbc

2010-12-20 Thread Colin Law
On 20 December 2010 15:11, pepe  wrote:
>> > I need to install my application to a Windows server
>>
>> My goodness, why?  That's just asking for trouble.
>
> We've had this conversation more than once.
>
>> Right.  Gems with native extensions generally can't be frozen usefully.
>
> Well, that does not help me much. If it can be done I'd like to try
> it. If it can't be done then I'd move on and go with the install
> approach I currently have.

What 'native extensions' means is that parts of the gem are not
written in Ruby but are (generally I think) in C.  These need to be
compiled to generate code suitable for the OS the app is being run on.
 The gem cannot therefore be frozen as it would be frozen with code
compiled for the wrong OS.  I think therefore you must install such
gems on the target machine in the normal way.

Colin

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



[Rails] Re: unpacking ruby-odbc

2010-12-20 Thread pepe
> > I need to install my application to a Windows server
>
> My goodness, why?  That's just asking for trouble.

We've had this conversation more than once.

> Right.  Gems with native extensions generally can't be frozen usefully.

Well, that does not help me much. If it can be done I'd like to try
it. If it can't be done then I'd move on and go with the install
approach I currently have.

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



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

2010-12-20 Thread Jiten Bhagat

On 20/12/2010 14:34, Michael Pavling wrote:

On 20 December 2010 14:22, Jiten Bhagat  wrote:

The best thing is to add the "bin" folder of your InstantRails (which
contains ruby, rake, etc.) to your PATH.

I disagree. The "best" thing to do is to not use a development
platform to try to host production sites - Don't use InstantRails for
live.


Totally agree with that.

It wasn't clear to me whether the OP wanted to host something in 
production or just have a Rails app available on startup on their local 
machine (e.g.: a local instance of Redmine). So my suggestion was merely 
in the context of the OP's question, and was also one step (of many) on 
the path to getting familiar with using Ruby.


As others have suggested, I too would highly recommend not using Windows 
for any Ruby development work. Having moved to Fedora then Ubuntu after 
2 years of Ruby dev on Windows I can safely say I have regained some of 
my sanity back :)



If you *have* to use Windows, then look at the Bitnami Rubystack...
it's moved on a bit since InstantRails stopped being developed.


Good suggestion; +1

Jits


Regards,
Michael



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



[Rails] Re: Create SOAP Webservice with Rails 3

2010-12-20 Thread Robert Walker
Marnen Laibow-Koser wrote in post #969564:
> Agreed that SOAP is less convenient that REST, but why do you think
> Rails can't provide it well?

I'm just saying that if SOAP is the only thing the app is doing, why not 
use a framework that has SOAP support built-in.

>> I'd say, do yourself a favor and either use Rails as it is intended,
>> which is to provide web services through REST. Or find a framework you
>> won't have to fight against every step of the way.
>
> What would have to be fought against?  This doesn't appear to make
> sense.

I'll reiterate that this is my opinion. This will remain my opinion 
until someone can point to a plugin/gem that proves that SOAP is easy 
and robust with Rails. I'll concede my opinion if someone can do that.

There are other frameworks that have more robust SOAP support built-in. 
Obviously, since Rails provides no built-in support for it. So if that's 
the only deciding factor in choosing a framework, why choose one that is 
inherently opposed to your apps needs?

I'm not at all saying that it is impossible to provide SOAP services 
with Rails.

Besides my experience with SOAP has never been a pleasant one. My 
opinion is already stacked heavily against it.

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

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



[Rails] Oracle + Full-text search in Rails

2010-12-20 Thread Gustavo de Sá Carvalho Honorato
Hi,

what do you recommend to do full-text search in Oracle with Rails?
There are some plugins like acts_as_sorl, but all plugins that I've
found seems to be discontinued.

Thanks,
Gustavo

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



[Rails] Re: Subselection by URL

2010-12-20 Thread Marnen Laibow-Koser
Jo Bu wrote in post #969496:
> Hey guys,
> I'm quite new in RoR, so please excuse me when I may ask weird
> questions.
>
> I am working on a database frontend. The layout looks mostly like
> a has_many bs
> b has_many cs
> c has_many ds
> and so on. Now I want to do some selection. Maybe I want to see all ds
> belonging to a specific b. I would like to do it like:
> http://my.host/bs/1/ds

You want nested resources.  Read the routing docs.

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

Sent from my iPhone

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

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



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

2010-12-20 Thread Michael Pavling
On 20 December 2010 13:16, Maxime Calay  wrote:
> I searched three hours how to start my RoR application automatically as
> windows starts. No information about this on internet. Maybe it's too easy.
> Not for me !

Where were you searching?


Google for "ruby rails windows service" and you get lots of results :-/

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



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

2010-12-20 Thread Michael Pavling
On 20 December 2010 14:22, Jiten Bhagat  wrote:
> The best thing is to add the "bin" folder of your InstantRails (which
> contains ruby, rake, etc.) to your PATH.

I disagree. The "best" thing to do is to not use a development
platform to try to host production sites - Don't use InstantRails for
live.

If you *have* to use Windows, then look at the Bitnami Rubystack...
it's moved on a bit since InstantRails stopped being developed.

Regards,
Michael

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



[Rails] Re: Create SOAP Webservice with Rails 3

2010-12-20 Thread Marnen Laibow-Koser
Robert Walker wrote in post #969562:
> Skellington wrote in post #969532:
>> Hello,
>> I'm just getting started with Rails, and for my first project I want
>> to create a Rails app that is nothing more that a SOAP web service.
>> From what I have been able to figure out it looks like with Rails 2
>> there was a web services framework of some sort. I have been
>> struggling to find anything on Rails 3. Oh yea, yes it has to be
>> SOAP  :-) , we have SOAP clients and apps already and we have no plans
>> to move to anything else, for now.
>>
>> Is there a good article or something on getting started with this?
>
> This is just my own opinion, but if all you want from Rails is to
> provide a SOAP web service then choose something other that Rails. I'm
> very much a fan of Rails, but I think you'll have an uphill battle.
> Rails is very opinionated against SOAP, as am I.

Agreed that SOAP is less convenient that REST, but why do you think 
Rails can't provide it well?

>
> I'd say, do yourself a favor and either use Rails as it is intended,
> which is to provide web services through REST. Or find a framework you
> won't have to fight against every step of the way.

What would have to be fought against?  This doesn't appear to make 
sense.

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

Sent from my iPhone

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

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



[Rails] Re: rails 3 helpers

2010-12-20 Thread Marnen Laibow-Koser
Chris Habgood wrote in post #969486:
> This code outputs html to the page not the icons, ideas?

Rails 3 escapes HTML by default, remember?

[...]
>   html << link_to( "image_tag('icons/rss_#{rss[0]}.png')", rss[1],
> :disabled => "#{rss[2]}")

You dont need #{} if there's nothing else in the string -- just use 
:disabled => rss[2] .

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

Sent from my iPhone

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

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



[Rails] Re: Create SOAP Webservice with Rails 3

2010-12-20 Thread Robert Walker
Skellington wrote in post #969532:
> Hello,
> I'm just getting started with Rails, and for my first project I want
> to create a Rails app that is nothing more that a SOAP web service.
> From what I have been able to figure out it looks like with Rails 2
> there was a web services framework of some sort. I have been
> struggling to find anything on Rails 3. Oh yea, yes it has to be
> SOAP  :-) , we have SOAP clients and apps already and we have no plans
> to move to anything else, for now.
>
> Is there a good article or something on getting started with this?

This is just my own opinion, but if all you want from Rails is to 
provide a SOAP web service then choose something other that Rails. I'm 
very much a fan of Rails, but I think you'll have an uphill battle. 
Rails is very opinionated against SOAP, as am I.

I'd say, do yourself a favor and either use Rails as it is intended, 
which is to provide web services through REST. Or find a framework you 
won't have to fight against every step of the way.

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

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



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

2010-12-20 Thread Colin Law
On 20 December 2010 13:16, Maxime Calay  wrote:
> Hello,
>
> I searched three hours how to start my RoR application automatically as
> windows starts. No information about this on internet. Maybe it's too easy.
> Not for me !
>
> I have installed InstantRails2.0 and i know there is a menu to start command
> prompt with ruby, but how to access this command prompt in command line from
> cmd.exe ???
>
> If i run cmd.exe, then go to rails app directory and type "ruby
> script/server" it doesn't work because "ruby" command is not recognized.

The question is not really how to start your rails app, but how to
start an InstantRails app from outside the IR environment.  I did
achieve this many moons ago before I saw the light and moved to Ubuntu
(I seriously suggest you look at this possibility, you are unlikely to
regret it.  There are several ways of runnning both Windows and Ubuntu
on the same machine).  I forget how I did it, but I think I looked in
the IR folders and found some batch files which when I looked inside
them saw how the IR environment is setup.  I think it then became
clear what to do.  Alternatively, if no-one here knows how to do it
then further googling, with InstantRails as one of the keywords may be
the only possibility.

I do know that IR has not been updated for some time and is probably
not the best way (even on windows) of running RoR.  VirtualRails has
been recommended if you absolutely have to stick with Windows.

As I type this I see that it has been suggested that adding the ruby
folder to the path may be sufficient, I suspect that is not all there
is to it.

Colin

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



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

2010-12-20 Thread Jiten Bhagat

Hello Max,

In order to get the "ruby" command recognised, you need to add the 
location of the ruby executable to your PATH.


The best thing is to add the "bin" folder of your InstantRails (which 
contains ruby, rake, etc.) to your PATH.


Best thing is to search Google on how to add things to PATH.

Cheers,
Jits



On 20/12/2010 13:16, Maxime Calay wrote:

Hello,

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


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


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


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


Thank you for your answers

Max


--
You received this message because you are subscribed to the Google 
Groups "Ruby on Rails: Talk" group.

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


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



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

2010-12-20 Thread Marnen Laibow-Koser
Maxime Calay wrote in post #969556:
> Hello,
>
> I searched three hours how to start my RoR application automatically as
> windows starts.

That depends on what you are using for a Web server.

> No information about this on internet.

Sure there is, but you're looking in the wrong place.  You should be 
looking at your Web server software's docs; there's little or nothing 
Rails-specific here.

[...]
> If i run cmd.exe, then go to rails app directory and type "ruby
> script/server" it doesn't work because "ruby" command is not recognized.
>
> I need to start automatically my ruby application at windows startup
> (session) !

Why do you need to do this in the first place, instead of using a real 
server?  (And why are you making your life harder by using Windows?)

>
> Thank you for your answers
>
> Max

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

Sent from my iPhone

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

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



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

2010-12-20 Thread Maxime Calay
Hello,

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

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

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

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

Thank you for your answers

Max

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



[Rails] The Rails3 way for in-place editing

2010-12-20 Thread bourne
Currently I want to implement in-place editing directly on the index-page 
(for the sake of learning just xx products with a name to be edited). 
These are my favorite links from yesterday's research (for the archives):

*On the spot is a Rails3 compliant unobtrusive javascript in-place-editing 
plugin: http://rubygems.org/gems/on_the_spot
(http://rubydoc.info/gems/on_the_spot/0.0.6/frames, 
http://www.dixis.com/?p=408)
https://code.google.com/p/jquery-in-place-editor/   
(http://www.appelsiini.net/projects/jeditable)

Rails 3 Remote Links and Forms: A Definitive Guide: 
http://www.alfajango.com/blog/rails-3-remote-links-and-forms/
http://asciicasts.com/episodes/43-ajax-with-rjs   (and the same with JQuery: 
http://asciicasts.com/episodes/136-jquery)
http://asciicasts.com/episodes/205-unobtrusive-javascript
Edit-in-place with Rails 3 and Prototype: http://www.betaful.com/?p=502
Creating a 100% ajax CRUD using rails 3 and unobtrusive javascript: 
http://www.stjhimy.com/posts/7
*
*Debugging AJAX: http://asciicasts.com/episodes/44-debugging-rjs
*

Still, I want to ask, what you consider the best way to implement in my 
application with respect to easy implementation, robustness, cross-browser 
capabilities (modern browsers only) and with a promising future.

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



[Rails] Server won't start on using authlogic-oauth2

2010-12-20 Thread Arkid Mitra
I have included oauth2 and authlogic-oauth2 in the gemfile as I want to
use them and am trying to start the server. It doesn't start and gives
me the error

/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails.rb:44:in
`configuration': undefined method `config' for nil:NilClass
(NoMethodError)
from
/Library/Ruby/Gems/1.8/gems/authlogic_oauth2-1.1.2/lib/authlogic_oauth2.rb:14
from
/Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in
`require'
from
/Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in
`require'
from
/Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:in
`each'
from
/Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:in
`require'
from
/Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:in
`each'
from
/Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:in
`require'
from
/Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler.rb:112:in
`require'
from
/Users/arkidmitra/Documents/qorm_bzar/buyzaar/config/application.rb:7
from
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:28:in
`require'
from
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:28
from
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:27:in
`tap'
from
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:27
from script/rails:6:in `require'
from script/rails:6

I am using Rails 3.0.3 and Ruby 1.8.7. Also the sever seems to be
starting fine till I add

gem "authlogic-oauth2"
to the Gemfile.

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

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



Re: [Rails] Create SOAP Webservice with Rails 3

2010-12-20 Thread Ahmy Yulrizka
Rails favor REST architecture then SOAP, if you must do soap, checkout this
threads

http://stackoverflow.com/questions/2146669/rails-using-another-apps-soap-interface
http://stackoverflow.com/questions/40273/whats-the-best-way-to-use-soap-with-ruby

On Mon, Dec 20, 2010 at 7:45 AM, Skellington  wrote:

> Hello,
> I'm just getting started with Rails, and for my first project I want
> to create a Rails app that is nothing more that a SOAP web service.
> From what I have been able to figure out it looks like with Rails 2
> there was a web services framework of some sort. I have been
> struggling to find anything on Rails 3. Oh yea, yes it has to be
> SOAP  :-) , we have SOAP clients and apps already and we have no plans
> to move to anything else, for now.
>
> Is there a good article or something on getting started with this?
>
> Thanks,
> Charlie
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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



Re: [Rails] Routes: How would default routes be defined manually?

2010-12-20 Thread Ahmy Yulrizka
This is interesting,

it doesn't work because if you call
member,

the resource mapper call member_scope, which in turn yield

# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 503
def member_scope
  "#{path}/:id"end


but the new is very special method, it call new_scope which in turn yield

# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 507
def new_scope(new_path)
  "#{path}/#{new_path}"end

http://rubydoc.info/docs/rails/3.0.0/ActionDispatch/Routing/Mapper/Resources#shallow-instance_method

Ahmy Yulrizka


On Mon, Dec 20, 2010 at 4:44 PM, Mahmoud Said wrote:

> it won't work, it will be
>
> add_new_priority GET/priorities/new/add(.:format){:action=>"add",
> :controller=>"priorities"}
>
>
> however, the collection plural  form seems more logical to me, you are
> adding a priority to priorities. so you are actually acting on priorities
>
>
>

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



[Rails] Create SOAP Webservice with Rails 3

2010-12-20 Thread Skellington
Hello,
I'm just getting started with Rails, and for my first project I want
to create a Rails app that is nothing more that a SOAP web service.
>From what I have been able to figure out it looks like with Rails 2
there was a web services framework of some sort. I have been
struggling to find anything on Rails 3. Oh yea, yes it has to be
SOAP  :-) , we have SOAP clients and apps already and we have no plans
to move to anything else, for now.

Is there a good article or something on getting started with this?

Thanks,
Charlie

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



Re: [Rails] Routes: How would default routes be defined manually?

2010-12-20 Thread Mahmoud Said
it won't work, it will be

add_new_priority GET/priorities/new/add(.:format){:action=>"add",
:controller=>"priorities"}


however, the collection plural  form seems more logical to me, you are
adding a priority to priorities. so you are actually acting on priorities

On Mon, Dec 20, 2010 at 11:35 AM, Mahmoud Said
wrote:

> that's interesting, apparently there is  3rd type other than collection and
> member that is specific to the new.
>
>
> if u checked at actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:953
>
> you can how the default routes are added:
>
> collection do
>   get  :index if parent_resource.actions.include?(:index)
>   post :create if parent_resource.actions.include?(:create)
> end
>
> new do
>   get :new
> end if parent_resource.actions.include?(:new)
>
> member do
>   get:edit if parent_resource.actions.include?(:edit)
>   get:show if parent_resource.actions.include?(:show)
>   put:update if parent_resource.actions.include?(:update)
>   delete :destroy if parent_resource.actions.include?(:destroy)
> end
>
> I'm not sure if you can use the "new" on your own. try it and let me know
> how it goes :)
>
>
> On Mon, Dec 20, 2010 at 11:02 AM, bourne  wrote:
>
>>
>>
>> On Monday, December 20, 2010 9:44:36 AM UTC+1, modsaid wrote
>>
>>> I think what confuses you is: "why is it   add_priorities_path  and not
>>> add_priority_path like the new_priority_path" (in a singular form)?
>>>
>>> is that right ?
>>>
>>
>> Correct :)
>> (I know that this behaviour is fine for collections but I want to
>> understand why new is different and how to declare it to be identical)
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To post to this group, send email to rubyonrails-t...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> rubyonrails-talk+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>
>
>
> --
> Mahmoud Said
> Software Engineer - eSpace
> blog.modsaid.com
>
>
>
>


-- 
Mahmoud Said
Software Engineer - eSpace
blog.modsaid.com

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



Re: [Rails] Routes: How would default routes be defined manually?

2010-12-20 Thread Mahmoud Said
that's interesting, apparently there is  3rd type other than collection and
member that is specific to the new.


if u checked at actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:953

you can how the default routes are added:

collection do
  get  :index if parent_resource.actions.include?(:index)
  post :create if parent_resource.actions.include?(:create)
end

new do
  get :new
end if parent_resource.actions.include?(:new)

member do
  get:edit if parent_resource.actions.include?(:edit)
  get:show if parent_resource.actions.include?(:show)
  put:update if parent_resource.actions.include?(:update)
  delete :destroy if parent_resource.actions.include?(:destroy)
end

I'm not sure if you can use the "new" on your own. try it and let me know
how it goes :)


On Mon, Dec 20, 2010 at 11:02 AM, bourne  wrote:

>
>
> On Monday, December 20, 2010 9:44:36 AM UTC+1, modsaid wrote
>
>> I think what confuses you is: "why is it   add_priorities_path  and not
>> add_priority_path like the new_priority_path" (in a singular form)?
>>
>> is that right ?
>>
>
> Correct :)
> (I know that this behaviour is fine for collections but I want to
> understand why new is different and how to declare it to be identical)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>



-- 
Mahmoud Said
Software Engineer - eSpace
blog.modsaid.com

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



Re: [Rails] Routes: How would default routes be defined manually?

2010-12-20 Thread bourne


On Monday, December 20, 2010 9:44:36 AM UTC+1, modsaid wrote
>
> I think what confuses you is: "why is it   add_priorities_path  and not 
> add_priority_path like the new_priority_path" (in a singular form)?
>
> is that right ? 
>

Correct :)
(I know that this behaviour is fine for collections but I want to understand 
why new is different and how to declare it to be identical) 

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



Re: [Rails] Routes: How would default routes be defined manually?

2010-12-20 Thread Mahmoud Said
Given that you already know what we mentioned. and the correct usage is

resources :priorities do
   collection do
   get 'add'
   end
end

I think what confuses you is: "why is it   add_priorities_path  and not
add_priority_path like the new_priority_path" (in a singular form)?

is that right ?





On Mon, Dec 20, 2010 at 10:40 AM, Mahmoud Said
wrote:

> Bourne,
>
> In your example, *add* is like *new. *It should not be a member action, it
> is a collection one.
>
> I think what you are asking for is a bit more elaboration of the default
> REST routes.
>
> When you do:
>
> resources  :priorities
>
> This will generate the 7 default routes. which are two types:
>
>1. Member (you are operating on a specific instance of the priorities).
>and those are:  Show, Edit, Update, Destroy
>2. Collection, Where you operate on prorities in general, but not an
>existing one of them. which is   :index, :new,  :create
>
>
> for member based actions,  the paths generated in a singular form and
> expects the ID to be passed. so
>
> add_priority_path   # wrong,  you have not provided an id or an instance of
> Priority
> add_priority_path(object)  # should work,   but this is not what u want.
>
> new_priority_path  is actually a collection.  the route will be
> /priorities/new
>
>
>
>
>
>
> On Mon, Dec 20, 2010 at 9:50 AM, bourne  wrote:
>
>> Thank you! Your post is really helpful.
>>
>> As mentioned above, I just want to understand how I would declare the 7
>> REST routes if they would not have been declared for me, e.g. new1 (add in
>> my example), edit1, ...
>> If I declare add as a collection route, this statement throws an error
>> <%= link_to 'Add Priority', add_*priority*_path %> (taken from
>> originally created code :  <%= link_to 'New Priority', new_priority_path %>)
>>
>> <%= link_to 'Add Priority', add_*priorities*_path %> works as expected.
>>
>> My original question was: what is my definition missing compared to the
>> original new?
>>
>>
>> Second, I find this very interesting: get 'add' => 'priorities#create',
>> :as => my_custom_add
>> In this form I get an error, the same with :my_custom_add.
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To post to this group, send email to rubyonrails-t...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> rubyonrails-talk+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>
>
>
> --
> Mahmoud Said
> Software Engineer - eSpace
> blog.modsaid.com
>
>
>
>


-- 
Mahmoud Said
Software Engineer - eSpace
blog.modsaid.com

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



Re: [Rails] Routes: How would default routes be defined manually?

2010-12-20 Thread Mahmoud Said
Bourne,

In your example, *add* is like *new. *It should not be a member action, it
is a collection one.

I think what you are asking for is a bit more elaboration of the default
REST routes.

When you do:

resources  :priorities

This will generate the 7 default routes. which are two types:

   1. Member (you are operating on a specific instance of the priorities).
   and those are:  Show, Edit, Update, Destroy
   2. Collection, Where you operate on prorities in general, but not an
   existing one of them. which is   :index, :new,  :create


for member based actions,  the paths generated in a singular form and
expects the ID to be passed. so

add_priority_path   # wrong,  you have not provided an id or an instance of
Priority
add_priority_path(object)  # should work,   but this is not what u want.

new_priority_path  is actually a collection.  the route will be
/priorities/new






On Mon, Dec 20, 2010 at 9:50 AM, bourne  wrote:

> Thank you! Your post is really helpful.
>
> As mentioned above, I just want to understand how I would declare the 7
> REST routes if they would not have been declared for me, e.g. new1 (add in
> my example), edit1, ...
> If I declare add as a collection route, this statement throws an error
> <%= link_to 'Add Priority', add_*priority*_path %> (taken from
> originally created code :  <%= link_to 'New Priority', new_priority_path %>)
>
> <%= link_to 'Add Priority', add_*priorities*_path %> works as expected.
>
> My original question was: what is my definition missing compared to the
> original new?
>
>
> Second, I find this very interesting: get 'add' => 'priorities#create', :as
> => my_custom_add
> In this form I get an error, the same with :my_custom_add.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>



-- 
Mahmoud Said
Software Engineer - eSpace
blog.modsaid.com

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



Re: [Rails] Routes: How would default routes be defined manually?

2010-12-20 Thread Ahmy Yulrizka
when you specify route inside resource, AFAIK
if you specify the route inside "collection", rails will always append ies
like priorities
if you specify the route inside "member", rails will always use the singular
word liake priority

so in that way, one solution (but i dont know if this the best way to do
it). is define custom route outside the resource block. such as.

  resources :priorities do
  end

  get '/priorities/add' => 'priorities#new', :as => :add_priority

this will give routes

   priorities GET/priorities(.:format)  {:action=>"index",
:controller=>"priorities"}
  POST   /priorities(.:format)  {:action=>"create",
:controller=>"priorities"}
 new_priority GET/priorities/new(.:format)  {:action=>"new",
:controller=>"priorities"}
edit_priority GET/priorities/:id/edit(.:format) {:action=>"edit",
:controller=>"priorities"}
 priority GET/priorities/:id(.:format)  {:action=>"show",
:controller=>"priorities"}
  PUT/priorities/:id(.:format)  {:action=>"update",
:controller=>"priorities"}
  DELETE /priorities/:id(.:format)  {:action=>"destroy",
:controller=>"priorities"}
 add_priority GET/priorities/add(.:format)  {:action=>"new",
:controller=>"priorities"}

btw, im using rails 3, i don't know if there's different with the 2.x
version

Ahmy Yulrizka


On Mon, Dec 20, 2010 at 2:50 PM, bourne  wrote:

> Thank you! Your post is really helpful.
>
> As mentioned above, I just want to understand how I would declare the 7
> REST routes if they would not have been declared for me, e.g. new1 (add in
> my example), edit1, ...
> If I declare add as a collection route, this statement throws an error
> <%= link_to 'Add Priority', add_*priority*_path %> (taken from
> originally created code :  <%= link_to 'New Priority', new_priority_path %>)
>
> <%= link_to 'Add Priority', add_*priorities*_path %> works as expected.
>
> My original question was: what is my definition missing compared to the
> original new?
>
>
> Second, I find this very interesting: get 'add' => 'priorities#create', :as
> => my_custom_add
> In this form I get an error, the same with :my_custom_add.

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



Re: [Rails] rails 3 helpers

2010-12-20 Thread Mahmoud Said
Because you are returnning the helpers as strings,  values... not function
calls. remove the encapsulating double quotes so that

*  html << link_to( "image_tag('icons/rss_#{rss[0]}.png')", rss[1],
:disabled => "#{rss[2]}")*
will be
*  html << link_to(image_tag('icons/rss_#{rss[0]}.png'), rss[1],
:disabled => "#{rss[2]}")*





On Mon, Dec 20, 2010 at 6:44 AM, Me  wrote:

> This code outputs html to the page not the icons, ideas?
>
>
>
> def pub_social_links(pub)
>   html = ""
>   twit = pub.twitter.blank? ? ['off',"#{pub.twitter}",'disabled'] :
> ['on','','']
>   rss = pub.rss.blank? ? ['off',"#{pub.rss}",'disabled'] : ['on','']
>   fb = pub.facebook.blank? ? ['off',"#{pub.facebook}",'disabled'] :
> ['on','','']
>   html << link_to( "image_tag('icons/rss_#{rss[0]}.png')", rss[1],
> :disabled => "#{rss[2]}")
>   html << link_to( "image_tag('icons/twitter_#{twit[0]}.png')",
> "#{twit[1]}", :disabled => "#{twit[2]}")
>   html << link_to( "image_tag('icons/facebook_#{fb[0]}.png')",
> "#{fb[1]}", :disabled => "#{fb[2]}")
> return html
>   end
>
> image_tag('icons/rss_off.png') disabled="disabled">image_tag('icons/twitter_off.png') disabled="disabled">image_tag('icons/facebook_off.png')
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>



-- 
Mahmoud Said
Software Engineer - eSpace
blog.modsaid.com

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