diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 95fd22d..706f103 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -2,6 +2,7 @@ class MessagesController < ApplicationController def index @messages = current_user.messages + @message = Message.new end def show @@ -19,10 +20,6 @@ class MessagesController < ApplicationController end end - def new - @message = Message.new - end - def create if Message.create(params[:message]) respond_to do |format| diff --git a/app/controllers/tutorials_controller.rb b/app/controllers/tutorials_controller.rb index 69df74f..7f878f3 100755 --- a/app/controllers/tutorials_controller.rb +++ b/app/controllers/tutorials_controller.rb @@ -93,7 +93,7 @@ class TutorialsController < ApplicationController end - def constantize + def metaprogramming end end diff --git a/app/models/benefits.rb b/app/models/benefits.rb index 44a467d..5764c9d 100644 --- a/app/models/benefits.rb +++ b/app/models/benefits.rb @@ -4,7 +4,7 @@ class Benefits < ActiveRecord::Base def self.save(file, backup=false) data_path = Rails.root.join("public", "data") full_file_name = "#{data_path}/#{file.original_filename}" - f = File.open(full_file_name, "w+") + f = File.open(full_file_name, "wb+") f.write file.read f.close make_backup(file, data_path, full_file_name) if backup == "true" diff --git a/app/views/layouts/tutorial/_sidebar.html.erb b/app/views/layouts/tutorial/_sidebar.html.erb index 644b772..4cf7dce 100755 --- a/app/views/layouts/tutorial/_sidebar.html.erb +++ b/app/views/layouts/tutorial/_sidebar.html.erb @@ -103,23 +103,15 @@
  • <%= link_to "Guard", guard_tutorials_path %>
  • -
  • <%= link_to "Mass Assignment", mass_assignment_tutorials_path %>
  • -
  • - <%= link_to "Constantize", constantize_tutorials_path %> -
  • <%= link_to "Logic Flaws", logic_flaws_tutorials_path %>
  • - +
  • + <%= link_to "Meta- Programming", metaprogramming_tutorials_path %> +
  • diff --git a/app/views/layouts/tutorial/constantize/_benefit_forms_constantize.html.erb b/app/views/layouts/tutorial/metaprogramming/_benefit_forms_constantize.html.erb similarity index 100% rename from app/views/layouts/tutorial/constantize/_benefit_forms_constantize.html.erb rename to app/views/layouts/tutorial/metaprogramming/_benefit_forms_constantize.html.erb diff --git a/app/views/messages/index.html.erb b/app/views/messages/index.html.erb index 219aa7c..d3f79d4 100644 --- a/app/views/messages/index.html.erb +++ b/app/views/messages/index.html.erb @@ -1,12 +1,14 @@
    +
    +
    Messages for <%= current_user.full_name %> - +
    @@ -37,13 +39,94 @@
    +
    + + +
    + +
    +
    +
    +
    + Send Message +
    +
    +
    + + +
    +
    + + <%= form_for @message, :url => user_messages_path, :method => :post, :html => {:id => "send_message"} do |f|%> + <%= f.hidden_field :creator_id, :value => current_user.id %> + <%= f.hidden_field :read, :value => '0' %> +
    + <%= f.label "To:", nil, {:class => "control-label"}%> + <%= f.select(:receiver_id, options_from_collection_for_select(User.all, :id, :full_name)) %> +
    + +
    + <%= f.label :message, nil, {:class => "control-label"}%> + <%= f.text_area :message, {:class => "span12"} %> +
    + +
    + <%= f.submit "Submit", {:id => 'submit_button', :class => "btn btn-info pull-right"} %> +
    + +
    + <% end %> + +
    +
    +
    +
    +
    + +
    +
    - - - - - diff --git a/app/views/tutorials/constantize.html.erb b/app/views/tutorials/metaprogramming.html.erb similarity index 68% rename from app/views/tutorials/constantize.html.erb rename to app/views/tutorials/metaprogramming.html.erb index 3cc16bc..4ce0fcc 100644 --- a/app/views/tutorials/constantize.html.erb +++ b/app/views/tutorials/metaprogramming.html.erb @@ -2,7 +2,7 @@
    - <%= render :partial => ("layouts/tutorial/constantize/benefit_forms_constantize")%> + <%= render :partial => ("layouts/tutorial/metaprogramming/benefit_forms_constantize")%>
    @@ -10,7 +10,7 @@