Menu
  • HOME
  • TAGS

Calling a class method through an object instance

ruby-on-rails,ruby,railscasts,class-method

This works because scopes of ActiveRecord relations are merged. It's not that find_incomplete is running on individual task instances. @project.tasks creates an ActiveRecord scope of the tasks for that project instance and then that scope is still in effect when your find_incomplete method is called. Take a look at the...

Private messages with Faye and Rails

ruby,ruby-on-rails-4,messaging,faye,railscasts

I solved it! The problem was that I had the subscribe function in application.js meaning it would run the subscribe javascript on each page. Instead what I did is at the bottom of the chat page view i subscribed to /messages/eve/adam. This is how I did that: <script> $(function(){ var...

Generating dynamic child rows in Rails partial

ruby-on-rails,nested-attributes,railscasts,ruby-on-rails-4.2

I wound up solving this with jQuery. Not super elegant but very effective. Basically, I just added a click handler for the + icons which built the new row and inserted it where needed (basically just hacked out the jQuery necessary to replicate the HTML produced by Rails). In case...

How to Get Tags Linkable?

sql,ruby-on-rails,syntax-error,acts-as-taggable-on,railscasts

I think the problem is twofold. The token "values" is a reserved word in standard SQL. As insert into table_name values (...);. You use it without double quotes, which are required in standard SQL for reserved words used as identifiers. (Better not to use reserved words that way, but still...

Hartl Tutorial + Omniauth: Log In not Logging In

ruby-on-rails,ruby,facebook,railstutorial.org,railscasts

This same error gave me a headache once. Check if the email you use for facebook is already in your database. If it's there then delete it and it should work.