railscasts

Rails 3 Nested Models unknown attribute Error

。_饼干妹妹 提交于 2019-11-30 14:48:38
I have a model "Issue" and a nested Model "Relationship" In the issue.rb I have mentioned: has_many :relationships, :dependent => :destroy accepts_nested_attributes_for :relationships, :allow_destroy => true In relationship.rb I have mentioned: belongs_to :issue Following Ryan Bates Railcast#196 I have the following in my issues_controller: relationship = @issue.relationships.build However, I am encountering an error "unknown attribute: relationship" Am I doing something incorrectly here? I do see the Relationships Attributes being passed to the server in the log however, this error does not

carrierwave - rails 3.1- undefined method: image_will_change

♀尐吖头ヾ 提交于 2019-11-30 05:42:15
I get an error that look like this: undefined method `post_image_will_change!' for #<Post:0xf4e9184> app/controllers/posts_controller.rb:43:in `new' app/controllers/posts_controller.rb:43:in `create' I've included this in my "post" model: attr_accessible :title, :name, :content, :post_image mount_uploader :post_image, PostImageUploader and in _form.html.erb I've added: :html => { :multipart => true } I looked CarrierWave Error but that doesn't help me. Any clues of what generates that error? I've migrated the database and so forth (followed the railscasts guide on carrierwave exactly..) The OP

How to set up the recipient id in public activity

人走茶凉 提交于 2019-11-30 04:53:57
问题 I am going over Public Activity Gem Railscast Vid. (http://railscasts.com/episodes/406-public-activity) My current DB looks/stores everything but the recipient_id....it shows up as nil #<PublicActivity::Activity id: 108, trackable_id: 133, trackable_type: "Relationship", owner_id: 1, owner_type: "User", key: "relationship.create", parameters: {}, recipient_id: nil, recipient_type: nil, created_at: "2013-06-16 07:37:28", updated_at: "2013-06-16 07:37:28"> I would like the recipient_id to be

Multi-step form in Rails 3 with Paperclip attachments

元气小坏坏 提交于 2019-11-29 13:49:53
I'm creating a multi-part form in the style that Ryan Bates describes here: http://railscasts.com/episodes/217-multistep-forms http://asciicasts.com/episodes/217-multistep-forms (text-based version) To summarize, I have one view (with a bunch of partials for each form step), and the form variables are stored in a session when the user clicks a next button and a different part of the form is displayed. One of my form steps allows the user to upload several images via the Paperclip gem. The problem with that is that Rails is trying to upload the image data to the session, which is returning

How to use private submit to hide from profile?

纵饮孤独 提交于 2019-11-29 12:47:44
When a User submits via private how can we hide the submitted info from the feed and from other users being able to see it on his public profile? <%= button_tag(type: 'submit', class: "btn") do %> ... <%= button_tag(type: 'submit', class: "btn", id: "2", name: 'private') do %> ... We put the below in the controller, but since the private button will be in a lot of different _forms, do I have to put it in each controller or can we put it in the application controller? if params[:private] # the private action / What do we need to put here? else # normal submit / and here? I followed this

Rails : Using jquery tokeninput (railscast #258) to create new entries

廉价感情. 提交于 2019-11-29 09:42:11
问题 I have successfully been able to implement the addition of new artist entries which was not included in Ryan Bates railscast #258 http://railscasts.com/episodes/258-token-fields So in other words, a user can enter an artist name which will autocomplete using jquery tokinput. However, I'd like the autocomplete results to only display the artist names which were created by that individual user. Does this make sense? An better and more understandable example would be for a collection.rb, where

Unpermitted parameters for Dynamic Forms in Rails 4

旧城冷巷雨未停 提交于 2019-11-29 05:15:00
I'm new to Rails and built something based on this http://railscasts.com/episodes/403-dynamic-forms but I have a problem with storing data in the additional fields... I have a ProductType object that has many ProductField objects. The ProductField object also belongs to a ProductType and Product object belongs to a ProductType. So,new dynamic fields can easily be added via the constructor ProductType, but when I try to set data in this fields via Product controller nothing happens. I am sure that problem is related to use strong parameters, but fix described here and here did't help. product

Multi-step form in Rails 3 with Paperclip attachments

房东的猫 提交于 2019-11-28 07:36:45
问题 I'm creating a multi-part form in the style that Ryan Bates describes here: http://railscasts.com/episodes/217-multistep-forms http://asciicasts.com/episodes/217-multistep-forms (text-based version) To summarize, I have one view (with a bunch of partials for each form step), and the form variables are stored in a session when the user clicks a next button and a different part of the form is displayed. One of my form steps allows the user to upload several images via the Paperclip gem. The

How to use private submit to hide from profile?

不打扰是莪最后的温柔 提交于 2019-11-28 06:11:28
问题 When a User submits via private how can we hide the submitted info from the feed and from other users being able to see it on his public profile? <%= button_tag(type: 'submit', class: "btn") do %> ... <%= button_tag(type: 'submit', class: "btn", id: "2", name: 'private') do %> ... We put the below in the controller, but since the private button will be in a lot of different _forms, do I have to put it in each controller or can we put it in the application controller? if params[:private] # the

OmniAuth & Facebook: certificate verify failed [duplicate]

我怕爱的太早我们不能终老 提交于 2019-11-26 17:05:12
This question already has an answer here: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed 37 answers I've followed Railscast #235 to try and set up a minimal Facebook authentication. I've first set up a Twitter authentication, as done by Ryan himself. That worked flawlessly. I then moved on to adding a Facebook login. However, after authorizing the app the redirect to /auth/facebook/callback fails with: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed I am working on localhost. I didn't set up any