On Sat, Oct 9, 2010 at 7:41 AM, Anders_P <[email protected]> wrote:

> Hello!
>
> I'm trying to create a menu. I have a controller that takes two
> attributes, like this:
>
> def category(gender, category)
>  @ads = Ad.find_all_by_gender_and_category(gender,
> category).paginate(:page => params[:page])
>  @title = "Startsidan"
>  render 'home'
> end
>

Is this your controller code? If so you have issues as (someone correct me
if this is a new Rails 3 construct that I am clueless) you should not be
taking arguments in the signature. If the params gender and category are
needed they should be accessed as params[:gender] params[:category].

So in your view you need something like this below. Also see
http://apidock.com/rails/ActionView/Helpers/UrlHelper/link_to for info on
link_to helper.

<%= link_to "Accessories", :controller => "categories", :action => "show",
:gender => "male", :category => "zzz"

and then in your controller action

def show
 gender = params[:gender]
 category = params[:category]
# now do what you want with the data
end

David


> And in my view I have a list with menu options:
>
> <li class="li_content"><%= link_to "Accessoarer", :action =>
> "category('dam', 'Accessoarer')" %></li><br />
>
> And my routes it look like this:
>
> match '/dam-accessoarer',       :to => "pages#category('dam',
> 'Accessoarer')"
>
> But it doesn't work.
>
> I get the following error.
>
> Unknown action
>
> The action 'category('dam', 'Accessoarer')' could not be found for
> PagesController
>
> Any help on how to solve it would be greatly appreciated!
>
> Thanks!
> // Anders
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to