forem 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +8 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +166 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +33 -0
- data/app/controllers/forem/application_controller.rb +13 -0
- data/app/controllers/forem/forums_controler.rb +11 -0
- data/app/controllers/forem/posts_controller.rb +26 -0
- data/app/controllers/forem/topics_controller.rb +35 -0
- data/app/helpers/forem/application_helper.rb +4 -0
- data/app/models/forem/forum.rb +4 -0
- data/app/models/forem/post.rb +11 -0
- data/app/models/forem/topic.rb +17 -0
- data/app/views/forem/forums/index.html.erb +13 -0
- data/app/views/forem/forums/show.html.erb +3 -0
- data/app/views/forem/posts/_form.html.erb +4 -0
- data/app/views/forem/posts/_post.html.erb +20 -0
- data/app/views/forem/posts/new.html.erb +6 -0
- data/app/views/forem/topics/_form.html.erb +9 -0
- data/app/views/forem/topics/new.html.erb +3 -0
- data/app/views/forem/topics/show.html.erb +6 -0
- data/config/locales/en.yml +23 -0
- data/config/routes.rb +9 -0
- data/db/migrate/20110214221555_create_forums.rb +13 -0
- data/db/migrate/20110221092741_create_topics.rb +11 -0
- data/db/migrate/20110221094502_create_posts.rb +11 -0
- data/db/migrate/20110228084940_add_reply_to_to_posts.rb +5 -0
- data/forem.gemspec +16 -0
- data/lib/forem.rb +4 -0
- data/lib/forem/engine.rb +13 -0
- data/lib/rack/utils_monkey_patch.rb +9 -0
- data/lib/tasks/forem_tasks.rake +4 -0
- data/public/javascripts/application.js +2 -0
- data/public/javascripts/controls.js +965 -0
- data/public/javascripts/dragdrop.js +974 -0
- data/public/javascripts/effects.js +1123 -0
- data/public/javascripts/prototype.js +6082 -0
- data/public/javascripts/rails.js +192 -0
- data/public/stylesheets/.gitkeep +0 -0
- data/script/rails +6 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/fake_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/models/user.rb +6 -0
- data/spec/dummy/app/views/fake/sign_in.html.erb +7 -0
- data/spec/dummy/app/views/layouts/application.html.erb +17 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +43 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +16 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +26 -0
- data/spec/dummy/config/environments/production.rb +49 -0
- data/spec/dummy/config/environments/test.rb +35 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/db/migrate/001_create_users.rb +8 -0
- data/spec/dummy/db/schema.rb +43 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/javascripts/application.js +2 -0
- data/spec/dummy/public/javascripts/controls.js +965 -0
- data/spec/dummy/public/javascripts/dragdrop.js +974 -0
- data/spec/dummy/public/javascripts/effects.js +1123 -0
- data/spec/dummy/public/javascripts/prototype.js +6082 -0
- data/spec/dummy/public/javascripts/rails.js +192 -0
- data/spec/dummy/public/stylesheets/.gitkeep +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/integration/forums_spec.rb +22 -0
- data/spec/integration/posts_spec.rb +36 -0
- data/spec/integration/topics_spec.rb +71 -0
- data/spec/models/post_spec.rb +16 -0
- data/spec/spec_helper.rb +15 -0
- data/spec/support/capybara.rb +6 -0
- data/spec/support/capybara_ext.rb +47 -0
- data/spec/support/dummy_login.rb +33 -0
- data/spec/support/factories.rb +45 -0
- data/spec/support/factories/forums.rb +4 -0
- data/spec/support/factories/topics.rb +4 -0
- data/spec/support/routes.rb +5 -0
- metadata +221 -0
@@ -0,0 +1,192 @@
|
|
1
|
+
(function() {
|
2
|
+
// Technique from Juriy Zaytsev
|
3
|
+
// http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
|
4
|
+
function isEventSupported(eventName) {
|
5
|
+
var el = document.createElement('div');
|
6
|
+
eventName = 'on' + eventName;
|
7
|
+
var isSupported = (eventName in el);
|
8
|
+
if (!isSupported) {
|
9
|
+
el.setAttribute(eventName, 'return;');
|
10
|
+
isSupported = typeof el[eventName] == 'function';
|
11
|
+
}
|
12
|
+
el = null;
|
13
|
+
return isSupported;
|
14
|
+
}
|
15
|
+
|
16
|
+
function isForm(element) {
|
17
|
+
return Object.isElement(element) && element.nodeName.toUpperCase() == 'FORM';
|
18
|
+
}
|
19
|
+
|
20
|
+
function isInput(element) {
|
21
|
+
if (Object.isElement(element)) {
|
22
|
+
var name = element.nodeName.toUpperCase();
|
23
|
+
return name == 'INPUT' || name == 'SELECT' || name == 'TEXTAREA';
|
24
|
+
}
|
25
|
+
else return false;
|
26
|
+
}
|
27
|
+
|
28
|
+
var submitBubbles = isEventSupported('submit'),
|
29
|
+
changeBubbles = isEventSupported('change');
|
30
|
+
|
31
|
+
if (!submitBubbles || !changeBubbles) {
|
32
|
+
// augment the Event.Handler class to observe custom events when needed
|
33
|
+
Event.Handler.prototype.initialize = Event.Handler.prototype.initialize.wrap(
|
34
|
+
function(init, element, eventName, selector, callback) {
|
35
|
+
init(element, eventName, selector, callback);
|
36
|
+
// is the handler being attached to an element that doesn't support this event?
|
37
|
+
if ( (!submitBubbles && this.eventName == 'submit' && !isForm(this.element)) ||
|
38
|
+
(!changeBubbles && this.eventName == 'change' && !isInput(this.element)) ) {
|
39
|
+
// "submit" => "emulated:submit"
|
40
|
+
this.eventName = 'emulated:' + this.eventName;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
);
|
44
|
+
}
|
45
|
+
|
46
|
+
if (!submitBubbles) {
|
47
|
+
// discover forms on the page by observing focus events which always bubble
|
48
|
+
document.on('focusin', 'form', function(focusEvent, form) {
|
49
|
+
// special handler for the real "submit" event (one-time operation)
|
50
|
+
if (!form.retrieve('emulated:submit')) {
|
51
|
+
form.on('submit', function(submitEvent) {
|
52
|
+
var emulated = form.fire('emulated:submit', submitEvent, true);
|
53
|
+
// if custom event received preventDefault, cancel the real one too
|
54
|
+
if (emulated.returnValue === false) submitEvent.preventDefault();
|
55
|
+
});
|
56
|
+
form.store('emulated:submit', true);
|
57
|
+
}
|
58
|
+
});
|
59
|
+
}
|
60
|
+
|
61
|
+
if (!changeBubbles) {
|
62
|
+
// discover form inputs on the page
|
63
|
+
document.on('focusin', 'input, select, textarea', function(focusEvent, input) {
|
64
|
+
// special handler for real "change" events
|
65
|
+
if (!input.retrieve('emulated:change')) {
|
66
|
+
input.on('change', function(changeEvent) {
|
67
|
+
input.fire('emulated:change', changeEvent, true);
|
68
|
+
});
|
69
|
+
input.store('emulated:change', true);
|
70
|
+
}
|
71
|
+
});
|
72
|
+
}
|
73
|
+
|
74
|
+
function handleRemote(element) {
|
75
|
+
var method, url, params;
|
76
|
+
|
77
|
+
var event = element.fire("ajax:before");
|
78
|
+
if (event.stopped) return false;
|
79
|
+
|
80
|
+
if (element.tagName.toLowerCase() === 'form') {
|
81
|
+
method = element.readAttribute('method') || 'post';
|
82
|
+
url = element.readAttribute('action');
|
83
|
+
// serialize the form with respect to the submit button that was pressed
|
84
|
+
params = element.serialize({ submit: element.retrieve('rails:submit-button') });
|
85
|
+
// clear the pressed submit button information
|
86
|
+
element.store('rails:submit-button', null);
|
87
|
+
} else {
|
88
|
+
method = element.readAttribute('data-method') || 'get';
|
89
|
+
url = element.readAttribute('href');
|
90
|
+
params = {};
|
91
|
+
}
|
92
|
+
|
93
|
+
new Ajax.Request(url, {
|
94
|
+
method: method,
|
95
|
+
parameters: params,
|
96
|
+
evalScripts: true,
|
97
|
+
|
98
|
+
onCreate: function(response) { element.fire("ajax:create", response); },
|
99
|
+
onComplete: function(response) { element.fire("ajax:complete", response); },
|
100
|
+
onSuccess: function(response) { element.fire("ajax:success", response); },
|
101
|
+
onFailure: function(response) { element.fire("ajax:failure", response); }
|
102
|
+
});
|
103
|
+
|
104
|
+
element.fire("ajax:after");
|
105
|
+
}
|
106
|
+
|
107
|
+
function insertHiddenField(form, name, value) {
|
108
|
+
form.insert(new Element('input', { type: 'hidden', name: name, value: value }));
|
109
|
+
}
|
110
|
+
|
111
|
+
function handleMethod(element) {
|
112
|
+
var method = element.readAttribute('data-method'),
|
113
|
+
url = element.readAttribute('href'),
|
114
|
+
csrf_param = $$('meta[name=csrf-param]')[0],
|
115
|
+
csrf_token = $$('meta[name=csrf-token]')[0];
|
116
|
+
|
117
|
+
var form = new Element('form', { method: "POST", action: url, style: "display: none;" });
|
118
|
+
$(element.parentNode).insert(form);
|
119
|
+
|
120
|
+
if (method !== 'post') {
|
121
|
+
insertHiddenField(form, '_method', method);
|
122
|
+
}
|
123
|
+
|
124
|
+
if (csrf_param) {
|
125
|
+
insertHiddenField(form, csrf_param.readAttribute('content'), csrf_token.readAttribute('content'));
|
126
|
+
}
|
127
|
+
|
128
|
+
form.submit();
|
129
|
+
}
|
130
|
+
|
131
|
+
function disableFormElements(form) {
|
132
|
+
form.select('input[type=submit][data-disable-with]').each(function(input) {
|
133
|
+
input.store('rails:original-value', input.getValue());
|
134
|
+
input.setValue(input.readAttribute('data-disable-with')).disable();
|
135
|
+
});
|
136
|
+
}
|
137
|
+
|
138
|
+
function enableFormElements(form) {
|
139
|
+
form.select('input[type=submit][data-disable-with]').each(function(input) {
|
140
|
+
input.setValue(input.retrieve('rails:original-value')).enable();
|
141
|
+
});
|
142
|
+
}
|
143
|
+
|
144
|
+
function allowAction(element) {
|
145
|
+
var message = element.readAttribute('data-confirm');
|
146
|
+
return !message || confirm(message);
|
147
|
+
}
|
148
|
+
|
149
|
+
document.on('click', 'a[data-confirm], a[data-remote], a[data-method]', function(event, link) {
|
150
|
+
if (!allowAction(link)) {
|
151
|
+
event.stop();
|
152
|
+
return false;
|
153
|
+
}
|
154
|
+
|
155
|
+
if (link.readAttribute('data-remote')) {
|
156
|
+
handleRemote(link);
|
157
|
+
event.stop();
|
158
|
+
} else if (link.readAttribute('data-method')) {
|
159
|
+
handleMethod(link);
|
160
|
+
event.stop();
|
161
|
+
}
|
162
|
+
});
|
163
|
+
|
164
|
+
document.on("click", "form input[type=submit], form button[type=submit], form button:not([type])", function(event, button) {
|
165
|
+
// register the pressed submit button
|
166
|
+
event.findElement('form').store('rails:submit-button', button.name || false);
|
167
|
+
});
|
168
|
+
|
169
|
+
document.on("submit", function(event) {
|
170
|
+
var form = event.findElement();
|
171
|
+
|
172
|
+
if (!allowAction(form)) {
|
173
|
+
event.stop();
|
174
|
+
return false;
|
175
|
+
}
|
176
|
+
|
177
|
+
if (form.readAttribute('data-remote')) {
|
178
|
+
handleRemote(form);
|
179
|
+
event.stop();
|
180
|
+
} else {
|
181
|
+
disableFormElements(form);
|
182
|
+
}
|
183
|
+
});
|
184
|
+
|
185
|
+
document.on('ajax:create', 'form', function(event, form) {
|
186
|
+
if (form == event.findElement()) disableFormElements(form);
|
187
|
+
});
|
188
|
+
|
189
|
+
document.on('ajax:complete', 'form', function(event, form) {
|
190
|
+
if (form == event.findElement()) enableFormElements(form);
|
191
|
+
});
|
192
|
+
})();
|
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "forums" do
|
4
|
+
before do
|
5
|
+
@forum = Forem::Forum.create!(:title => "Welcome to Forem!",
|
6
|
+
:description => "A placeholder forum.")
|
7
|
+
end
|
8
|
+
|
9
|
+
it "listing all" do
|
10
|
+
visit forums_path
|
11
|
+
page.should have_content("Welcome to Forem!")
|
12
|
+
page.should have_content("A placeholder forum.")
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
it "visiting one" do
|
17
|
+
visit forum_path(@forum.id)
|
18
|
+
within("#forum h2") do
|
19
|
+
page.should have_content("Welcome to Forem!")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "posts" do
|
4
|
+
# TODO: FG'ize
|
5
|
+
let(:forum) { create_forum! }
|
6
|
+
let(:topic) { create_topic! }
|
7
|
+
|
8
|
+
context "not signed in users " do
|
9
|
+
it "cannot begin to post a reply" do
|
10
|
+
visit new_topic_post_path(topic)
|
11
|
+
flash_error!("You must sign in first.")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context "signed in users" do
|
16
|
+
before do
|
17
|
+
sign_in!
|
18
|
+
visit forum_topic_path(forum, topic)
|
19
|
+
within(selector_for(:first_post)) do
|
20
|
+
click_link("Reply")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
it "can post a reply to a topic" do
|
25
|
+
fill_in "Text", :with => "Witty and insightful commentary."
|
26
|
+
click_button "Post Reply"
|
27
|
+
flash_notice!("Your reply has been posted.")
|
28
|
+
assert_seen("In reply to #{topic.posts.first.user}", :within => :second_post)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "cannot post a reply to a topic with blank text" do
|
32
|
+
click_button "Post Reply"
|
33
|
+
flash_error!("Your reply could not be posted.")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "topics" do
|
4
|
+
let(:forum) { Forem::Forum.create!(:title => "Welcome to forem!",
|
5
|
+
:description => "FIRST FORUM") }
|
6
|
+
# When FG is implemented
|
7
|
+
# let(:forum) { Factory(:forum) }
|
8
|
+
# let(:topic) { Factory(:topic) }
|
9
|
+
|
10
|
+
context "not signed in" do
|
11
|
+
before do
|
12
|
+
sign_out!
|
13
|
+
end
|
14
|
+
it "cannot create a new topic" do
|
15
|
+
visit new_forum_topic_path(forum)
|
16
|
+
flash_error!("You must sign in first.")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context "signed in" do
|
21
|
+
before do
|
22
|
+
sign_in!
|
23
|
+
visit new_forum_topic_path(forum)
|
24
|
+
end
|
25
|
+
|
26
|
+
context "creating a topic" do
|
27
|
+
|
28
|
+
it "is valid with subject and post text" do
|
29
|
+
fill_in "Subject", :with => "FIRST TOPIC"
|
30
|
+
fill_in "Text", :with => "omgomgomgomg"
|
31
|
+
click_button 'Create Topic'
|
32
|
+
|
33
|
+
flash_notice!("This topic has been created.")
|
34
|
+
assert_seen("FIRST TOPIC", :within => :topic_header)
|
35
|
+
assert_seen("omgomgomgomg", :within => :post_text)
|
36
|
+
assert_seen("forem_user", :within => :post_user)
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
it "is invalid without subject but with post text" do
|
41
|
+
click_button 'Create Topic'
|
42
|
+
|
43
|
+
flash_error!("This topic could not be created.")
|
44
|
+
find_field("topic_subject").value.should eql("")
|
45
|
+
find_field("topic_posts_attributes_0_text").value.should eql("")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context "viewing a topic" do
|
51
|
+
# Todo: Factory'ize
|
52
|
+
let(:topic) do
|
53
|
+
attributes = { :subject => "FIRST TOPIC",
|
54
|
+
:posts_attributes => {
|
55
|
+
"0" => {
|
56
|
+
:text => "omgomgomg",
|
57
|
+
:user => User.first
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
forum.topics.create(attributes)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "is free for all" do
|
66
|
+
visit forum_topic_path(forum, topic)
|
67
|
+
assert_seen("FIRST TOPIC", :within => :topic_header)
|
68
|
+
assert_seen("omgomgomg", :within => :post_text)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Forem::Post do
|
4
|
+
let(:post) { create_post! }
|
5
|
+
let(:reply) { create_post!(:reply_to => post) }
|
6
|
+
|
7
|
+
context "upon deletion" do
|
8
|
+
|
9
|
+
it "clears the reply_to_id for all replies" do
|
10
|
+
reply.reply_to.should eql(post)
|
11
|
+
post.destroy
|
12
|
+
reply.reload
|
13
|
+
reply.reply_to.should be_nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Configure Rails Envinronment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
4
|
+
|
5
|
+
require 'rspec/rails'
|
6
|
+
|
7
|
+
ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
|
8
|
+
|
9
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
10
|
+
# in spec/support/ and its subdirectories.
|
11
|
+
Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb")].each {|f| require f }
|
12
|
+
|
13
|
+
RSpec.configure do |config|
|
14
|
+
config.use_transactional_fixtures = true
|
15
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module CapybaraExt
|
2
|
+
# Just a shorter way of writing it.
|
3
|
+
def assert_seen(text, opts={})
|
4
|
+
if opts[:within]
|
5
|
+
within(selector_for(opts[:within])) do
|
6
|
+
page.should have_content(text)
|
7
|
+
end
|
8
|
+
else
|
9
|
+
page.should have_content(text)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def flash_error!(text)
|
14
|
+
within("#flash_error") do
|
15
|
+
assert_seen(text)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def flash_notice!(text)
|
20
|
+
within("#flash_notice") do
|
21
|
+
assert_seen(text)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def selector_for(identifier)
|
26
|
+
case identifier
|
27
|
+
when :topic_header
|
28
|
+
"#topic h2"
|
29
|
+
when :post_text
|
30
|
+
"#posts .post .text"
|
31
|
+
when :post_user
|
32
|
+
"#posts .post .user"
|
33
|
+
when :first_post
|
34
|
+
"#posts #post_1"
|
35
|
+
when :second_post
|
36
|
+
"#posts #post_2"
|
37
|
+
when :post_actions
|
38
|
+
"#{selector_for(:first_post)} .actions"
|
39
|
+
else
|
40
|
+
pending "No selector defined for #{identifier}. Please define one in spec/support/capybara_ext.rb"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
RSpec.configure do |config|
|
46
|
+
config.include CapybaraExt
|
47
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# "Borrowed" from the context engine
|
2
|
+
# We fake the login process in the engine, as we don't know how the actual
|
3
|
+
# application would have it set up. Guessing is best, currently.
|
4
|
+
|
5
|
+
# TODO: Consider moving to something like https://github.com/quickleft/abstract_auth
|
6
|
+
# to make this easier to test.
|
7
|
+
|
8
|
+
def sign_out!
|
9
|
+
Forem::ApplicationController.class_eval <<-STRING
|
10
|
+
def current_user
|
11
|
+
nil
|
12
|
+
end
|
13
|
+
|
14
|
+
helper_method :current_user
|
15
|
+
STRING
|
16
|
+
end
|
17
|
+
|
18
|
+
def sign_in!(options={})
|
19
|
+
# Fake user, provided by our fake "model".
|
20
|
+
# HACK HACK HACK.
|
21
|
+
# This is done so we can use the options to define how the current_user method is defined.
|
22
|
+
# Better ideas?
|
23
|
+
Forem::ApplicationController.class_eval <<-STRING
|
24
|
+
def current_user
|
25
|
+
attributes = { :login => "forem_user" }
|
26
|
+
#{"attributes.merge!(:context_admin => true)" if options[:admin]}
|
27
|
+
|
28
|
+
User.new(attributes)
|
29
|
+
end
|
30
|
+
|
31
|
+
helper_method :current_user
|
32
|
+
STRING
|
33
|
+
end
|