[Rails] Re: openstreetmap as link

2014-08-15 Thread Eric Saupe
%= link_to('my_link') do % divOPEN STREETMAP CONTENT/div% end % You can put a div inside of the a generated by link_to and this will work for you but putting block elements inside of a is not really good practice. Instead you could try span instead of div On Friday, August 15, 2014

[Rails] Re: Can't mass-assign protected attributes: item

2014-08-14 Thread Eric Saupe
Quick Google search brought up http://railscasts.com/episodes/26-hackers-love-mass-assignment and this StackOverflow question, http://stackoverflow.com/questions/6163759/cant-mass-assign-protected-attributes. On Thursday, August 14, 2014 3:31:12 PM UTC-6, Fernando Aureliano wrote: Hi! I'm

Re: [Rails] conditional layout question ? sidebar visible on all pages except the login page.

2014-08-13 Thread Eric Saupe
No, the render command goes in your layout in this case since it is something that a lot of your views are using. %= render “sidebar” unless current_page?(login_path) % On Wednesday, August 13, 2014 12:32:48 AM UTC-6, Roelof Wobben wrote: oke , and put this in the controller ?? Roelof

Re: [Rails] conditional layout question ? sidebar visible on all pages except the login page.

2014-08-13 Thread Eric Saupe
. I see a message that login_path is not known. I think that devise is messing things up. Roelof Op woensdag 13 augustus 2014 17:56:23 UTC+2 schreef Eric Saupe: No, the render command goes in your layout in this case since it is something that a lot of your views are using. %= render

Re: [Rails] Error after calling bundle install (Ruby on Rails installation) (Mac OS X)

2014-08-06 Thread Eric Saupe
OSX doesn't have apt-get. You should use brew instead,http://stackoverflow.com/questions/19688424/why-is-apt-get-function-not-working-in-terminal-on-mac-osx-10-9, but this can occasionally have different installation instructions. Make sure you are installing MySQL correctly for Mac. On

[Rails] Re: General Information About RoR

2014-08-04 Thread Eric Saupe
Hey Diego, First, there is nothing wrong with running a local web server and just having your browsers access it. Since the only users of your application are going to be those on the same network it really doesn't matter if it is hosted externally or internally and since the Internet going

Re: [Rails] Re: General Information About RoR

2014-08-04 Thread Eric Saupe
is: is there any known gem to help handling these communication cases? Again, thanks for the attention. Regards, Diego Dillenburg Bueno 2014-08-04 12:46 GMT-03:00 Eric Saupe eric...@gmail.com javascript:: Hey Diego, First, there is nothing wrong with running a local web server and just

[Rails] Re: password validation triggered even I update non-password attribute

2014-08-01 Thread Eric Saupe
I had this same problem a while ago. The issue comes in the update_attributes since it wants to update all of the attributes that are being passed to it, which is including an empty password. To fix it you'll need to do two things. First change the validates to only validate if a password is

Re: [Rails] Variable + string to specify variable

2014-07-31 Thread Eric Saupe
I knew there would be a nice simpler Ruby way. I love the second solution, Rob. Below is the updated example. id = 100 arrays = [Array.new, Array.new, Array.new] arrays.sample.push(id) On Thursday, July 31, 2014 8:45:33 AM UTC-6, Rob Biedenharn wrote: On 2014-Jul-30, at 10:59 , Eric Saupe

Re: [Rails] Variable + string to specify variable

2014-07-30 Thread Eric Saupe
To expand on what Scott is saying here is some code that gives an example of what he is referring to. id = 100 x = rand(1..3) arrays = [Array.new, Array.new, Array.new] selected_array = arrays[x] selected_array.push(id) On Tuesday, July 29, 2014 8:05:16 PM UTC-6, Scott Ribe wrote: On Jul

[Rails] Re: Customise message for validates_uniqueness_of

2014-07-28 Thread Eric Saupe
This is along the lines of what Matt is referring to. class DayValidator ActiveRecord::Validator def validate() if YOUR_TEST_FOR_INVALIDITY(record.day) date = Date::DAYNAMES[record.day] record.errors[:day] already has a target #{date} end end end class YourClass

