Skip to content

Instantly share code, notes, and snippets.

💭
Never asked for this.

Paweł Gościcki pjg

💭
Never asked for this.
Block or report user

Report or block pjg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View application_controller.rb
def default_url_options(options = {})
# resource hack so that url_for(@post) works like it should
# if a post was given as a parameter to `post_path` it will be assigned to the first (unnassigned) parameter of the route (year)
if options[:controller] == "posts" && options[:year].is_a?(Post)
post = options[:year]
options[:year] = post.year
options.merge(:month => post.month, :slug => post.slug)
else
{}
end
View resource_hacks lib for Rails 2.3.4
module ActionController
module Resources
class Resource
# Redefining methods from /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/resources.rb so that the RESTful routes accept member_path option
def member_path
@member_path || options[:member_path] || "#{shallow_path_prefix}/#{path_segment}/:id"
end
You can’t perform that action at this time.