On 30 November 2012 10:55, Jim Ruther Nill <jvn...@gmail.com> wrote:

>
>
>
> On Fri, Nov 30, 2012 at 1:16 PM, sumit srivastava <
> sumit.theinvinci...@gmail.com> wrote:
>
>> On 30 November 2012 10:41, Jim Ruther Nill <jvn...@gmail.com> wrote:
>>
>>>
>>>
>>>
>>> On Fri, Nov 30, 2012 at 12:51 PM, Sumit Srivastava <
>>> sumit.theinvinci...@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I have a controller named Users with index action.
>>>>
>>>> def index
>>>>     puts "************* #{params[:city]}"
>>>>     ...
>>>>     ...
>>>> end
>>>>
>>>> From the view,
>>>> link_to(:city, list_users_with_city_path(:city => city.name))
>>>>
>>>
>>> You implied below that list_users_with_city_path is not yet defined
>>> at this point so why is it not giving any errors?  where did you
>>> get list_user_with_city_path if you haven't defined it in the routed yet?
>>>
>>
>> Wrote this by mistake. I use it this way after defining the path. What
>> doesn't works is,
>>
>> link_to(:city, users(:city => city.name)
>> And this is not giving any errors but nothing is received in the index
>> action.
>>
>
> use users_path.  I'm not sure why it's not giving any errors.
>

Ah! Again I typed wrong. Yes, this is what I used, users_path and seems
like I also missed the closing bracket for link_to up here. Certainly, it
gave errors without "path".

So, with the correct syntax, link_to(:city, users_path(:city => city.name)),
it didn't work.


>
>>
>>
>>
>>>
>>>
>>>> But when I click on this link, it doesn't prints out anything for the
>>>> params. All the "*" are being printed. The url in the browser displays,
>>>>
>>>> localhost:3000/users?city=delhi
>>>>
>>>> Instead when I create a new route, get '/users/:city' => 'users#index',
>>>> :as => list_users_with_city
>>>> This works fine. I get proper output.
>>>
>>>
>>>> What could be the problem?
>>>>
>>>>
>>>>
>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Ruby on Rails: Talk" group.
>>>> To post to this group, send email to rubyonrails-talk@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> rubyonrails-talk+unsubscr...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msg/rubyonrails-talk/-/lpsqYbWtC0cJ.
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> -------------------------------------------------------------
>>> visit my blog at http://jimlabs.heroku.com
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Ruby on Rails: Talk" group.
>>> To post to this group, send email to rubyonrails-talk@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> rubyonrails-talk+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To post to this group, send email to rubyonrails-talk@googlegroups.com.
>> To unsubscribe from this group, send email to
>> rubyonrails-talk+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
>
> --
> -------------------------------------------------------------
> visit my blog at http://jimlabs.heroku.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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


Reply via email to