Sidequestion: Is it better to load modules into my models? I currently use abstract models for most things (which, however, loads modules itself). But I runned into problems as the self.abstract_class = true gotcha seems to be not widely known...
I've spent hours trying to get Chosen to work and have posted question on Stackoverflow with no luck--including necessary lines in application.js, application.css, and adding the appropriate coffeescript. I'm using Bootstrap and think that may be getting in the way. Are there any css directories I should be clearing out? Thanks!
I have a problem with will_paginate and sortable links. Since they are relative link, once I've update my partial after an edit or delete action the link includes the item ID like http://url/id?page=2 instead of http://url?page=2.
Hi, I had the same problem. I deleted the bootstrap.js.coffee and it made my Bootstrap features unavailable. I tried to include the the "twitter/bootstrap" before the "bootstrap" and the following error occured "couldn't find file 'twitter/bootstrap'". Do you know what that can be about?
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?
Your user "deployer" has all the lovely rbenv PATH stuff in place and working.
If that is all working, I posted an answer to your SO question that might help that involves changing the way you specify what user the start command runs as.
Hope that helps.
Oh, also su to your "deployer" user and run the magical "rbenv rehash" command? Dunno, just a thought.
I find that "reload!" is extremely useful in the rails console when doing development; it reloads your environment, so it should pick up any changes you make to your source files.
Don't make the mistake of setting tweet_id's type to an integer. MySQL maxes out at 2147483647 unless you specify a limit. It's easier to just make it a string.
Installing libv8 (3.3.10.4) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
d:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=d:/RailsInstaller/Ruby1.9.3/bin/ruby
Checking for Python...Unable to build libv8: Python not found!
It appears that this was an issue with console.log, which I now realize wasn't intended to be in the final version of the code. When IE's "F12 Developer Tools" feature was enabled, the dynamic select menus worked as intended. I removed both instances of console.log from the coffeescript file and the issue is gone, with and without F12 Developer Tools enabled. Gotcha on me.
After, pulling my hair for a few hours, this is how I am testing it:
ruby
it 'does not creates a new subscription if stripe fails to create a token'do
exception = Stripe::InvalidRequestError.new("",{})
Stripe::Customer.should_receive(:create).and_raise(exception)
expect {
post :create, subscription: valid_attributes
}.to change(Subscription, :count).by(0)
end
The tricky part was creating the exception, I had to take a look at this
I am going to respond to your comment assuming that you are a true beginner. If I am saying something you already know or find the tone of my response offensive then I am sorry, I am only trying to help.
Before I continue to answer your comment I ask you to please not type messages in all-capitals, it appears as if you are shouting and comes across quite rude. Also saying things like "you must help me or I will go insane" doesn't inspire others to help you out, its more likely that you'll get ignored. No matter how desperate you are, if you want someone's help the best thing to do is to be polite and clearly explain your problem and adding as much relevant information as possible. You will find that this applies to communications on most tech resources (mailing lists, forums, etc.)
Now on to your problems:
I'm afraid you made a beginner's mistake, running rake db:setup will setup a fresh database, so that's what happened (that's a standard rake task in Rails). If you ran that command on your production environment the only thing you can do is restore your latest database backup. If you don't have a backup there's really nothing that can be done.
As for the template missing error, its hard to say without knowing your codebase. If you've been editing code on your production system (which you really shouldn't be doing, development should be done on in its own place, for example on your own machine) you will have to debug the error and fix it.
I hope that my reply gives you some insight into your problems.
How did you expose your events to Fullcalendar? did you pass the json with gon or as an array? I have my events passed with gon sitting in window.gon but I have no idea how to set it into events:[
Great Railcast. There seems to be a problem rendering the nested model fields when implementing this solution with models that have a one-to-one association. One-to-many associations show nested model fields fine, but not one-to-one.
I followed your instructions and after i started 'rake db:setup ' MY WHOLE WEBSITE BROKES APART!!! WHAT THE HELL HAPPENEND??? I CANT EVEN SIGN IN OR UP TO ME WEBSITE AND I GET "TEMPLATE IS MISSING" AND WHEN I LOOK IN PGADMIN ALL COLUMNS ARE GONE. YOU HAVE TO HELP ME OR I WILL GO INSANE I SWEAR
Great screencast. I really like ImageMagick, here are some great examples of some stuff you can do if you're new to the library: http://imagemagick.org/Usage/
Guys, I ran into an issue with Monit + Resque + rbenv setup. My Resque workers fail to start with Monit saying rbenv: not found, but the same command works fine if I run it directly in console under user deployer. Have someone managed to set up monit to monitor Resque workers? Any ideas?
faqs_for_user = params[:faq].map{|x| x.to_i} & current_user.faq_id_list
faqs_for_user.each_with_index do |id, index|
The faq_id_list returns a list of id's that are allowed to be sorted. The procedure relies on the fact that the array intersection function returns items in the same order as the first parameter. (gulp)
If anyone has anything better here, would be good to see it.
Anyone done anything with this & update_all where the items being sorted have a user_id parent. As it is, a Post with a random set of Faq's could resort regardless of who the parent user_id is.
I set the position to Time.now.to_i as a default. You don't need to know a max position or reference the database to place it at the bottom of the list.
I initial had some trouble implementing this together with Mongoid. It turned out that the problem was in the mongoid.yml configuration file. When I changed
host: localhost
to
host: 0.0.0.0
Everything worked properly. I guess this is because having a proxy server messes with the meaning of localhost.
Sidequestion: Is it better to load modules into my models? I currently use abstract models for most things (which, however, loads modules itself). But I runned into problems as the
self.abstract_class = true
gotcha seems to be not widely known...I've spent hours trying to get Chosen to work and have posted question on Stackoverflow with no luck--including necessary lines in application.js, application.css, and adding the appropriate coffeescript. I'm using Bootstrap and think that may be getting in the way. Are there any css directories I should be clearing out? Thanks!
Hey guys,
I followed the tutorial precisely but I am getting an error such as this:
NoMethodError in SessionsController#create
Rails.root: /Users/raybesiga/Documents/Sites/foodie
Application Trace | Framework Trace | Full Trace
app/models/user.rb:29:in
from_omniauth'
create'app/controllers/sessions_controller.rb:3:in
However my user.rb file is as below:
and my sessions_controller.rb file is as follows:
Any idea why I get this error?
Love it!
I have a problem with will_paginate and sortable links. Since they are relative link, once I've update my partial after an edit or delete action the link includes the item ID like http://url/id?page=2 instead of http://url?page=2.
Can somebody help me solve it?
Hi, I had the same problem. I deleted the bootstrap.js.coffee and it made my Bootstrap features unavailable. I tried to include the the "twitter/bootstrap" before the "bootstrap" and the following error occured "couldn't find file 'twitter/bootstrap'". Do you know what that can be about?
Thanks!
Could you simply make an if statement around your stylesheet_link_tag?
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?
I solved this by adding bundle exec like:
bundle exec cap deploy:setup
Two things to make sure:
Hope that helps.
Oh, also su to your "deployer" user and run the magical "rbenv rehash" command? Dunno, just a thought.
I find that "reload!" is extremely useful in the rails console when doing development; it reloads your environment, so it should pick up any changes you make to your source files.
Don't make the mistake of setting tweet_id's type to an integer. MySQL maxes out at 2147483647 unless you specify a limit. It's easier to just make it a string.
Anyone know if it's possible to control which predicates are available to the user in the dropdown? I'd like to only let my users choose from a few.
I had this problem too. Before, my queries looked like:
to fix it:
There is known issue with Windows and Python https://github.com/cowboyd/libv8/issues/29
in case you are seeing this error:
Installing libv8 (3.3.10.4) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
d:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=d:/RailsInstaller/Ruby1.9.3/bin/ruby
Checking for Python...Unable to build libv8: Python not found!
It appears that this was an issue with
console.log
, which I now realize wasn't intended to be in the final version of the code. When IE's "F12 Developer Tools" feature was enabled, the dynamic select menus worked as intended. I removed both instances ofconsole.log
from the coffeescript file and the issue is gone, with and without F12 Developer Tools enabled. Gotcha on me.More on this here: http://stackoverflow.com/questions/11346091/i-e-craches-my-js-script-at-first-then-i-press-f12-and-it-works-beaultifully?lq=1
I'm getting a
failed: "sh -c 'cd /home/deployer/apps/angel_list_api_research/releases/20120827050009 && bundle install --gemfile /home/deployer/apps/angel_list_api_research/releases/20120827050009/Gemfile --path /home/deployer/apps/angel_list_api_research/shared/bundle --deployment --quiet --without development test'" on 198.58.96.39
Has anyone any idea what this is trying to tell me?
And the html...
This isn't working for me in Internet Explorer 9...Changing the first select menu doesn't do anything. The second select menu remains hidden.
Chrome on Windows, and Safari, Firefox, and Chrome on OS X work fine. Any gotchas that you've found?
That feature was released with active support 3.2. Try to update it!
When I try to start up my rails (oauth client) app after building my OAuth strategy (identical to Ryan's structurally), I get this error:
undefined method `uid' for OmniAuth::Strategies:Module
Anyone seen this error before? I'm having a hard time figuring out what I'm doing wrong.
If you add this to the model, then these items will no longer appear on your dropdown list.
However, if you remove exclude an item using the list above, it will no longer become sortable.
Hi, does anyone knows how to accomplish that routing process in Rails 2.3.X ?
Thank you.
Indeed, I had flashbacks to my programming languages class. By flashbacks, I mean shots of adrenaline and joy.
Hey guys i am getting this error:
any ideas?
this is at the cap deploy:cold step
I'm not sure if it's exactly the same thing, but what really saved me (for what I needed) was this https://github.com/moo-li/Simple-parent-child-forms-in-Rails-3.1
Great railcast anyways!
I'm not sure if it's exactly the same thing, but what really saved me (for what I needed) was this https://github.com/moo-li/Simple-parent-child-forms-in-Rails-3.1
Great railcast anyways!
Also http://www.youtube.com/watch?v=3ml88L39cng by Adrian Holovaty (django).
FYI - Excellent talk by DHH on PJAX.
After, pulling my hair for a few hours, this is how I am testing it:
The tricky part was creating the exception, I had to take a look at this
Hello everybody,
I need to remove all searches from my database every 10 minutes...
So this would be the path
http://nameofmysite.heroku.com/search/1
How would you write the right code to do it?
Thanks
add the following to the top of your config/deploy.rb
require "bundler/capistrano"
set :default_environment, {
'PATH' => "$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH"
}
Maybe I am over complicating this with gon? I can just render it directly with json and use the GET method in Fullcalendar?
http://stackoverflow.com/questions/12120414/ruined-database-through-rake-dbsetup-ror
I am going to respond to your comment assuming that you are a true beginner. If I am saying something you already know or find the tone of my response offensive then I am sorry, I am only trying to help.
Before I continue to answer your comment I ask you to please not type messages in all-capitals, it appears as if you are shouting and comes across quite rude. Also saying things like "you must help me or I will go insane" doesn't inspire others to help you out, its more likely that you'll get ignored. No matter how desperate you are, if you want someone's help the best thing to do is to be polite and clearly explain your problem and adding as much relevant information as possible. You will find that this applies to communications on most tech resources (mailing lists, forums, etc.)
Now on to your problems:
I'm afraid you made a beginner's mistake, running
rake db:setup
will setup a fresh database, so that's what happened (that's a standard rake task in Rails). If you ran that command on your production environment the only thing you can do is restore your latest database backup. If you don't have a backup there's really nothing that can be done.As for the template missing error, its hard to say without knowing your codebase. If you've been editing code on your production system (which you really shouldn't be doing, development should be done on in its own place, for example on your own machine) you will have to debug the error and fix it.
I hope that my reply gives you some insight into your problems.
How did you expose your events to Fullcalendar? did you pass the json with gon or as an array? I have my events passed with gon sitting in window.gon but I have no idea how to set it into events:[
Great Railcast. There seems to be a problem rendering the nested model fields when implementing this solution with models that have a one-to-one association. One-to-many associations show nested model fields fine, but not one-to-one.
OK, EHM how can i start:
im newb, but:
I followed your instructions and after i started 'rake db:setup ' MY WHOLE WEBSITE BROKES APART!!! WHAT THE HELL HAPPENEND??? I CANT EVEN SIGN IN OR UP TO ME WEBSITE AND I GET "TEMPLATE IS MISSING" AND WHEN I LOOK IN PGADMIN ALL COLUMNS ARE GONE. YOU HAVE TO HELP ME OR I WILL GO INSANE I SWEAR
I believe it's logically equivalent to this
a = a ? a : "something"
Which means:
set the value of a to, if there is an 'a', then a, otherwise set it to "something"
I ended up doing this, doesn't look elegant, but it works.
<%= form_tag projects_path, :method => 'get' do %>
you need an equal sign for rails 3
<%=
instead of
<%
It seems they are thread-safe since they rely on Thread.current: directly from guides.rubyonrails.org
Great screencast. I really like ImageMagick, here are some great examples of some stuff you can do if you're new to the library: http://imagemagick.org/Usage/
Guys, I ran into an issue with Monit + Resque + rbenv setup. My Resque workers fail to start with Monit saying
rbenv: not found
, but the same command works fine if I run it directly in console under user deployer. Have someone managed to set up monit to monitor Resque workers? Any ideas?I've posted some more info here: http://stackoverflow.com/questions/12094311/managing-resque-workers-with-monit-on-rbenv-setup
I have sort of got it.
The faq_id_list returns a list of id's that are allowed to be sorted. The procedure relies on the fact that the array intersection function returns items in the same order as the first parameter. (gulp)
If anyone has anything better here, would be good to see it.
Anyone done anything with this & update_all where the items being sorted have a user_id parent. As it is, a Post with a random set of Faq's could resort regardless of who the parent user_id is.
I set the position to Time.now.to_i as a default. You don't need to know a max position or reference the database to place it at the bottom of the list.
Awesome. Why don't you wrap your calendar helpers into gem?
I initial had some trouble implementing this together with Mongoid. It turned out that the problem was in the
mongoid.yml
configuration file. When I changedto
Everything worked properly. I guess this is because having a proxy server messes with the meaning of
localhost
.get rid of your watu_table_builder gem