Skip to content

Commit

Permalink
removing some legacy code in responses and added current_user method …
Browse files Browse the repository at this point in the history
…to FormsExtension to return user from UserActionObserver
  • Loading branch information
dirkkelly committed Sep 28, 2010
1 parent 8bc64c7 commit 769bd48
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions lib/forms/models/extension.rb
Expand Up @@ -12,6 +12,12 @@ def initialize(form, page)
# Sets the config to be the current environment config: checkout:
@config = @form[:extensions][self.class.to_s.downcase.gsub('form', '').to_sym]
end

def current_user
return @current_user if @current_user.present?
@current_user = UserActionObserver.current_user
end

end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/forms/tags/core.rb
Expand Up @@ -179,7 +179,7 @@ module Core
}
tag 'response' do |tag|
tag.locals.response = Forms::Tags::Responses.current(tag,request)

tag.expand if tag.locals.response.present? and tag.locals.response.result.present?
end

Expand Down
4 changes: 2 additions & 2 deletions lib/forms/tags/responses.rb
Expand Up @@ -10,9 +10,9 @@ def current(tag, request)
if tag.locals.response.present?
response = tag.locals.response
elsif tag.locals.page.request.present?
session = tag.locals.page.request.session[:form_response] rescue tag.locals.page.request[:session][:form_response]
session = tag.locals.page.request.session[:form_response]
begin
response = Response.find(session)
response = Response.find(session)
rescue
if session == Object
response = Response.create
Expand Down

0 comments on commit 769bd48

Please sign in to comment.