-
-
Save Schwad/13e19a344a24f62704e21d851aca4658 to your computer and use it in GitHub Desktop.
This file contains 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
With the last fixes, scaffold_extensions work for this example, but override layout of the other Ramaze::Controller in the same Ramaze::App | |
- /foo should use /layout/foo.xhtml as layout, and be renderer an a gray background | |
- /f/forum should use /layout/foo.xhtml as well | |
The problem seems to be linked to the fact the Ramaze adapter now updates the *existing containing Ramaze::App* with its own path (here, default one and :forum) and affect as such any other controller in theses Apps. |
This file contains 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
# File: layout/foo.xhtml | |
<div style="background-color: gray"> | |
#@content | |
</div> |
This file contains 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
# Files: view/f/forum/index.xhtml | |
# view/foo/index.xhtml | |
<p> | |
#{@greeting} | |
</p> |
This file contains 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
#!/usr/bin/env ruby | |
# encoding: UTF-8 | |
require 'ramaze' | |
require 'sequel' | |
$LOAD_PATH = $LOAD_PATH.unshift("./lib") | |
require 'scaffolding_extensions' | |
# Model stuff | |
DB = Sequel.sqlite | |
DB.create_table :entries do | |
primary_key :id | |
String :value | |
end | |
class Entry < Sequel::Model(:entries) | |
end | |
# First, we try without explicit App | |
class FooController < Ramaze::Controller | |
layout 'foo' | |
def index | |
@greeting = "hello world!" | |
end | |
end | |
class AdminController < Ramaze::Controller | |
map '/admin_se' | |
scaffold_all_models :only => [ Entry ] | |
end | |
# Next, try with an app named 'forum' | |
class ForumController < Ramaze::Controller | |
map '/forum', :forum | |
layout 'foo' | |
def index | |
@greeting = "hello, forum!" | |
end | |
end | |
class EntryController < Ramaze::Controller | |
map '/entry_se', :forum | |
scaffold_all_models :only => [ Entry ] | |
end | |
forum = Ramaze::App[:forum] | |
forum.location = '/f' | |
Ramaze.start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment