RailsCasts Pro episodes are now free!

Learn more or hide this

Benjamin's Profile

GitHub User: benjaminsigidi

Site: http://www.sigididesign.com

Comments by Benjamin

Avatar

I think you want to do this

ruby
    def destroy
      @comment = Comment.find(params[:id])
      @commentable = @comment.commentable
        if @comment.destroy
          respond_to do |format|
            format.html { redirect_to @commentable, notice: "Comment deleted."  }
          end
        end
     end
     

I might be wrong.

Avatar

Maybe the walk through videos should be free.

Avatar

I like what you did here. This was bothering me too

Avatar

Nice, trying it out right away. Since im the first one here, i might be lucky and get a response. :)

I have disabled mass assignment on my shopping cart because i am using this

ruby
def purchase
  response = GATEWAY.purchase(price_in_cents, credit_card, purchase_options)
  transactions.create!(:action => "purchase", :amount => price_in_cents, :response => response)
   cart.update_attributes(:purchased_at, Time.now) if response.success?
  response.success?
end 

I get a complaint about purchase, price_in_cents and response not mass assigned, i ended up disabling it after many attempts but obviously running Brakeman brings back the issues. How can i add these to my attr_accessible?

Avatar

If you start psql using this command

'pg_ctl -D /usr/local/var/postgres -l logfile start'

You will be able to run the RVM version just installed. Not sure if this is correct but just worked for me

Avatar

@Sergey Averyanov Do you know what they say about guys who claim to have big guns?

Avatar

Nice. i like the vote up thingy..... Just out of curiosity how come you are not precompiling your assets for better performance?

Avatar

+1, thanks Ryan Bates. This is awesome

Avatar

I like your approach. Thanks for sharing.

Avatar

Thanks for this. Helped me out on Rails 3.1

Avatar

I am trying this example on Rails 3.1 and i get an error

< %= render @message.parent if @message.parent % >

Missing partial messages/message with {:handlers=>[:erb, :builder, :coffee], :formats=>[:html], :locale=>[:en, :en]}. Searched in:

Can someone help?

Avatar

Interesting, i was appending a class instead on an id and that was causing the problem. I didn't think this mattered at all. Strange.

Avatar

I tried this for some reason. my index.js.erb is not being listened to but i see it on my terminal " Processing by BusinessesController#index as HTML" .

All the products (businesses) are being loaded at once. I am not sure what i'm missing, any ideas?

Avatar

pulpo did you figure out how to fix this on your local machine using mysql?

Avatar

I take it back, i figured it out.

Avatar

Thanks Ryan, i have been looking for this. You are the best. How can one use this with tinymce or allow some HTML?

Avatar

Thanks for this, it also works perfect in Rails 3.1

Avatar

Thanks Jakub, i was stuck and you came through for me.

Avatar

Thanks Ryan for this. I had tried the gem before you release this tut and i love it straight off. I have a little problem, maybe you have the answer. How do i add a different role? like user. I have tried following the device way. rails generate devise:views users but it doesn't seem to work. Any ideas?