Nondeterministic behavior causing asset pipeline problems? #49

Closed
alexfarrill opened this Issue Jun 14, 2012 · 5 comments

Comments

Projects
None yet
2 participants
@alexfarrill
Contributor

alexfarrill commented Jun 14, 2012

Hi, I'm seeing a problem while including js-routes in the asset pipeline in a Rails 3.2.3. We have two app servers which are precompiling assets. The signatures do not match between the compiled js on the two app servers and it looks like there is a difference in the order of the named routes that are being generated in the compiled javascript. I haven't looked too deeply into the code yet, but is it possible that this is a bug? I will investigate further tomorrow morning, but please point me in the right direction if this sounds possible.
Thanks,
Alex

@alexfarrill

This comment has been minimized.

Show comment
Hide comment
@alexfarrill

alexfarrill Jun 14, 2012

Contributor

It seems to me that the problem is that Rails.application.routes.named_routes.routes is a Hash and so no order is implied. Would it be reasonable to sort this, e.g. in alphabetical order by key name, when it is needed?
Thanks
Alex

Contributor

alexfarrill commented Jun 14, 2012

It seems to me that the problem is that Rails.application.routes.named_routes.routes is a Hash and so no order is implied. Would it be reasonable to sort this, e.g. in alphabetical order by key name, when it is needed?
Thanks
Alex

@bogdan

This comment has been minimized.

Show comment
Hide comment
@bogdan

bogdan Jun 14, 2012

Collaborator

Yes, seems reasonable.

Btw are you using 1.8 or 1.9? This can make a big difference in how Hash works.

Collaborator

bogdan commented Jun 14, 2012

Yes, seems reasonable.

Btw are you using 1.8 or 1.9? This can make a big difference in how Hash works.

@alexfarrill

This comment has been minimized.

Show comment
Hide comment
@alexfarrill

alexfarrill Jun 14, 2012

Contributor

1.8.7

Alex

Sent from my iPhone

On Jun 14, 2012, at 3:12 AM, Bogdan Gusievreply@reply.github.com wrote:

Yes, seems reasonable.

Btw are you using 1.8 or 1.9? This can make a big difference in how Hash works.


Reply to this email directly or view it on GitHub:
#49 (comment)

Contributor

alexfarrill commented Jun 14, 2012

1.8.7

Alex

Sent from my iPhone

On Jun 14, 2012, at 3:12 AM, Bogdan Gusievreply@reply.github.com wrote:

Yes, seems reasonable.

Btw are you using 1.8 or 1.9? This can make a big difference in how Hash works.


Reply to this email directly or view it on GitHub:
#49 (comment)

@bogdan

This comment has been minimized.

Show comment
Hide comment
@bogdan

bogdan Jun 14, 2012

Collaborator

So, all you need is add sort call at this line:
https://github.com/railsware/js-routes/blob/master/lib/js_routes.rb#L111

    js_routes = Rails.application.routes.named_routes.routes.sort.map do |_, route|

I don't want to commit this to master until make sure it fixes your problem
Please try it on your side

Collaborator

bogdan commented Jun 14, 2012

So, all you need is add sort call at this line:
https://github.com/railsware/js-routes/blob/master/lib/js_routes.rb#L111

    js_routes = Rails.application.routes.named_routes.routes.sort.map do |_, route|

I don't want to commit this to master until make sure it fixes your problem
Please try it on your side

@bogdan

This comment has been minimized.

Show comment
Hide comment
@bogdan

bogdan Jun 14, 2012

Collaborator

So, all you need is add sort call at this line:
https://github.com/railsware/js-routes/blob/master/lib/js_routes.rb#L111

    js_routes = Rails.application.routes.named_routes.routes.sort.map do |_, route|

I don't want to commit this to master until make sure it fixes your problem
Please try it on your side

Collaborator

bogdan commented Jun 14, 2012

So, all you need is add sort call at this line:
https://github.com/railsware/js-routes/blob/master/lib/js_routes.rb#L111

    js_routes = Rails.application.routes.named_routes.routes.sort.map do |_, route|

I don't want to commit this to master until make sure it fixes your problem
Please try it on your side

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment