This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Merb::Router.prepare do |r| | |
r.domain("admin-domain.com", :controller_prefix => :admin) do |admin| | |
admin.resources :users | |
end | |
r.domain("content.com", :controller_prefix => :site) do |site| | |
site.resources :users | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it "should not use the ruby object id" do | |
url(:with_id, "123").should == "/123" # ==> fails | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
carl-lerches-mac-pro:merb-core-enterprise-edition carllerche$ ruby spec/public/controller/dispatcher_spec.rb | |
.......................HTML parser | |
error : | |
error parsing attribute name | |
<tr class=even><td>default</td><td>#<Merb::Router::Route:0x17cf690 @index=0, | |
^ | |
HTML parser | |
error : | |
error parsing attribute name | |
<tr class=even><td>default</td><td>#<Merb::Router::Route:0x17cf690 @index=0, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Carl-Lerches-MacBook-Pro-15:merb-core-enterprise-edition carllerche$ ruby spec/public/controller/dispatcher_spec.rb | |
.......................HTML parser | |
error : | |
error parsing attribute name | |
<tr class=even><td>default</td><td>#<Merb::Router::Route:0x18b9718 @segments | |
^ | |
HTML parser | |
error : | |
error parsing attribute name | |
><td>default</td><td>#<Merb::Router::Route:0x18b9718 @segments=["/", :controller |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Merb::Router.prepare do |r| | |
# r.match("/:account", :account => /^act-[a-z]{5}-\d{3}/) do |act| | |
# act.match("/:path/:page(.:format)", :path => /.*/, :page => /^[a-z]+$/).to(:controller => "pages", :action => "show").name(:page) | |
# end | |
# end | |
@generator = lambda do |params| | |
if (cached_account = params[:account]) =~ /^act-[a-z]{5}-\d{3}/ && (cached_path = params[:path]) == ["/:account", "/:path/:page(.:format)"] && (cached_page = params[:page]) =~ /^[a-z]+$/ | |
_optional_segments_2976310 = if (cached_format = params[:format]) | |
".#{cached_format}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Merb::Router do |r| | |
r.match("/hello", :method => :get).to(:controller => "hello", :action => "get") | |
r.match("/hello", :method => :post).to(:controller => "hello", :action => "post") | |
r.match("/whatever").to(:controller => "whatever", :action => "index") | |
r.match("/world", :method => :get).to(:controller => "world", :action => "get") | |
r.match("/world", :method => :post).to(:controller => "world", :action => "post") | |
end | |
def match(request) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Merb::Router.prepare do |r| | |
r.resources :blogs | |
r.resource :account do |u| | |
u.resource :blog | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyBuilder < Merb::Helpers::Form::Builder::Base | |
def my_awesome_method | |
end | |
end | |
# --- In the view --- | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyBuilder < Merb::Helpers::Form::Builder::Base | |
def my_awesome_method | |
end | |
end | |
class AnotherBuilder < Merb::Helpers::Form::Builder::Base | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Merb::Router.prepare do | |
namespace :admin do | |
match("/foo").to(:controller => "foos") # => :controller => "admin/foos" | |
match("/bar").to(:controller => "/bars") # => :controller => "bars" | |
end | |
end |