RicePad

Joined

100 Experience
0 Lessons Completed
0 Questions Solved

Activity

I've been playing around and trying to implement a chat such as slack as shown on Chris's screencast. On Chatroom index I'm able to Show, Edit, Join, and Leave. However, when I clicked on Show even though it redirects me to the right chatroom I'm not able to send messages in real time because I haven't clicked on "joined" prior to entering the chatroom as a member. Is there a way to join the room while I'm already on the chatroom.

/views/chatrooms/show.html.erb

            *** <td><%= link_to "Join", chatroom_chatroom_users_path(@chatroom), method: :post %></td>***

            <p>
                <strong>Welcome to my chatroom:</strong>
                <%= @chatroom.name %>
            </p>

            <div data-behavior='messages' data-chatroom-id='<%= @chatroom.id %>'>
                <% @messages.each do |message| %>
                    <%= render message %>
                <% end %>
            </div>


            <%= form_for [@chatroom, Message.new] do |f| %>
                <%= f.text_area :body, rows: 1, class: "form-control", autofocus: true %>
            <% end %>

I've added *** <%= link_to "Join", chatroom_chatroom_users_path(@chatroom), method: :post %>*** on chatroom's show page to join. pic: ![http://prntscr.com/hj0egi] !

but it crashes giving me this error:![http://prntscr.com/hj0dfs]

Hi all, I'm new to this community and also new to Ruby on Rails. I recently watched the Braintree integration screencast by Chris and I've been playing around with its Sand box integration.

I was able to make a successful check out with a hard coded amount i.e:

        def checkout
            nonce = params[:payment_method_nonce]
            result = Braintree::Transaction.sale(
             ** :amount => "15.00",**
            :payment_method_nonce => nonce,
            :options => {
            :submit_for_settlement => true} )
     end

Let's say I want a current_user to be able to purchase access to my portofolio for a specific "price" which has been stored in the database. Is there a way to set the amount by pulling it from an a object's attributes from the database i.e: "<=@portofolio_item.price>" ?? I've tried multiple attempts and didn't have any luck. I feel like I'm not understanding how Braintree really works.