Re: [Rails] undefined method `authenticate' for nil:NilClass

2014-07-21 Thread Eric Saupe
@Ian, He is not using Devise if he is going through the Hartl tutorial. Scott's suggestion is the one that should be followed. On Monday, July 21, 2014 10:36:01 AM UTC-6, Ian_Rgz wrote: It seems that you need to create the Devise mapping(If you're using devise), to fix this you can: - Set

Re: [Rails] Re: Upload UTF-8 encoded textfile

2014-07-17 Thread Eric Saupe
Colin, That shows how to create a Tempfile with a given encoding but the question is when a user uploads a file through a form and Rails creates a Tempfile is there a way to indicate that it should always create those Tempfiles with a default encoding such as UTF-8? On Thursday, July 17, 2014

Re: [Rails] Re: Upload UTF-8 encoded textfile

2014-07-17 Thread Eric Saupe
wrote: On 17 July 2014 15:42, Eric Saupe eric...@gmail.com javascript: wrote: Colin, That shows how to create a Tempfile with a given encoding but the question is when a user uploads a file through a form and Rails creates a Tempfile is there a way to indicate that it should

[Rails] Re: Re: Upload UTF-8 encoded textfile

2014-07-17 Thread Eric Saupe
UTC-6, Ruby-Forum.com User wrote: Colin Law wrote in post #1152686: On 17 July 2014 15:42, Eric Saupe eric...@gmail.com javascript: wrote: That shows how to create a Tempfile with a given encoding but the question is when a user uploads a file through a form and Rails creates

[Rails] Re: Upload UTF-8 encoded textfile

2014-07-16 Thread Eric Saupe
Does setting config.encoding = utf-8 in your config/application.rb help? You'd also need to add # encoding: UTF-8 to the top of your file. I was reading this http://craiccomputing.blogspot.com/2011/02/rails-utf-8-and-heroku.html which seems to discuss this problem. On Wednesday, July 16,

[Rails] Re: SQL OR in RoR

2014-07-16 Thread Eric Saupe
@games = Game.sorted.where(home_team = :id OR away_team = :id, id: params [:id]) That should do the trick for you. You can have a string inside of your where statement that equates to SQL. You can then have named parameters that are used throughout the query as I have done above. In this case

[Rails] Re: Upload UTF-8 encoded textfile

2014-07-15 Thread Eric Saupe
Gotcha. Is the file actually opened when the controller is entered? (That's an honest question I'm interested in how that works coming as an upload from a form) The way you've described, that I failed to understand the first time, to me seems like the best way but I'd be interested to see what

Re: [Rails] Re: cannot connect to local host

2014-07-14 Thread Eric Saupe
Hassan is right. I doubt the problem is with your Gemfile.lock so I suggest starting elsewhere and leaving it alone. The best thing would be to stash your changes using git and going back to a working version of the application. Go back to the last version that worked and see what's different.

[Rails] Re: Upload UTF-8 encoded textfile

2014-07-14 Thread Eric Saupe
Maybe try this? http://stackoverflow.com/questions/5163339/write-and-read-a-file-with-utf-8-encoding Does it matter if every file is considered UTF-8 even if it never contains a UTF-8 character? On Monday, July 14, 2014 5:01:11 AM UTC-6, Ruby-Forum.com User wrote: My Rails application (Rails

[Rails] Re: layout rendering problem

2014-07-14 Thread Eric Saupe
Because you have /layouts inside of /welcome it would need to be %= render 'welcome/layouts/login' % and I think you'll also need an underscore before login.html.haml to make it _login.html.haml because it's a partial. On Sunday, July 13, 2014 5:45:39 AM UTC-6, Roelof Wobben wrote: Hello,

[Rails] Re: how to make this form

2014-07-14 Thread Eric Saupe
%= form_for @user do |f| % div class=field %= f.label :login_naam %: %= f.text_field :login_naam, class: login, placeholder: login naam %br / /div %= f.submit % % end % You'll want to let Rails take care of the id's so they can match up the label with the field automatically as