Question

Using: Rails 3.0.3 Friendly_id: 4.0.0.beta11

I have create a fully working development version of an application where I got everything working, including friendly_id url:s like domain.com/cars/mitsubishi

Now I am deploying the application on Heroku but I can't get the friendly_id to work for some reason.

Problem: When I deploy it on Heroku it gives me "name" as friendly_id and not slug_en or slug_se. Calculation.first.friendly_id gives for example "I am a calculation" as opposed to "i-am-a-calculation" which would be the content of slug_en.

Model (Calculation)

  extend FriendlyId
  friendly_id :name, :use => :slugged, :use => I18n

Migration (Calculation):

        t.string :slug_en
        t.string :slug_se

Migratiotion2:

add_index :calculations, :slug_en, :unique => true
add_index :calculations, :slug_se, :unique => true 

The problem is that I need to push (heroku db:push) my local database to Heroku (since it is filled with data) and thus I am not sure how much I can trust the migrations. As far as I understand, they get overwritten with db:push.

Now, that shouldn't really matter since it works fine locally. If I use I18n.locale = :se it will give me the slug_se as id and slug_en for :en.

Worth to mention is that Heroku uses postgre and I use mysql locally, if that matters.

My questions:

  1. What could typically be the problem if I get the name-attribute as friendly_id instead of the slug_en or slug_se
  2. Is there anything wrong with the code that I have submitted here?
  3. Could postgre / mysql-differences cause this?
  4. Is it a matter of indices not being created on my Heroku installation?

Thanks!

Was it helpful?

Solution

It seemed like the problem lies in that when I upload the files to Heroku. Heroku uses friendly_id 4.0.0.beta8 and it is first in 4.0.0.beta11 where the slug_en/slug_se appears (if I understand it correctly).

So, the problem is still not fixed but changed to quite a different type of problem that is not really related to the question posed in this ticket.

FYI: The new problem is "Why is the version of friendly_id being changed to an earlier version".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top