But I've got a question:
I tried to use the example from this episode with the creation of a new category in my app. I use internationalization there. Has anybody an idea how I could add the correct label to my text_field, without duplication inside my locales?
I'm running rack 1.2.5 and having a hard time upgrading it, seems like rails 3.0.14 and 3.0.15 depend on exact this version or at least bundler insists on it..
Hi every one.. if iam using mongoid(mongo database for creating user) with out having devise gem on it.. how can i find current user.
rails g model user provider uid name oauth_token oauth_expires_at:datetime
invoke mongoid
create app/models/user.rb
invoke test_unit
create test/unit/user_test.rb
create test/fixtures/users.yml
this is way i created user model, in model, i change the code like...
in application.html.erb file how i need to get current user.. here we are using current_user right but if iam raise that, iam getting nill is current user.
one thing that sticks out is that I did not do much 1.9.1 testing, also is there something about http authentication that you have configured in prd but not in dev?
Hi @Sam - it works fine on my development machine but not on my production server, I get an 'Internal Server Error' and my production log shows:
Filter chain halted as #<Proc:0x000000059a2f68@/my_apps/apps/app_name/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_controller/metal/http_authentication.rb:112> rendered or redirected
Any ideas what's going on?
EDIT: I removed the http_basic_authenticate_with but it's still not working and there are no other clues in the log file :/
Interesting, what version of rails/ruby are you running, is there anything in the logs about the failure? Do you mind posting on http://community.miniprofiler.com
interesting, @clay what version of the pg gem are your running? We are forced to monkey patch the async version of pg exec, perhaps we should fall back to the non async ones as well
@dup2, have not tested 3.0.14, will test it out and reply on the community tracker.
Others, will try to respond to all the requests here today, but it would be mighty handy if you can post bugs/questions at http://community.miniprofiler.com
Is anyone having a problem displaying the profile_image_url? My code is below. The only thing that will display is the alt text of the img, never the image itself. However, when I review HTML, it has a url in the img and if I hover over the link it displays the image itself. This tells me the path is correct.
A minor update is required for sunspot_rails 1.3.3 (rails 3.2.6)
$ rake sunspot:solr:start
Note: This task has been moved to the sunspot_solr gem. To install, start and
stop a local Solr instance, please add sunspot_solr to your Gemfile:
group :development do
gem 'sunspot_solr'
end
How would you do it if you also wanted to use the :confirmable module in Devise? This sends an email for confirmation on user creation, but it fails in the scenario where you don't require an email address.
Is there an easy way of not requiring email and only confirm it if provided?
My unicorn workers die if I add rack-mini-profiler to my Gemfile. Ryan, do you know why this is happening?
At the moment I am profiling with thin, because I did not get it to run with Unicorn, but for better estimating performance problems, I would really like to profile with my production web server (unicorn)
Thanks for tutorial, just installed gem and nothing happened. FireBug console shows that every request POST http://0.0.0.0:3000/mini-profiler-resources/results is failed without any additional information =/
Hmm.. I installed the gem and the profiler tab shows up and displays the amount of time that loading took for a page, but it reports 0 sql queries for all pages. Any idea what's going on? I'm using postgres, but that shouldn't matter.
Hi,ryan i couldn't create a SCAFFOLD...?
It throws error
`require': no such file to load --
json (LoadError)
Only when i include gem 'rack-mini-profiler' or else it's fine...
Help me to come out...
I try the avatar_or_tag_taggings_tag_name_contains to combine a search on picture model witdh taggings, but widthout success.
Can you help me to do this?
I recently attended a conference in Australia and one of the talks covered off on the same sort of topic (link below). It was a little more in depth and focused on the inner workings of Chrome, but I thought it'd be worth sharing.
I would have liked to see how you handle concatenating multiple fields for the date/time/zone... rails date and time tag helpers are quite clumsy for users to operate. I tend to use text fields for both date and time and a select for time zone, with javascript popups for input selection. I hate the code in my model that puts this all together into a single database datetime column. Do you have a preferred method of handling this type of situation?
Hey Guys i am a newbie to this...Based on this railcast i tried to do the following. Failed. Can anyone please help?
This is my View
`<%= f.association :product, :collection => Product.in_stock %>
<%= f.grouped_collection_select :batch_no, Product.in_stock, :store_opening_stocks, :title, :batch_no, :batch_no, :prompt => "Select Batch"%>`
This is Jquery.
jQuery(document).ready(function(){
var child = jQuery('.batch').html();
jQuery('.prod').change(function() {
var parent = jQuery('.prod :selected').text();
var escaped_parent = parent.replace(/([ #;&,.+*~\':"!^$[]()=>|\/@])/g, '\$1')
var options = jQuery(child).filter("optgroup[label='#{escaped_parent}']").html()
if (options) {
jQuery('.batch').html(options);
return jQuery('.batch').parent().show();
} else {
jQuery('.batch').empty();
}
});
});
Really need help been stuck for a week now. Any Help would be helpful.
First of all: Great episode as always!
But I've got a question:
I tried to use the example from this episode with the creation of a new category in my app. I use internationalization there. Has anybody an idea how I could add the correct label to my text_field, without duplication inside my locales?
It could be worth mentioning that if you are using the 1.4.1 version of omniauth-facebook gem, you could be running into this error:
OmniAuth::Strategies::OAuth2::CallbackError
By instead using the 1.4.0 version this problem was resolved, at least for me.
The issue causinh this problem is the one reported here
This does not prevent the error message in the JavaScript console, though.
Btw I'm using rails 3.2.1 and ruby 1.9.3
Has anyone faced this issue:
# example code
def member_logged_in(*args)
binding.pry
@member = Member.find(args[0])
@club = Club.find(@member.club_id])
mail(:to =>.....)
end
Under 'rails console', I can 'find' a member from the console prompt => @member.club_id returns a value.
When the same code is invoked via worker in Sidekiq, from the pry prompt, @member.club_id returns nil.
Thoughts?
Sorry, my mistake. Actually request is aborted.
https://dl.dropbox.com/u/4109351/tmp/rack-mini-profiler-firebug-1.png
Should I post issue to community tracker?
Also thanks for awesome gem :D
I updated from 0.11 to 0.14 BTW
I'm running rack 1.2.5 and having a hard time upgrading it, seems like rails 3.0.14 and 3.0.15 depend on exact this version or at least bundler insists on it..
Thanks for your support.
Hi every one.. if iam using mongoid(mongo database for creating user) with out having devise gem on it.. how can i find current user.
rails g model user provider uid name oauth_token oauth_expires_at:datetime
invoke mongoid
create app/models/user.rb
invoke test_unit
create test/unit/user_test.rb
create test/fixtures/users.yml
this is way i created user model, in model, i change the code like...
class User
include Mongoid::Document
def self.from_omniauth(auth)
auth.slice(:provider, :uid) do |user|
user.provider = auth.provider
user.uid = auth.uid
user.name = auth.info.name
end
end
end
in application.html.erb file how i need to get current user.. here we are using current_user right but if iam raise that, iam getting nill is current user.
I'm using Ryan example tutorial file (example_before) which is provided by him. Version: rails 3.2.6 and Ruby 1.9.3.
You are the bomb.
That solved my issues with Redcarpet.
I have this working on 3.0.14 here, perhaps your version of rack is old, have you tried updating it?
one thing that sticks out is that I did not do much 1.9.1 testing, also is there something about http authentication that you have configured in prd but not in dev?
Again, nice tips Ryan.
I just prefer call async javascript througt a helper https://gist.github.com/3179378
Hi @Sam - it works fine on my development machine but not on my production server, I get an 'Internal Server Error' and my production log shows:
Any ideas what's going on?
EDIT: I removed the http_basic_authenticate_with but it's still not working and there are no other clues in the log file :/
"Ooh Dialup. That would be fun!"
Hahahahaha
Interesting, what version of rails/ruby are you running, is there anything in the logs about the failure? Do you mind posting on http://community.miniprofiler.com
I think the core of it was in maintaining the client side code, the server side was re-written pretty much with some similar paradigms
can you post a screen shot at http://community.miniprofiler.com ideally with the type of failure (is it a 404 or 500, what is in the error?)
interesting, @clay what version of the pg gem are your running? We are forced to monkey patch the async version of pg exec, perhaps we should fall back to the non async ones as well
what version of rails/ruby are you running?
what version of rails/ruby are you running?
@dup2, have not tested 3.0.14, will test it out and reply on the community tracker.
Others, will try to respond to all the requests here today, but it would be mighty handy if you can post bugs/questions at http://community.miniprofiler.com
Is anyone having a problem displaying the profile_image_url? My code is below. The only thing that will display is the alt text of the img, never the image itself. However, when I review HTML, it has a url in the img and if I hover over the link it displays the image itself. This tells me the path is correct.
Any suggestions would be greatly appreciated.
A minor update is required for sunspot_rails 1.3.3 (rails 3.2.6)
The rake task remains the same after this change
Try updating the pg gem. That did the trick for me.
Hi everyone...
How can I change the required/not required property or a given field ... based on the value of another completely different field?
Thanks for the introduction to MiniProfiler. I'm trying to use this on a 3.0.14 rails / 1.9.3-p194 ruby app without success.
Could not find any documentation about minimal requirements. Anyone having the same issue?
Some great tips again thanks Ryan.
If you want to check out more performance tips, see the work by Steve Souders http://stevesouders.com/
You might be interested in this gem I made called CSV shaper that allows you to create CSV output using a really nice Ruby DSL.
https://github.com/paulspringett/csv_shaper
Answering myself, there is an easy way, you just need to override confirmation_required? like this:
Devise is great :)
Thanks for another great episode, Ryan!
How would you do it if you also wanted to use the :confirmable module in Devise? This sends an email for confirmation on user creation, but it fails in the scenario where you don't require an email address.
Is there an easy way of not requiring email and only confirm it if provided?
My unicorn workers die if I add rack-mini-profiler to my Gemfile. Ryan, do you know why this is happening?
At the moment I am profiling with thin, because I did not get it to run with Unicorn, but for better estimating performance problems, I would really like to profile with my production web server (unicorn)
Would be glad about any hints.
Anyway, great episode!
Very nice Ryan! Thanks!
@Sam, as a suggestion, a post about the .net->ruby conversion would be awesome. And thanks for the great job!
Seems there is a problem with omniauth-facebook v1.4.1 (see http://stackoverflow.com/questions/11597130/omniauth-facebook-keeps-reporting-invalid-credentials)
Thanks for tutorial, just installed gem and nothing happened. FireBug console shows that every request POST http://0.0.0.0:3000/mini-profiler-resources/results is failed without any additional information =/
Hmm.. I installed the gem and the profiler tab shows up and displays the amount of time that loading took for a page, but it reports 0 sql queries for all pages. Any idea what's going on? I'm using postgres, but that shouldn't matter.
Hi,ryan i couldn't create a SCAFFOLD...?
It throws error
`require': no such file to load --
json (LoadError)
Only when i include gem 'rack-mini-profiler' or else it's fine...
Help me to come out...
+1 Awesome episodes this week
Hi,
in my project I use meta_search to implement serching in my model
My controller is:
My _search.html.erb is:
I try the avatar_or_tag_taggings_tag_name_contains to combine a search on picture model witdh taggings, but widthout success.
Can you help me to do this?
Tank in advance
Steve
Great Screen Cast Ryan
@pradeepbicc, Thats called as Nesting of routes.
Thanks Ryan, for Great Tutorial.
I tried with your example_before application. But, it doesn't show the small Profiler box on left side.
I just added this gem 'rack-mini-profiler' on my Gemfile (example_before).
Is it enough?. Or need to make any additional configuration.
This is a great little gem to see what overheads you are getting in your app due to not slim lining your SQL statements +1
Thank you Ryan. The last two episodes are very handy and useful. Performance is a very important place in the expanding world of Internet.
+1
I recently attended a conference in Australia and one of the talks covered off on the same sort of topic (link below). It was a little more in depth and focused on the inner workings of Chrome, but I thought it'd be worth sharing.
Thank you and great episode as always :)
http://lanyrd.com/2012/web-directions-code/swmwx/
Big thanks Ryan, for the excellent Railscast!
I would have liked to see how you handle concatenating multiple fields for the date/time/zone... rails date and time tag helpers are quite clumsy for users to operate. I tend to use text fields for both date and time and a select for time zone, with javascript popups for input selection. I hate the code in my model that puts this all together into a single database datetime column. Do you have a preferred method of handling this type of situation?
Rayan,
Regarding to create a new comment on each model,
I have "news" model and "task" model which is nested under "project" model routing
Is there a way to accomplish it so I don't have two links?
I am having trouble getting the javascript to load properly
any suggestions on what I'm missing and yes it is loaded in the list of scripts
I found that nginx was using /var/run/nginx.pid instead of /tmp/nginx.pid for the pid file by default. Just had to change nginx.conf: