Activity
Yeah I was going to say, it seems like your Gemfile
is missing from the git repo.
Sounds like you're just about finished with it! That last error sounds like your database.yml file might be misconfigured. It looks like you've got the IP address on the line where the adapter should be. Can you paste your database.yml file so I can take a look?
Posted in Capistrano deployment errors
That's interesting. Is the version of Ruby running on your server the same version as the one you have locally by chance?
Posted in Setup MacOS 10.10 Yosemite Discussion
I think we have all been there more than a few times. ;)
Posted in Setup MacOS 10.10 Yosemite Discussion
Your SQL server may not be running either just because it wasn't started or because of an error. You'll want to run "brew info mysql" and read the notes for the command to start the server. You can run it manually to see if it starts, and then if that goes well, you can run the launchctl commands to have it start on boot.
Solid!
Oh of course. If you look at your routes, there is no POST
paths there. I think you can change the resources :like
to be singular instead like this: resource :like
and that will help.
In either case, your rake routes
should be creating a POST link to let you create a new like. It's odd that your current one doesn't have a POST route.
You could. I rarely have the need for going back to logs over 2 weeks old, so I don't keep them around. If you need to, you can always sync those somewhere.
Yup! The libraries have a couple different helper methods. I got confused using the wrong gem the other day. ;)
Hey Pablo,
Your link looks correct and so do your routes. Are you getting an error?
Posted in Token Auth API with Devise
That app is pretty good and I've used Devise token_authenticatable
in the past and it works pretty well. I'd recommend using as long as you don't need something complicated with your API tokens.
I think doing an episode on using token_authenticatable and one from scratch would be great. Are there any particular things you'd like to see covered in an episode?
Posted in Performance increase over group_by
You could take advantage of Ransack for the search there. It has all kinds of nice things that can take care of searching and sorting. Take a look at the episode I did on it: https://gorails.com/episodes/forum-search-with-ransack
Two changes I would suggest, but depending on what you're trying to achieve, they might not be relevant:
- Your search by options aren't safe in that I can type
?search_by=destroy
and it will send method call that to the user instance which could delete the records for example. That's a potential security problem so you will probably want to validate that better.
@search_by_options = [:age, :location, :department, :designation]
# Verify the search_by column is valid, otherwise default to location
@search_column = @search_by_options.include?(params[:search_by]) ? params[:search_by] : :location
- If you don't plan on linking the user names anywhere, you could do the
map
inside the controller instead. That would make it a little bit more obvious in the views.
@grouped_user_names = User.all.group_by { |user|
user.public_send(params[:search_by] || :location)
}.map(&:name).join("||")
<% @grouped_user_names.each do |grouping_key, user_names| %>
<p> <%= grouping_key %> : <%= user_names %></p>
<% end %>
And since the controller mapping is reasonably nasty, you could put that inside a class method on User
or you could create a presenter class to handle the logic. I'd go with the class method at first until you have a handful that can be refactored into a presenter.
Posted in Performance increase over group_by
In that case, I think your approach is fine. A group by
query isn't really going to help you much in SQL because you still need to sort it on the Ruby side. The SQL group by
is most useful when you're gathering things like counts or doing joins, not for ordering results.
The Ruby group_by
method is actually what you want here to organize your results. I would maybe rename @users
to @grouped_users
so that it is clear the variable is not an array of users but a grouped array.
Posted in Performance increase over group_by
Are you trying to implement a search or just sorting into groups? Depending on the goal, I have a few different suggestions.
Posted in Subdomains
Fantastic question and I think this is worthy of recording an episode (or two) on asap. One suggestion is the apartment gem but also it's wise to build this from scratch so you can have a good understanding of everything you need to consider when building a multi-tenant / subdomain app.
Hopefully I'll be able to record an episode for this next week!
Really not too much if you want to use something like Wistia for the video hosting. You can control access there and it is about as simple as building a building a blog for the videos, email integration, and file storage somewhere.
Totally ballpark, I'd say depending on how little you could get away with, it might cost $1500 or higher.
If you use the localize method in both places, it will work just fine for translatable strings. You just want to make sure you always keep them the same.
Posted in 2 submit button in 1 form
Here you go! I ended up getting to this topic really quickly. :)
https://gorails.com/episodes/forms-with-multiple-submit-buttons
This looks like a reasonable approach to testing your user creation and lookups but it isn't a full example: http://stackoverflow.com/qu...
Posted in Deploy Rails
Good find! I've had to do that a couple times before but I can't remember the exact situation that required setting the env. This is good to note and hopefully helpful for other people running into similar problems.
Posted in SimpleCalendar 1.1 released! Discussion
Updated the post to show the code for those. I'll point you to the Github page for the latest info on the gem though: https://github.com/excid3/s...