Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Kai's Profile

GitHub User: uferdamm

Comments by Kai

Avatar

time rake db:migrate with normal macbook pro hdd: 2.x seconds
time rake db:migrate with samsung 840 pro ssd: 1.x seconds

I also feel the difference :)

Avatar

I find out a easy solution. Just edit your routes.rb file like this:

match 'products/page/:page', :to => 'products#index'

But there is another problem. I got 2 different display styles (grid and list).

When I try something like this:

match 'products/grid/page/:page', :to => 'products#index', :display => 'grid'

I get the "pretty url" plus "?display=grid" =/

Avatar

Hi,

does anyone have a good solution to modify the will_paginate paging urls?

old:
.../products?page=2
new:
.../products/page/2/

Avatar

Hi,

I got 2 models, "User" and "Memberships". Each user has multiple memberships (has_many), and each membership belongs_to an user.

ruby
class User < ActiveRecord::Base
    has_many :memberships, :dependent => :destroyend
end
class Membership < ActiveRecord::Base
    belongs_to :user 
end

My question is: How do I loop thru each user and each membership? My idea was to build 2 loops, but its not working =/ (Unknown method 'each' for users?)

ruby
xml.instruct! :xml, version: "1.0" 
xml.rss version: "2.0" do
  xml.channel do
    xml.title "..."
    xml.description "..."
    xml.link users_url

    @users.each do |user|
      user.memberships.each do |membership|
        xml.item do
           xml.title membership.name
           xml.pubDate membership.subscribed_at.to_s(:rfc822)
        end
      end
    end
  end
end