Search Results

Search found 58 results on 3 pages for 'railscasts'.

Page 1/3 | 1 2 3  | Next Page >

  • Is there a Railscasts for Django?

    - by J McConnell
    I learned everything I know about Rails from Railscasts. Now I want to learn Django but I'm not finding any comprehensive tutorial resources like Railscasts. Does an equivalent not exist in the Django world? If so, is that because there is less to learn?

    Read the article

  • Nested Model Form p1 Railscasts example

    - by arzon
    Has anyone managed to make the example at http://railscasts.com/episodes/196-nested-model-form-part-1 work? When I followed through the sample, it never saves any question nor the answer to the database but it manages to create a new survey entry. I am using: Rails 2.3.5 ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] nifty-generators (0.4.0)

    Read the article

  • ruby, rails, railscasts example gone bad

    - by Sam
    If you saw the railscasts on nested forms this is the helper method to create links dynamically. However, after I upgraded to ruby 1.9.2 and rails 3 this doesn't work and I have now idea why. def link_to_add_fields(name, f, association) new_object = f.object.class.reflect_on_association(association).klass.new fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| render(association.to_s.singularize + "_fields", :f => builder) end link_to_function(name, h("add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")")) end here is the javascript function add_fields(link, association, content) { var new_id = new Date().getTime(); var regexp = new RegExp("new_" + association, "g") $(link).up().insert({ before: content.replace(regexp, new_id) }); }

    Read the article

  • ruby, rails, railscasts example I messed up

    - by Sam
    If you saw the railscasts on nested forms this is the helper method to create links dynamically. However, after I upgraded to ruby 1.9.2 and rails 3 this doesn't work and I have now idea why. def link_to_add_fields(name, f, association) new_object = f.object.class.reflect_on_association(association).klass.new fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| render(association.to_s.singularize + "_fields", :f => builder) end link_to_function(name, h("add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")")) end here is the javascript function add_fields(link, association, content) { var new_id = new Date().getTime(); var regexp = new RegExp("new_" + association, "g") $(link).up().insert({ before: content.replace(regexp, new_id) }); } When I view source this is how the link is getting rendered: <p><a href="#" onclick="add_fields(this, &quot;dimensions&quot;, &quot;&quot;); return false;">Add Dimension</a></p> so &quot;&quot; is not the correct information to build a new template and something is going on with how the string for fields is getting set. such as fields= f.fields_for

    Read the article

  • Problem with Railscast #197 - Nested Model Form Part 2

    - by sscirrus
    I'm trying to implement Ryan's Railscast #197 in a system with Questions, Answers, and (multiple choice) Options. http://railscasts.com/episodes/197-nested-model-form-part-2. I have successfully implemented the nesting among these forms/partials. The simpler 'check box' way to delete records works properly. The problem occurs when I try to add/delete records. I have copied the code exactly as it appears in his Railscast: #new.html.erb <%= javascript_include_tag :defaults, :cache => true %> <% f.fields_for :in_options do |builder| %> <%= render "option_fields", :f => builder %> <% end %> #_option_fields.html.erb partial <%= f.hidden_field :_destroy %> <%= link_to_function "remove", "remove_fields(this)" %> #application_helper.rb (exact same as #197) def link_to_remove_fields(name, f) f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)") end def link_to_add_fields(name, f, association) new_object = f.object.class.reflect_on_association(association).klass.new fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| render(association.to_s.singularize + "_fields", :f => builder) end link_to_function(name, h("add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")")) end #application.js (exact same as #197. I have an Event.addbehavior below this code.) function remove_fields(link) { $(link).previous("input[type=hidden]").value = "1"; $(link).up(".fields").hide(); } function add_fields(link, association, content) { var new_id = new Date().getTime(); var regexp = new RegExp("new_" + association, "g") $(link).up().insert({ before: content.replace(regexp, new_id) }); } 2 problems: When I click on the 'remove' link it doesn't remove - it just shifts the page up or down. When I include link_to_add_fields "Add Answer", f, :answers, I get undefined method `klass' for nil:NilClass. Thanks everyone.

    Read the article

  • Dynamic select menu Rails, Javascript HABTM

    - by Jack
    Hi, I am following a tutorial in one of Ryan Bates' Railscasts here. Basically I want a form where there are 2 drop down menus, the contents of one are dependent on the other. I have Years and Courses, where Years HABMT Courses and Courses HABTM Years. In the tutorial, the javascript is as follows: var states = new Array(); <% for state in @states -%> states.push(new Array(<%= state.country_id %>, '<%=h state.name %>', <%= state.id %>)); <% end -%> function countrySelected() { country_id = $('person_country_id').getValue(); options = $('person_state_id').options; options.length = 1; states.each(function(state) { if (state[0] == country_id) { options[options.length] = new Option(state[1], state[2]); } }); if (options.length == 1) { $('state_field').hide(); } else { $('state_field').show(); } } document.observe('dom:loaded', function() { countrySelected(); $('person_country_id').observe('change', countrySelected); }); Where I guess country has many states and state belongs to country. I think what I need to do is edit the first for statement to somehow loop through all of the courses for each year_id, but don't know how to do this. Any ideas? Thanks

    Read the article

  • Problem in Rail Casts Episode 190

    - by Gautam
    Hello, This is the code I have written require 'rubygems' require 'nokogiri' require 'open-uri' url = "http://timesofindia.indiatimes.com/rssfeeds/-2128838597.cms" doc = Nokogiri::HTML(open(url)) puts doc.at_css("title").text and I am getting this output. I have installed Nokogiri. I use Windows 7 C:\Ruby>ruby hello.rb C:/Ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.2-x86-mingw32/lib/nokogiri/nokogiri.rb:1:in `require': 127: The specified procedure could not be found. - Init_nokogiri (LoadError) C:/Ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.2-x86-mingw32/lib/nokogiri/1.9/nokogiri.so from C:/Ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.2-x86-mingw32/lib/nokogiri/nokogiri.rb:1:in `<top (required)>' from C:/Ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.2-x86-mingw32/lib/nokogiri.rb:13:in `require' from C:/Ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.2-x86-mingw32/lib/nokogiri.rb:13:in `<top (required)>' from hello.rb:2:in `require' from hello.rb:2:in `<main>'

    Read the article

  • What does this code do?

    - by Senthil
    I found this in Ryan Bates' railscast site, but not sure how it works. #models/comment.rb def req=(request) self.user_ip = request.remote_ip self.user_agent = request.env['HTTP_USER_AGENT'] self.referrer = request.env['HTTP_REFERER'] end #blogs_controller.rb def create @blog = Blog.new(params[:blog]) @blog.req = request if @blog.save ... I can sort of understand what he is doing. But am confused with the req=(request) line. Any help is appreciated. Thanks

    Read the article

  • Please explain this Rails method to me like I'm a little kid.

    - by Senthil
    I found this in Ryan Bates' railscast site, but not sure how it works. #models/comment.rb def req=(request) self.user_ip = request.remote_ip self.user_agent = request.env['HTTP_USER_AGENT'] self.referrer = request.env['HTTP_REFERER'] end #blogs_controller.rb def create @blog = Blog.new(params[:blog]) @blog.req = request if @blog.save ... I see he is saving the user ip, user agent and referrer, but am confused with the req=(request) line. Any help is appreciated. Thanks

    Read the article

  • How to show an animated spinner while a background task is processing in nested rails model using aj

    - by Globalkeith
    My specific example is highly complex, so I will use the example shown by Ryan from Railscasts to discuss this: http://railscasts.com/episodes/197-nested-model-form-part-2 Background I have a form, let's say "Survey", which contains an arbitrary number of "Questions". Senario Give i am on the "Edit Survey" page. I would like to add a button to each "Question" field which calls a remote_function, which in turn queue's up a delayed_job to execute some processing on the "Question". To give feedback to the user, i would like to disable the button, and show an animated spinner, which remains until the delayed_job has processed the "Question". Hint - I can add methods to the "Question" model to indicate the status of the delayed_job. So, with best practices in mind, what is the best way to achieve this?

    Read the article

  • What good technology/programming vodcasts are out there?

    - by Sam Saffron
    I'm trying to round up a list of programming/technology related Vodcasts. Related Question: What good technology podcasts are out there? Here I am looking for podcasts which include Video content like: dnr tv : http://www.dnrtv.com/ Channel 9 : http://channel9.msdn.com/ Dimecasts : http://dimecasts.net/ Railscasts : http://railscasts.com/ Zendcasts : http://www.zendcasts.com/ Net Tuts : http://net.tutsplus.com/category/videos/screencasts/ Feel free to edit this post, and improve the list. (with perhaps university lectures in RSS formats etc etc... ) For the voting to have even a slight amount of meaning please include only one vodcast per post. If this is a dupe, let me know and ill delete it.

    Read the article

  • any idea not to select the name that is already choosen in token input?

    - by regmiprem
    Is there any idea not to select the name that is already choosen in token input? for example In first i select mango when i search for m. Next time again when i search for m Mango should not be displayed as mango is already choosen. Is there any idea? <%= f.text_field :plan_tokens, data: {load: @customer.plans} %> I study this from I have my js like this jQuery - $('#customer_plan_tokens').tokenInput '/plans.json' theme: 'facebook' prePopulate: $('#customer_plan_tokens').data('load') where to put preventDuplicates:true. I did try but error arise! http://railscasts.com/episodes/258-token-fields http://railscasts.com/episodes/258-token-fields-revised

    Read the article

  • SSL on nginx + unicorn got "Error 102 (net::ERR_CONNECTION_REFUSED)"

    - by panggi
    I tried to deploy my app on EC2 (opened port: 22, 80, 443) App: Rails 3.2.2 Server: nginx 1.2.1 unicorn gem (latest) ubuntu 12.04 Deployer: Capistrano I tried to follow the instruction in Railscasts : http://railscasts.com/episodes/335-deploying-to-a-vps (Sorry, it's a Pro Episode) Anything fine with normal port 80 http but i got Error 102 after trying to use SSL, here is the nginx.conf content: upstream unicorn { server unix:/tmp/unicorn.frontend.sock fail_timeout=0; } server { server_name beta.sukeru.com; listen 443 default; root /home/deployer/apps/appname/current/public; ssl on; ssl_certificate server.crt; ssl_certificate_key server.key; ssl_session_timeout 5m; ssl_protocols SSLv2 SSLv3 TLSv1; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; location / { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; proxy_redirect off; proxy_pass http://unicorn; } error_page 500 502 503 504 /500.html; } In production.rb i set: config.force_ssl = true Can anyone give a solution for this? :)

    Read the article

  • How to add and remove nested model fields dynamically using Haml and Formtastic

    - by Brightbyte8
    We've all seen the brilliant complex forms railscast where Ryan Bates explains how to dynamically add or remove nested objects within the parent object form using Javascript. Has anyone got any ideas about how these methods need to be modified so as to work with Haml Formtastic? To add some context here's a simplified version of the problem I'm currently facing: # Teacher form (which has nested subject forms) [from my application] - semantic_form_for(@teacher) do |form| - form.inputs do = form.input :first_name = form.input :surname = form.input :city = render 'subject_fields', :form => form = link_to_add_fields "Add Subject", form, :subjects # Individual Subject form partial [from my application] - form.fields_for :subjects do |ff| #subject_field = ff.input :name = ff.input :exam = ff.input :level = ff.hidden_field :_destroy = link_to_remove_fields "Remove Subject", ff # Application Helper (straight from Railscasts) def link_to_remove_fields(name, f) f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)") end def link_to_add_fields(name, f, association) new_object = f.object.class.reflect_on_association(association).klass.new fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| render(association.to_s.singularize + "_fields", :f => builder) end link_to_function(name, h("add_fields(this, \"#{association}\", \"#{escape_javascript(fields)} \")")) end #Application.js (straight from Railscasts) function remove_fields(link) { $(link).previous("input[type=hidden]").value = "1"; $(link).up(".fields").hide(); } function add_fields(link, association, content) { var new_id = new Date().getTime(); var regexp = new RegExp("new_" + association, "g") $(link).up().insert({ before: content.replace(regexp, new_id) }); } The problem with implementation seems to be with the javascript methods - the DOM tree of a Formtastic form differs greatly from a regular rails form. I've seen this question asked online a few times but haven't come across an answer yet - now you know that help will be appreciated by more than just me! Jack

    Read the article

  • How to get correct children ids using fields_for "parents[]", parent do |f| using f.fields_for :children, child ?

    - by Anatortoise House
    I'm editing multiple instances of a parent model in an index view in one form, as in Railscasts #198. Each parent has_many :children and accepts_nested_attributes_for :children, as in Railscasts #196 and #197 <%= form_tag %> <% for parent in @parents %> <%= fields_for "parents[]", parent do |f| <%= f.text_field :job %> <%= f.fields_for :children do |cf| %> <% cf.text_field :chore %> <% end %> <% end %> <% end %> <% end %> Given parent.id==1 f.text_field :job correctly generates <input id="parents_1_job" type="text" value="coding" size="30" name="parents[1][job]"> But cf.text_field :chore generates ids and names that don't have the parent index. id="parents_children_attributes_0_chore" name="parents[children_attributes][0][chore]" If I try passing the specific child object to f.fields_for like this: <% for child in parent.children %> <%= f.fields_for :children, child do |cf| %> <%= cf.text_field :chore %> <% end %> <% end %> I get the same. If I change the method from :children to "[]children" I get id="parents_1___children_chore" which gets the right parent_index but doesn't provide an array slot for the child index. "[]children[]" isn't right either: id="parents_1__children_3_chore" as I was expecting attributes_0_chore instead of 3_chore. Do I need to directly modify an attribute of the FormBuilder object, or subclass FormBuilder to make this work, or is there a syntax that fits this situation? Thanks for any thoughts.

    Read the article

  • Ruby on Rails resources

    - by andrewpthorp
    I was hoping I could find some good ruby on rails reading/resources. Please note, I currently am aware of the following: Pragmatic Bookshelf (Exceptional Ruby, Agile web development with rails, etc) Addison Wesley (Rails AntiPatterns, The Rails 3 Way, etc) freenode #rubyonrails RSS Feeds (thoughtbot, pivotal blabs) railscasts I am looking for any other good resources. What are the best RSS feeds? What are the best books? Blogs? Videos? Any information you can share would be great!

    Read the article

  • Rails - embedded polymorphic comment list + add comment form - example?

    - by odigity
    Hey, all. Working on my first Rails app. I've searched all around - read a bunch of tutorials, articles, and forum posts, watched some screencasts, and I've found a few examples that come close to what I'm trying to do (notably http://railscasts.com/episodes/154-polymorphic-association and ep 196 about nested model forms), but not exactly. I have two models (Podcast and BlogPost) that need to be commentable, and I have a Comment model that is polymorphically related to both. The railscasts above had a very similar example (ep 154), but Ryan used a full set of nested routes, so there were specific templates for adding and editing comments. What I want to do is show the list of comments right on the Podcast or BlogPost page, along with an Add Comment form at the bottom. I don't need a separate add template/route, and I don't need the ability to edit, only delete. This is a pretty common design on the web, but I can't find a Rails example specifically about this pattern. Here's my current understanding: I need routes for the create and delete actions, of course, but there are no templates associated with those. I'm also guessing that the right approach is to create a partial that can be included at the bottom of both the Podcast and BlogPost show template. The logical name for the partial seems to me to be something like _comments.html.haml. I know it's a common convention to have the object passed to the partial be named after the template, but calling the object 'comments' seems to not match my use case, since what I really need to pass is the commentable object (Podcast or BlogPost). So, I guess I'd use the locals option for the render partial call? (:commentable = @podcast). Inside the partial, I could call commentable.comments to get the comments collection, render that with a second partial (this time with the conventional use case, calling the partial _comment.html.haml), then create a form that submits to... what? REST-wise, it should be a POST to the collection, which would be /podcast|blogpost/:id/comments, and I think the helper for that is podcast_comments_path(podcast) if it were a podcast - not sure what to do though, since I'm using polymorphic comments. That would trigger the Comment.create action, which would then need to redirect back to the podcast|blogpost path /podcast|blogpost/:id. It's all a bit overwhelming, which is why I was really hoping to find a screencast or example that specifically implements this design.

    Read the article

  • NoMethodError for time_zone_select in a form

    - by Jack
    I've set up my app exactly in line with the Railscasts Time Zone Episode 1 but when I run <%= f.time_zone_select :time_zone, ActiveSupport::TimeZone.us_zones %> I get this error NoMethodError in Users#new Showing app/views/users/new.html.erb where line #27 raised: You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.<= With line 27 being the aforementioned line. I am really stuck on this...

    Read the article

  • What does "render @collection" do?

    - by ryeguy
    I'm trying to learn Rails better by looking at example applications, and while looking at this line of the source of railscasts.com, I noticed it does this: <div class="episodes"> <%= render @episodes %> </div> What exactly is going on here? Why isn't this documented on the render function? Or is it?

    Read the article

  • Authlogic_OpenID - "uninitialized constant Rack::OpenID"

    - by Micah Alcorn
    So I followed the railscast tutorial (http://railscasts.com/episodes/170-openid-with-authlogic) and used the old version of the plugin from Ryan's git file. I can now successfuly create/register a user using OpenID (Google), but I cannot log in with this user. When I submit the OpenID that has been registered, I get "uninitialized constant Rack::OpenID". Any ideas? Thanks!

    Read the article

  • Rails OpenID Authentication Plugin No Longer Installs Rake Tasks?

    - by Rich Apodaca
    I'm following the Railscasts tutorial on using OpenID with AuthLogic. This command: $ script/plugin install git://github.com/rails/open_id_authentication.git installs the plugin, but I don't see any OpenID Rake tasks (rake -T). In particular, I can no longer run the task: $ rake open_id_authentication:db:create With previous applications, the Rake tasks were installed without a problem, so what's changed with the plugin? Which version of the plugin do I need to get the behavior I'm looking for? Using Rails 2.3.5.

    Read the article

  • Active record NEW causing a warning

    - by Jon
    I got this snippet of controller code from Railscast 193, functionally its all working, but i am getting a warning message. http://railscasts.com/episodes/193-tableless-model @search = Search.new(:text => params[:search]) getting warning: /Users/Server/.gem/ruby/1.8/gems/activerecord-2.3.4/lib/active_record/named_scope.rb:13: warning: multiple values for a block parameter (0 for 1) from /Users/Server/.gem/ruby/1.8/gems/activerecord-2.3.4/lib/active_record/named_scope.rb:92 Any ideas why i am getting the warning? thanks

    Read the article

  • Test priorities on delayed_job plugin in rails.

    - by bartligthart
    I want to test how priorities are working in the delayed_job plugin. Im using the mailit app from railscasts. I think i want to send 100 messages with a high priority and 100 with a lower priority. And i want to see if the messages with a lower priority will be delivered on time or they will be put aside. How can i do a test like this.

    Read the article

  • undefined local variable or method `user', using CarrierWave for profile images

    - by Amar H-V
    I've been following Ryan Bates' Railscasts tutorial on CarrierWave, which you can find here Everything works fine, except for when I go to view my profile, it gives me this error: undefined local variable or method `user' I don't know why it is telling me this, as I am using Devise for my authentication, and that is the name of my model. Below are some of the files which may be useful: https://gist.github.com/amarh21/7439421 I am using Rails 4.0.1 and ruby 2.0.0

    Read the article

1 2 3  | Next Page >