Anyone getting this error on every single page? I can go to /auth/facebook and it redirects to Facebook for the auth, but when I come back I get this error. I also get this error on any other page I attempt to access:
"undefined method `helper_method' for main:Object"
Also, nothing populates in my users table.
This is coming from the bottom of application_controller.rb, which says in the show notes:
I am getting an error if the user is not logged in. How do you enforce signup if they want to vote, while still allowing them to look at the page if they haven't signed up?
I am new to rails. How do I make this example show the data by hour?
My database has two relevant columns: "data_time" and "values". I have a few values per hour, so, I wanted to plot them all. I was able to group by hour changing:
group("date(data_time)")
to:
group("strftime('%Y-%m-%d %H', data_time)")
But the graph still shows only per day. I suspect it has something to do with:
Better solution is to use ajax. It's easier to read now and programmer knows what's going on.
When you are using the ".erb" code, it out of context and there are two different places.
I'm trying to test specific extensions to an engine I mounted in my app.
I wanted to have a look at the puppy project you mention, but the repo is not there anymore. Do you mind sharing that project or the rationale that made it work?
For anybody that's getting bitten by the "redundant UTF-8 sequence" bug when attempting to upload an Excel file (which is likely causing the error Ryan refers to), a fix has been implemented in the 3-2-stable branch of rails, but not released yet. In order to get this goodness into your own app, simply create this file:
ruby
moduleActiveSupport::JSON::Encodingdefself.escape(string)
if string.respond_to?(:force_encoding)
string = string.encode(::Encoding::UTF_8, :undef => :replace).force_encoding(::Encoding::BINARY)
end
json = string.gsub(escape_regex) { |s| ESCAPED_CHARS[s] }
json = %("#{json}")
json.force_encoding(::Encoding::UTF_8) if json.respond_to?(:force_encoding)
json
endend
...and be sure te require it. You should be good to go, after that.
I get the error "can not update on a new record object" for the method index_term on the increment!. This makes sense but I am not sure of the best way to fix it other than using first_or_create. Suggestions(hehe)?
No, the updated_at timestamp is coming from the object you've already pulled... specifically this is generated using the cache_key method on your object. Then it's generating an MD5 of your template to see if it's changed and adding that into the key being stored in memcache.
you would want to use a scheduler of some sort that calls the rake task every fixed interval of time. check out the Whenever gem, or if you're deploying on Heroku there's an easy to use scheduler add-on.
I can't get the javascript to load. I mean, the javascript file I see in my code, but then I can't get anything to call the best_in_place thing properly. Everything errors saying it isn't there.
Bashing head into wall. Debugging Javascript is impossible.
how do I display a controller validation error on the liquid page once a user submits a form? basically how do i rerender the liquid page with the exception as a variable in the template?
I would be also amazed that you could come Ryan to Paris.rb ! I have a couch and I can show you some amazing places in of Paris ! => http://meetup.rubyparis.org/
Happy new year, and stay how you are, amazing and so helpful !
Took me awhile to discover that you can't login if your form is built with simple_form.
My sessions controller is in an admin namespace and the builder gave me "/admin/sessions[password]".
your method is really nice ,,,I tried it ,,but with internationalization ,,,its not working ,,,on console it gives me the get method for url is ok ..but no appending happens for pagination ...I am using kaminari so , and I used
your method is really nice ,,,I tried it ,,but with internationalization ,,,its not working ,,,on console it gives me the get method for url is ok ..but no appending happens for pagination ...I am using kaminari so I replaced .next_page with .next a , and I used
I've messed with both.
It should be a fairly simple transition, assuming you aren't using things that have been deprecated in Rails 3 (which would be removed in Rails 4)... and of course assuming you are at least on Rails 3.1. The Asset Pipeline is a fairly large hurdle.
Hi Ryan, thanks for another awesome tutorial! Great! :) Just wanted to add… if anyone's having trouble getting terminal colors working after creating ~/.bash_profile, you need to run source ~/.bashrc each time you login. Or you can add the line to ~/.bash_profile by typing the following in terminal:
He talks about this in the video: " If we used a before_filter here instead the time zone would leak through to other requests so it’s necessary to use an around filter instead."
Just adding another +1 for EmberJS
also just do a migration for hstore:
def self.up
execute "CREATE EXTENSION hstore"
end
def self.down
execute "DROP EXTENSION hstore"
end
end
I learned more in those 9 minutes than in any other 9 minutes i can recall.
Nevermind, Rails 4 beta as of today is back to using
:child_index
.Anyone getting this error on every single page? I can go to /auth/facebook and it redirects to Facebook for the auth, but when I come back I get this error. I also get this error on any other page I attempt to access:
"undefined method `helper_method' for main:Object"
Also, nothing populates in my users table.
This is coming from the bottom of application_controller.rb, which says in the show notes:
helper_method :current_user
The error I get is "Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id"
There should be noted, that this gem isn't aware of
I18n
. Because of this you should always write something likein multilingual applications or write a helper for this. And there is no plans to support
I18n
in future. More info.It should be fairly simple. Most of the new stuff could be used in Rails 3.2 as gems.
I describe the process on this article: http://rubysource.com/get-your-app-ready-for-rails-4/
This a newbie question:
I am getting an error if the user is not logged in. How do you enforce signup if they want to vote, while still allowing them to look at the page if they haven't signed up?
Hi guys,
I am new to rails. How do I make this example show the data by hour?
My database has two relevant columns: "data_time" and "values". I have a few values per hour, so, I wanted to plot them all. I was able to group by hour changing:
group("date(data_time)")
to:
group("strftime('%Y-%m-%d %H', data_time)")
But the graph still shows only per day. I suspect it has something to do with:
(start.to_date..Date.today).map do |date|
but I can't figure out what it is!
Better solution is to use ajax. It's easier to read now and programmer knows what's going on.
When you are using the ".erb" code, it out of context and there are two different places.
I'm having problems to show the tickets after pop3 ativation.
Encoding::CompatibilityError in Tickets#index
Showing /home/caio/RubymineProjects/tickets/app/views/tickets/index.html.erb where line #17 raised:
incompatible character encodings: UTF-8 and ASCII-8BIT
Extracted source (around line #17):
14:
15: <%= ticket.Subject %>
16: <%= ticket.From %>
17: <%= ticket.Body %>
18: <%= link_to 'Show', ticket %>
19: <%= link_to 'Edit', edit_ticket_path(ticket) %>
20: <%= link_to 'Destroy', ticket, method: :delete, data: { confirm: 'Are you sure?' } %>
Rails.root: /home/caio/RubymineProjects/tickets
Application Trace | Framework Trace | Full Trace
app/views/tickets/index.html.erb:17:in
block in _app_views_tickets_index_html_erb___2407065071369385486_24584740'
each'app/views/tickets/index.html.erb:13:in
app/views/tickets/index.html.erb:13:in
_app_views_tickets_index_html_erb___2407065071369385486_24584740'
index'app/controllers/tickets_controller.rb:7:in
I'm googling a lot but I've found nothing...
How can u get rid of the "page=1" on the url link?
Hi,
I'm trying to test specific extensions to an engine I mounted in my app.
I wanted to have a look at the puppy project you mention, but the repo is not there anymore. Do you mind sharing that project or the rationale that made it work?
Thank you very much
Tried this. Looks great, but requires a lot of effort to fit in my environment (I18n, etc.).
For anybody that's getting bitten by the "redundant UTF-8 sequence" bug when attempting to upload an Excel file (which is likely causing the error Ryan refers to), a fix has been implemented in the 3-2-stable branch of rails, but not released yet. In order to get this goodness into your own app, simply create this file:
...and be sure te
require
it. You should be good to go, after that.Does anyone know how integrate passenger with virtualhostx ?
Shouldn't that be
include Concerns::Userable
andmodule Concerns::Userable
? Rails autoloading assumes directories correlate to namespaces.Yes i am deploying to Heroku. I will check it out. Thanks for the info.
I get the error "can not update on a new record object" for the method index_term on the increment!. This makes sense but I am not sure of the best way to fix it other than using first_or_create. Suggestions(hehe)?
This is how to support the edit form. Notice the trigger method.
Description: Execute all handlers and behaviors attached to the matched elements for the given event type.
I'm facing the same issue, could you solve it?
No, the updated_at timestamp is coming from the object you've already pulled... specifically this is generated using the cache_key method on your object. Then it's generating an MD5 of your template to see if it's changed and adding that into the key being stored in memcache.
What about utf-8? I cannot see Turkish characters in pdf file :/
you would want to use a scheduler of some sort that calls the rake task every fixed interval of time. check out the Whenever gem, or if you're deploying on Heroku there's an easy to use scheduler add-on.
Use rake task. It's great for doing this kind of job.
I can't get the javascript to load. I mean, the javascript file I see in my code, but then I can't get anything to call the best_in_place thing properly. Everything errors saying it isn't there.
Bashing head into wall. Debugging Javascript is impossible.
I knew my problem now ...your idea is really cool and saved many days of search...
I used next_page with a ,,,but after adding 'a' its working now
What if no associated records exist? How would I use this in a new form where neither table has any records, to create new records?
cant you just do
alias_method :twitter, :all
alias_method :facebook, :all ?
how do I display a controller validation error on the liquid page once a user submits a form? basically how do i rerender the liquid page with the exception as a variable in the template?
thx
Amazing episode Ryan, as always !
And I love your last words about others skills than programming ! I personally want to make music in 2013 :)
If you are interested in listening to my music, check out https://soundcloud.com/thibaut-assus-1 :)
I would be also amazed that you could come Ryan to Paris.rb ! I have a couch and I can show you some amazing places in of Paris ! => http://meetup.rubyparis.org/
Happy new year, and stay how you are, amazing and so helpful !
https://github.com/railscasts/episode-351/blob/master/raffler-after/raffler.css is returning a 404 for me, the correct link should
https://github.com/railscasts/351-a-look-at-meteor/blob/master/raffler-after/raffler.css
Great episode, building off this for auto detection...
** How do you convert js values received as TZInfo identifiers to Rails TimeZone name/key? **
FROM: "America/New_York" returned from JavaScript TZinfo detection
TO: "Eastern Time (US & Canada)" convention used in Rails TimeZone
http://stackoverflow.com/questions/14221615/how-to-convert-tzinfo-identifier-to-rails-timezone-name-key
Thanks!
-E
Hi, Clemens.
I also met this problem. Did you find a solution?
Thanks.
Be careful with simple_form
Took me awhile to discover that you can't login if your form is built with simple_form.
My sessions controller is in an admin namespace and the builder gave me "/admin/sessions[password]".
I quickly run in to some kind of brick wall when trying this out, TDD style ofc ;) This blog post, by someone running faster than me, cleared most of it up: http://www.superpumpup.com/blog/1079982-postgresql-schema-multi-tenancy-and-rspec-testing/
So if you are having troubles with Database Cleaner not being cleanly enough with your schemas, give it a read.
+1
your method is really nice ,,,I tried it ,,but with internationalization ,,,its not working ,,,on console it gives me the get method for url is ok ..but no appending happens for pagination ...I am using kaminari so , and I used
your method is really nice ,,,I tried it ,,but with internationalization ,,,its not working ,,,on console it gives me the get method for url is ok ..but no appending happens for pagination ...I am using kaminari so I replaced .next_page with .next a , and I used
I've messed with both.
It should be a fairly simple transition, assuming you aren't using things that have been deprecated in Rails 3 (which would be removed in Rails 4)... and of course assuming you are at least on Rails 3.1. The Asset Pipeline is a fairly large hurdle.
You must 'CREATE EXTENSION hstore' first
maybe the search path is not being set correctly??
I'm running into this error, but I want to make this work without using apartment for now. any ideas?
Same here!
Both in Rails 3.2.8 and 3.2.10
Gemfile:
source 'https://rubygems.org'
gem 'rails'
gem 'mysql2'
group :test, :development do
gem "rspec-rails", "~> 2.6"
gem 'factory_girl_rails'
end
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem 'jquery-datatables-rails'
gem 'jquery-ui-rails'
end
gem 'jquery-rails'
gem 'prawn'
gem 'kaminari'
Same problem here. Has anyone found a workaround?
Hi Ryan, thanks for another awesome tutorial! Great! :) Just wanted to add… if anyone's having trouble getting terminal colors working after creating ~/.bash_profile, you need to run
source ~/.bashrc
each time you login. Or you can add the line to ~/.bash_profile by typing the following in terminal:Ok adding group_ids as attr_accessible in my User Model solve the problem !
Sorry :p
He talks about this in the video: " If we used a before_filter here instead the time zone would leak through to other requests so it’s necessary to use an around filter instead."
Thanks for this great screencast.
Got an issue with my app.
Checkboxes well diplayed, but when I update, got a message "Can't mass-assign protected attributes: group_ids"
So, I try to manage membership.
Got users and groups.
membership model :
User model :
Group model
Here the code in my form
Did I miss something ?
Thanks