Permalink
Browse files

Add default types

  • Loading branch information...
rociopaez committed Aug 27, 2014
1 parent 8af973e commit f34688638e3a874633a174e479f2ebea823561c0
Showing with 41 additions and 72 deletions.
  1. +3 −0 app.rb
  2. +26 −0 config/default_types.yml
  3. +5 −1 routes/guests.rb
  4. +7 −71 views/profile/show.mote
3 app.rb
@@ -5,6 +5,9 @@
require "ohm"
require "scrivener"
require "shield"
require "yaml"

DEFAULT_TYPES = YAML.load_file("./config/default_types.yml")

Ohm.redis = Redic.new("redis://127.0.0.1:6379")

@@ -0,0 +1,26 @@
- category: "Food"
name: "Chesse"
- category: "Food"
name: "Chocolate"
- category: "Food"
name: "Skip dinner"
- category: "Drink"
name: "Cofee"
- category: "Drink"
name: "Soda"
- category: "Drink"
name: "Acoholic beverages"
- category: "Symptoms"
name: "Nausea or vomiting"
- category: "Symptoms"
name: "Sensitive to light, noise, smell"
- category: "Body Changes"
name: "Mentruation or Skip menstruation"
- category: "Body Changes"
name: "Stress"
- category: "Medication"
name: "Ergotamin"
- category: "Medication"
name: "Exedrin"
- category: "Medication"
name: "Aspirin"
@@ -27,13 +27,17 @@ class Guests < Cuba
on sign_up.valid? do
user = User.create(sign_up.slice(:name, :email, :password))

authenticate(user)
DEFAULT_TYPES.each do |type_attributes|
Type.create(category: type_attributes["category"], name: type_attributes["name"], user_id: user.id)
end

text = Mailer.render("welcome", user: user)

Malone.deliver(from: "info@migraine.io", to: user.email,
subject: "Welcome to Migraine App", text: text)

authenticate(user)

res.redirect("/dashboard")
end

@@ -34,77 +34,13 @@
</tr>
</thead>
<tbody>
<tr>
<td>Food</td>
<td>Chocolates</td>
<td class="action"><a href="###">Edit</a> - <a href="###">Delete</a></td>
</tr>
<tr>
<td>Food</td>
<td>Cheese</td>
<td class="action"><a href="###">Edit</a> - <a href="###">Delete</a></td>
</tr>
<tr>
<tr>
<td>Food</td>
<td>Skip dinner</td>
<td class="action"><a href="###">Edit</a> - <a href="###">Delete</a></td>
</tr>
<tr>
<tr>
<td>Drink</td>
<td>Cofee</td>
<td class="action"><a href="###">Edit</a> - <a href="###">Delete</a></td>
</tr>
<tr>
<td>Drink</td>
<td>Soda</td>
<td class="action"><a href="###">Edit</a> - <a href="###">Delete</a></td>
</tr>
<td>Drink</td>
<td>Alcoholic beverages</td>
<td class="action"><a href="###">Edit</a> - <a href="###">Delete</a></td>
</tr>
<tr>
<td>Symptoms</td>
<td>Nausea or vomiting</td>
<td class="action"><a href="###">Edit</a> - <a href="###">Delete</a></td>
</tr>
<tr>
<td>Symptoms</td>
<td>Sensitive to light, noise, smell</td>
<td class="action"><a href="###">Edit</a> - <a href="###">Delete</a></td>
</tr>
<tr>
<td>Body Changes</td>
<td>Menstruation or Skip menstruation</td>
<td class="action"><a href="###">Edit</a> - <a href="###">Delete</a></td>
</tr>
<tr>
<td>Body Changes</td>
<td>Stress</td>
<td class="action"><a href="###">Edit</a> - <a href="###">Delete</a></td>
</tr>
<tr>
<td>Exposed</td>
<td>Perfume or fragances</td>
<td class="action"><a href="###">Edit</a> - <a href="###">Delete</a></td>
</tr>
<tr>
<td>Medication</td>
<td>Ergotamin</td>
<td class="action"><a href="###">Edit</a> - <a href="###">Delete</a></td>
</tr>
<tr>
<td>Medication</td>
<td>Aspirin</td>
<td class="action"><a href="###">Edit</a> - <a href="###">Delete</a></td>
</tr>
<tr>
<td>Medication</td>
<td>Exedrin</td>
<td class="action"><a href="###">Edit</a> - <a href="###">Delete</a></td>
</tr>
% params[:current_user].types.each do |type|
<tr>
<td>{{type.category}}</td>
<td>{{type.name}}</td>
<td class="action"><a href="###">Edit</a> - <a href="###">Delete</a></td>
</tr>
% end
</tbody>
</table>
</div>

0 comments on commit f346886

Please sign in to comment.