-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
request headers #8
Conversation
@@ -6,6 +6,16 @@ def index | |||
end | |||
|
|||
def create | |||
@subscriber = Subscriber.where("email = ? and website_id = ?", params['email'], @current_site.id) | |||
@error = Issue.where("description = ?", params['message']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asta nu prea are sens. description ala cel mai probabil o sa fie un backtrace sau un mesaj pe care il trimite siteu cu eroarea. Ti-am zis ca params['message'] asta nu prea are loc in momentul asta. Ce putem sa facem e sa adaugam un nou tabel cu mesajele. Si sa fie mesajele legate de issue_id si subscriber_id
app_id = request.headers['HTTP_APP_ID'] | ||
@current_site ||= Website.find_by_app_id_and_app_key(app_id, app_key) | ||
end | ||
|
||
def current_site | ||
if params[:website_id] && current_member | ||
@current_site ||= current_member.websites.where("websites.id = ?", params[:website_id]).try(:first) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hai sa facem aici altfel. Hai sa combinam in metoda asta current_site cu metoda aia set_websites_from_header. Fai aici asa:
if params[:website_id] && current_member
@current_site ||= current_member.websites.where("websites.id = ?", params[:website_id]).try(:first)
else
@current_site ||= Website.find_by_app_id_and_app_key(request.headers['HTTP_APP_ID'], request.headers['HTTP_APP_KEY'])
end
In felu asta nu avem nevoie de before_filter deasupra si nici de metoda aia de am facut-o acum
subscriber = current_site.subscribers.find_by(email: params[:email]) | ||
error = current_site.issues.find_by(page_title: params[:page_title]) | ||
if subscriber | ||
subscriber = current_site.subscribers.create( email: params['email'], name: params['email'], website_id: current_site.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ai uitat sa stergi website_id
- also incremented occurences
No description provided.